Re: Cannot solve complex problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"Keith Stemmer" <k.stemmer@xxxxxxxxxxx> schrieb im Newsbeitrag
news:O7RCpWzlIHA.5084@xxxxxxxxxxxxxxxxxxxxxxx

Damn, this makes it useless for me, because I need
to use LIKE and = for Unicode strings...

Nah, not that fast ... ;-)

The SQLite-Engine offers a Callback-Interface for
your own userdefined functions, which I wrapped
in a way, that you can write your additional VB5/6-based
Function-implementations in a very easy way
(this is covered in the SQLite-Demo-Project with
appropriate Sample-Code).

And if you choose a Function-Name, which is identical
to an already builting (original) SQLite-Function, you can
use that UserFunction-Interface, to override the already
existing SQLite-behaviour.
In my wrapper I have overridden the builtin Like,
UCase and LCase-Functions, which now map
internally to the original VB-Widestring-pendants.
So in short: Like, UCase and LCase behave exactly
as in VB6 - because I delegate to them internally.

I also added all kind of additional Functions, not
in the original SQLite-Engine as DateDiff(), Format(),
Instr(), DatePart(), CLng(), CDate(), CCur(), Left$(),
Right$() + Math-stuff, nearly the whole "Basic-Procs"
as e.g. in JET.
You can lookup these enhanced Function-Set also
in my Demos, where I implemented a fast Eval-Parser
(Plotting some Math-Functions).

So, simply try Like over my wrapper - it should work
case-insensitive - and also be able to deal with Unicode -
at least in the same way as the direct "Like-Usage" in VB6.

Regarding Encryption - this is builtin too (currently
working 256Bit-RC4-based, which is very fast and
does not add too much overhead reading/writing
DB-Pages from/to Disk (some 10% ca.).
You can create an empty, new DB with:
Cnn.CreateNewDB FileName, "YourEncryptionKey"
Add your tables to it - and later on open it with:
Cnn.OpenDB FileName, "YourEncryptionKey"
You can do a prior hash for the "EncryptionKey", if you
want - and use the builtin cCrypt-Class for this task
(the GetHashedPassword-Method, which uses
SHA1 internally and works Unicode-Based, meaning,
no conversion of the given VB-Widestring is done
prior to the SHA1-Hashing).

But you can also use the Cnn.Rekey-Methods, to
encrypt/decrypt an already opened Connection.
To encrypt a not yet encrypted DB use:
Cnn.ReKey "YourEncryptionKey"
To decrypt/reset an encrypted DB to "unencrypted
state" use:
Cnn.ReKey 'without optional Param
This Method can take some time (on real large DBs, because
your whole DB-Content is then converted DB-Page wise -
basically working at Disk Read/Write-Speed-Level
with ca. 20-40MB/sec.
To use the builtin encryption I would recommend,
to use the Cnn.CreateNewDB-Method, to set up a new,
empty (encrypted) DB first - and copy the Data from your
"older" SQLiteDB (not created by my wrapper) over.
Direct usage of the .ReKey-Method against your older,
already existing SQLite-DBs is not recommended without
having a backup of them (because currently I don't check
for older SQLite-2-Formats or different PageSize-Settings
on those DBs - though it should work - but without "warranty")
But ReKey(ing) against DBs, created over my wrapper, should
do fine.


Olaf




.