Re: [sqlite] Sorting with latin1 characters

2007-03-31 Thread Alberto Simões

On 3/31/07, Nuno Lucas <[EMAIL PROTECTED]> wrote:

On 3/31/07, Alberto Simões <[EMAIL PROTECTED]> wrote:
That is by design. SQLite only knows how to sort ASCII strings.

The problem is that almost every language has it's own idea of how to
sort, and making SQLite know about all this would take the "lite" from
SQLite.


Ok, I can understand it.


You can create your own COLLATE function and make SQLite use it. Take
a look here:
http://www.sqlite.org/capi3ref.html#sqlite3_create_collation


Anybody knows if there is some Perl way to do that? (using DBD::SQLite
it doesn't seem available).

Cheers
Alberto

--
Alberto Simões

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



Re: [sqlite] Sorting with latin1 characters

2007-03-31 Thread Nuno Lucas

On 3/31/07, Alberto Simões <[EMAIL PROTECTED]> wrote:

Hi

I am trying to sort results from a SELECT using ORDER BY. That column
includes latin1 characters, and SELECT returns the entries with
accented characters at the end of the list.


That is by design. SQLite only knows how to sort ASCII strings.

The problem is that almost every language has it's own idea of how to
sort, and making SQLite know about all this would take the "lite" from
SQLite.

You can create your own COLLATE function and make SQLite use it. Take
a look here:
http://www.sqlite.org/capi3ref.html#sqlite3_create_collation


Regards,
~Nuno Lucas



I am using DBD::SQLite, so I am not sure if I tested correctly the
change of environment variables to see if sqlite reacts to that
changes.

Thanks in advance for any help
Cheers
--
Alberto Simões


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



Re: [sqlite] Using the Sqlite Btree Backend directly

2007-03-31 Thread Cesar Rodas

On 31/03/07, Cesar Rodas <[EMAIL PROTECTED]> wrote:




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]



And the source will be public domain as SQLite

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


Re: [sqlite] Using the Sqlite Btree Backend directly

2007-03-31 Thread Cesar Rodas

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]


[sqlite] Sorting with latin1 characters

2007-03-31 Thread Alberto Simões

Hi

I am trying to sort results from a SELECT using ORDER BY. That column
includes latin1 characters, and SELECT returns the entries with
accented characters at the end of the list.

I am using DBD::SQLite, so I am not sure if I tested correctly the
change of environment variables to see if sqlite reacts to that
changes.

Thanks in advance for any help
Cheers
--
Alberto Simões

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