On 30/03/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
<[EMAIL PROTECTED]> wrote:
> > >
> > > I'm looking at using Sqlite as a storage backend for a program.
> > > Using SQL is a little bit overkill....
> >
> > why bother with SQLite then? Use the right tool for the job
> > -- use BerkeleyDB.
> >
>
> Size is a constraint for me.
> I see that SQLite can be around 170KB where BerkeleyDB is around 500K.
> I also see that the SQL statements can be converted to byte code.
> Is this byte code more efficient that the SQL statement in code size?
> I'm looking at embedding a DB of some type into a Single Board Computer
> with no OS.
>

There is a proprietary version of SQLite (call the SQLite Stored
Statement Extension of "SSE") that can be as small as about 50K,
especially if all you want is key/value pairs.

SSE omits the SQL parser on the embedded device.  You store the
SQL statements that you want to run in a table in your database
file.  Then on a development machine, you run a special command
that precompiles those SQL statements into bytecode and stores
the bytecode back in the database in place of the original SQL.
Then you transfer the database to the embedded device.  On the
embedded device, you specify precompiled SQL statements by number,
loading them out of the database as sqlite3_stmt objects.  Then
you bind host parameters and run sqlite3_step() and sqlite3_reset()
or sqlite3_finalize() just like you normally would.

SSE is currently used on smart cards where memory is scarce and
battery power even scarcer.  But it is proprietary, not free like
standard SQLite.  On the other hand, it is much, much less expensive
than BDB.
Sound very good!

The bytecode
is actually larger than the original SQL statements,
in most cases.  How much larger depends on the statement.  SQL like

I will work the weekend if i have time to do something like this. A SQLite
compiler.. and a DB-Manager just with the bytecode virtual machine.  Is that
usefull?
     SELECT * FROM table1

can generate either small or large amounts of byte code depending,
for example, on how many columns the "*" expands into.

Please contact me off-list if you want more information.

--
D. Richard Hipp  <[EMAIL PROTECTED]>




-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]

-----------------------------------------------------------------------------




--
Cesar Rodas
http://www.cesarodas.com/
Mobile Phone: 595 961 974165
Phone: 595 21 645590
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Reply via email to