Not working for me (SQLite version problem?)

Dec 21, 2012 at 4:55 PM

I have a database file that was created with System.Data.SQLite version 1.0.82 and I'm trying to inspect it with the Powershell provider. I can create the drive and view the schema info (ie dir db:), but if I query table rows (ie dir db:/TableName) I get no output.

I notice that the embedded SQLite binaries in the module are an older version, could that be the problem?

Coordinator
Dec 28, 2012 at 8:25 PM

That could very well be the issue.  You can try replacing the sqlite binaries in the module folder with the newer version.

SQLite is also sensitive to 32/64-bit environments; if the database was created using the 64-bit version of sqlite, and you're using the 32-bit version, it tends to fail.

One thing that may be helpful: set the value of $verbosepreference to 'continue' before attempting to read data from the table.  This will drop verbose messages to the console during the read, including things like the sql being passed to the SQLite provider.

Jan 4, 2013 at 7:55 PM

Just got back to looking into this...

After dropping newer (1.0.82) versions of System.Data.SQLite into the module (bin/x32 and bin/x64), I can't create a drive:

New-PSDrive : Could not load file or assembly 'System.Data.SQLite, Version=1.0.77.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The system cannot find the file specified.

Which makes sense, I guess, if the provider was compiled against the older version.

I couldn't be bothered to mess around with <bindingRedirect> in the Powershell config file, so I recompiled to provider from sources with the latest SQLite libs.

Now I can create a drive, but can't connect to it:

PS>ipmo SQLite
PS>new-psdrive -name db -psp SQLite -root "Data Source=c:\temp\mr.db"

Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
----           ---------     --------- --------      ----                                               ---------------
db                                     SQLite        [Data Source=c:\temp\mr.db]

PS>dir db:\
no current SQLite session exists
At line:1 char:1
+  <<<< dir db:\
    + CategoryInfo          : InvalidOperation: (:) [], InvalidOperationException
    + FullyQualifiedErrorId : GetChildrenDynamicParametersProviderException

I guess something more fundamental changed in System.Data.SQLite that will require a provider change...

 

Jan 4, 2013 at 9:06 PM

Actually it looks like there's some method interception that's not happening in my build. Maybe I didn't build it correctly? I didn't seem to get any errors when doing:

ipmo <psakedir>/psake.psm1

invoke-psake .\default.ps1

[Although admittedly, I'm not all that familiar with psake or PostSharp]

Jan 4, 2013 at 10:25 PM

Ah, I see - I need to have an offical release of PostSharp installed in order to build this correctly. This seems to be a licensed commercial product - is there a free version available for open source development?

Anyway after installing a PostSharp eval version I can import the module, create a drive, and see the schema of my database.

Unfortunately, querying a table now seems to hang...

Getting closer, though!

Coordinator
Jan 11, 2013 at 3:40 PM

Yeah, that's been a recurring issue with many of my OSS projects - Postsharp is great but licensed.  They do have a free version but I'm pretty sure it doesn't do everything you'll need to build the provider.  They also have an OSS licensing program but it's on a per-project basis and requires a special install.  I'm in the process of removing the Postsharp dependency from the provider framework - would you be open to testing it out with this project when it's ready (hopefully in the next week)?

Jan 18, 2014 at 5:01 PM
I would ;)