Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread P Kishor

On 4/3/07, Vivek Rajan <[EMAIL PROTECTED]> wrote:

Hello SQLite Community-

For a personal project, I need to dynamically create HTML pages from an
on-disk SQLite database. I don't need cross-network capability, I just need
the ability to query and dynamically generate HTML from an on-disk SQLite
database on a localhost (stand-alone unix machine). I am using PERL as the
API for accessing/querying SQLite.

Has someone done something like this? Could you please post any code
snippets, suggestions and/or pointers for how to do this?




as some others have pointed, your question is very vague and diffused.
Do you want to generate HTML from SQLite or do you want to have an
HTML application that is populated with data from SQLite? The latter
is more common.

The best way is to separate the presentation from the content. This is
easily done using some kind of templating language. Since you are
already familiar with Perl, I would suggest using CGI::Application
(see ) using the DBH plugin for SQLite,
which, of course, will require for you to have DBI and DBD::SQLite. In
fact, DBD::SQLite will automatically give you SQLite ready to go
out-of-the-box.

Google around for some standard Ajax code, or, I think there are even
some CGI::Application based Ajax plugins that you could use.

You could have your application ready and going in a few lines of
code. And, don't listen to anyone who points you to PHP when you
specifically ask for Perl ;-)


--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
-
collaborate, communicate, compete
=

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



Re: [sqlite] Novice help

2007-04-03 Thread Clark Christensen
Once you create a table, new.db will appear on disk in the default directory.

Have a look at SQLite Spy (http://www.yunqa.de/delphi/sqlitespy/) and SQLite 
Explorer (http://www.singular.gr/sqlite/).  Both are decent Windows GUI tools 
for SQLite.  Neither provides much of a UI for data entry, but both are good 
for showing the schema in a tree, and presenting a GUI windowed app for testing 
your SQL.

 -Clark


- Original Message 
From: Raju Penmetsa <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Tuesday, April 3, 2007 4:17:36 PM
Subject: [sqlite] Novice help

Hi,

I am completely new to SQlite. I have a faint idea of SQL from MS Access 
queries. I need to develop some crosstab queries on these huge databases (~14 
million records), which I am not able to, in MS Access.

I downloaded all the Windows binary files of SQlite on the download page of 
sqlite.org. I extracted all of them into separate folders. 
Now, when I open sqlite3.exe in a DOS window and type - "sqlite3 new.db", it 
should create a new db if there is none already existing, right?
It is not creating anything for me Or I am not able to find where it is 
creating one.

Any help on the quick start is highly appreciated.

Thanks

Raju

John Stanton <[EMAIL PROTECTED]> wrote: Vivek Rajan wrote:
> Thanks everyone. Appreciate your help. I am most proficient with PERL and
> was hoping to use PERL. PHP looks interesting.
> 
> John- How do you generate AJAX style dynamic HTML? Can you provide more
> info?
> 
Sure.  I wrote a compiler and a virtual machine for a simple language 
which incorporates basic control structures including procedure calls 
plus an interface to Sqlite such that it binds a callback which can be a 
procedure in HTML or Javascript or both to a row so that the callback 
fires each time a row is delivered.  The VM places the row data into 
local storagei each time the DBMS delivers it a row.

A very common usage of a callback procedure is to form a row in a table.

A special HTML tag is defined to make the embedded instructions look 
like HTML.  The compiler strips out these tags and creates a byte code 
executable format which makes the generation of output pages efficient.

The HTML/Javascript pages is compiled into a byte code format and upon 
execution its variables are dereferenced from the local data store and 
embedded in the generated HTML page.

There is also an RPC capability linked to the XMLHttpRequest Javascript 
object.  A request from the web page in the browser sends data in JSON 
format and that loads Javascript variables which can be displayed.  That 
implements AJAX by allowing a web page to behave dynamcially without the 
need to refresh.  The RPC processor can alternatively deliver its data 
in XML.

The RPC capability is designed to make the interaction between the web 
page and the server as transparent and simple as possible.  These is a 
repository of RPCs and these are accessed by name.

RPC calls can also INSERT and UPDATE rows in the DB.

The application server holds each instance of an Sqlite database open 
exclusively and serves all the threads using it from the one instance. 
Each user connection is a thread in the application server.  The DB can 
be on a different machine without problems because it is accessed 
exclusively and no locking glitches get in the way of secure processing. 
  Synchronization is supplied by rwlocks on the threads.

A graphics processor is built in to allow charts as an alternative to 
tables and the generated images are embedded in the generated pages.

Finally the design of the server is based on the principle that business 
rules etc will be defined as database functions, not embedded in the 
workflow level which generates and supports web pages.

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



 
-
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.



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



Re: [sqlite] Using the Sqlite Btree Backend directly

2007-04-03 Thread Raymond Hurst

I am an extreme newbie at this and I am open to suggestions:

My requirements are:
  Smallest footprint possible
  ACID requirements (transactional rollback a must)
  Be able to create tables with fields that have name/value pairs.
  Not sure what else!

If a dBase derivative meets these requirements I'm all for it and just 
need to be pointed in the right direction.

Ray

John Stanton wrote:
Why not implement a simple index file system like one of the DBase 
derivatives?  If you have no OS you will find porting something like 
Sqlite or Berkely DB a challenge.  If you are not looking for SQL then 
you can achieve your goal in maybe 20K of memory.


[EMAIL PROTECTED] wrote:

 P Kishor <[EMAIL PROTECTED]> wrote:

On 3/29/07, Ludvig Strigeus <[EMAIL PROTECTED]> wrote:


Hi,

I'm looking at using Sqlite as a storage backend for a program. 
Using SQL is
a little bit overkill and much more than we need. How complicated 
would it
be to interface to the btree subsystem directly? Sqlite seems very 
modular
from the looks of it, but has anyone attempted anything like this 
before?


The functionality I need is key->value maps with support for lookup 
by an

exact key, insertion, iteration of all keys in the database, removal.
Transactions would also preferably be needed.




why bother with SQLite then? Use the right tool for the job -- use 
BerkeleyDB.



--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
-
collaborate, communicate, compete
=

- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






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.



- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






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



[sqlite] Re: Novice help

2007-04-03 Thread Igor Tandetnik

Raju Penmetsa 
wrote:

I downloaded all the Windows binary files of SQlite on the download
page of sqlite.org. I extracted all of them into separate folders.
Now, when I open sqlite3.exe in a DOS window and type - "sqlite3
new.db", it should create a new db if there is none already existing,
right?
It is not creating anything for me Or I am not able to find where it
is creating one.


It delays actually creating the file until you create the first table. 
Run a valid CREATE TABLE statement.


Igor Tandetnik 



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



Re: [sqlite] Novice help

2007-04-03 Thread John Stanton

It will be created in your current working directory.

Raju Penmetsa wrote:

Hi,

I am completely new to SQlite. I have a faint idea of SQL from MS Access 
queries. I need to develop some crosstab queries on these huge databases (~14 
million records), which I am not able to, in MS Access.

I downloaded all the Windows binary files of SQlite on the download page of sqlite.org. I extracted all of them into separate folders. 
Now, when I open sqlite3.exe in a DOS window and type - "sqlite3 new.db", it should create a new db if there is none already existing, right?

It is not creating anything for me Or I am not able to find where it is 
creating one.

Any help on the quick start is highly appreciated.

Thanks

Raju

John Stanton <[EMAIL PROTECTED]> wrote: Vivek Rajan wrote:


Thanks everyone. Appreciate your help. I am most proficient with PERL and
was hoping to use PERL. PHP looks interesting.

John- How do you generate AJAX style dynamic HTML? Can you provide more
info?



Sure.  I wrote a compiler and a virtual machine for a simple language 
which incorporates basic control structures including procedure calls 
plus an interface to Sqlite such that it binds a callback which can be a 
procedure in HTML or Javascript or both to a row so that the callback 
fires each time a row is delivered.  The VM places the row data into 
local storagei each time the DBMS delivers it a row.


A very common usage of a callback procedure is to form a row in a table.

A special HTML tag is defined to make the embedded instructions look 
like HTML.  The compiler strips out these tags and creates a byte code 
executable format which makes the generation of output pages efficient.


The HTML/Javascript pages is compiled into a byte code format and upon 
execution its variables are dereferenced from the local data store and 
embedded in the generated HTML page.


There is also an RPC capability linked to the XMLHttpRequest Javascript 
object.  A request from the web page in the browser sends data in JSON 
format and that loads Javascript variables which can be displayed.  That 
implements AJAX by allowing a web page to behave dynamcially without the 
need to refresh.  The RPC processor can alternatively deliver its data 
in XML.


The RPC capability is designed to make the interaction between the web 
page and the server as transparent and simple as possible.  These is a 
repository of RPCs and these are accessed by name.


RPC calls can also INSERT and UPDATE rows in the DB.

The application server holds each instance of an Sqlite database open 
exclusively and serves all the threads using it from the one instance. 
Each user connection is a thread in the application server.  The DB can 
be on a different machine without problems because it is accessed 
exclusively and no locking glitches get in the way of secure processing. 
  Synchronization is supplied by rwlocks on the threads.


A graphics processor is built in to allow charts as an alternative to 
tables and the generated images are embedded in the generated pages.


Finally the design of the server is based on the principle that business 
rules etc will be defined as database functions, not embedded in the 
workflow level which generates and supports web pages.


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



 
-
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.



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



Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread Clark Christensen
Vivek,

You ask a very broad question.  I wouldn't know where to begin with code 
samples.  If you were to ask for some specific, "how do I do...?" questions, 
I'm sure you'd get some code examples.

You'll need to get the DBI modules installed, and the DBD-SQLite driver module 
installed into Perl.



What you describe is pretty basic variable manipulation, and file I/O with some 
DBI thrown-in for good measure.  IMO, Perl is very good at this kind of thing.  
You'll need some basic understanding of Perl references, too.

If you're not already familiar with the Perl DBI, you should read-up on it.  
You can start at http://search.cpan.org/~timb/ with the DBI-1.54 
(http://search.cpan.org/~timb/DBI-1.54/), where you'll find the module's docs.  
Also on the list page there is a link to "DBI Advanced Talk 2004" 
(http://search.cpan.org/src/TIMB/DBI_AdvancedTalk_2004/index.htm), a PowerPoint 
presentation where DBI's author talks about some best practices, how to get 
best performance, and how to detect and deal with errors.  It's been very 
useful for me.  I didn't quite follow it all in the beginning, but as I learn 
more, I return to it, from time to time, and it makes more sense.

 -Clark

- Original Message 
From: Vivek Rajan <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Tuesday, April 3, 2007 2:20:31 PM
Subject: Re: [sqlite] sqlite and generate dynamic html

I need to generate dynamic HTML from contents in the SQLite database.
Display some text/tables and related. Upon clicking on the web-page, the
web-page can generate another query and display subsequent queries as HTML
on the web.

On 4/3/07, John Stanton <[EMAIL PROTECTED]> wrote:
>
> What does the HTML have to do?
>
> Vivek Rajan wrote:
> > Hello SQLite Community-
> >
> > For a personal project, I need to dynamically create HTML pages from an
> > on-disk SQLite database. I don't need cross-network capability, I just
> need
> > the ability to query and dynamically generate HTML from an on-disk
> SQLite
> > database on a localhost (stand-alone unix machine). I am using PERL as
> the
> > API for accessing/querying SQLite.
> >
> > Has someone done something like this? Could you please post any code
> > snippets, suggestions and/or pointers for how to do this?
> >
> > Thanks in advance.
> >
> > Rajan
> >
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


-- 
Vivek Rajan
(503) 646-3985




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



[sqlite] Novice help

2007-04-03 Thread Raju Penmetsa
Hi,

I am completely new to SQlite. I have a faint idea of SQL from MS Access 
queries. I need to develop some crosstab queries on these huge databases (~14 
million records), which I am not able to, in MS Access.

I downloaded all the Windows binary files of SQlite on the download page of 
sqlite.org. I extracted all of them into separate folders. 
Now, when I open sqlite3.exe in a DOS window and type - "sqlite3 new.db", it 
should create a new db if there is none already existing, right?
It is not creating anything for me Or I am not able to find where it is 
creating one.

Any help on the quick start is highly appreciated.

Thanks

Raju

John Stanton <[EMAIL PROTECTED]> wrote: Vivek Rajan wrote:
> Thanks everyone. Appreciate your help. I am most proficient with PERL and
> was hoping to use PERL. PHP looks interesting.
> 
> John- How do you generate AJAX style dynamic HTML? Can you provide more
> info?
> 
Sure.  I wrote a compiler and a virtual machine for a simple language 
which incorporates basic control structures including procedure calls 
plus an interface to Sqlite such that it binds a callback which can be a 
procedure in HTML or Javascript or both to a row so that the callback 
fires each time a row is delivered.  The VM places the row data into 
local storagei each time the DBMS delivers it a row.

A very common usage of a callback procedure is to form a row in a table.

A special HTML tag is defined to make the embedded instructions look 
like HTML.  The compiler strips out these tags and creates a byte code 
executable format which makes the generation of output pages efficient.

The HTML/Javascript pages is compiled into a byte code format and upon 
execution its variables are dereferenced from the local data store and 
embedded in the generated HTML page.

There is also an RPC capability linked to the XMLHttpRequest Javascript 
object.  A request from the web page in the browser sends data in JSON 
format and that loads Javascript variables which can be displayed.  That 
implements AJAX by allowing a web page to behave dynamcially without the 
need to refresh.  The RPC processor can alternatively deliver its data 
in XML.

The RPC capability is designed to make the interaction between the web 
page and the server as transparent and simple as possible.  These is a 
repository of RPCs and these are accessed by name.

RPC calls can also INSERT and UPDATE rows in the DB.

The application server holds each instance of an Sqlite database open 
exclusively and serves all the threads using it from the one instance. 
Each user connection is a thread in the application server.  The DB can 
be on a different machine without problems because it is accessed 
exclusively and no locking glitches get in the way of secure processing. 
  Synchronization is supplied by rwlocks on the threads.

A graphics processor is built in to allow charts as an alternative to 
tables and the generated images are embedded in the generated pages.

Finally the design of the server is based on the principle that business 
rules etc will be defined as database functions, not embedded in the 
workflow level which generates and supports web pages.

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



 
-
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.

Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread John Stanton

Vivek Rajan wrote:

Thanks everyone. Appreciate your help. I am most proficient with PERL and
was hoping to use PERL. PHP looks interesting.

John- How do you generate AJAX style dynamic HTML? Can you provide more
info?

Sure.  I wrote a compiler and a virtual machine for a simple language 
which incorporates basic control structures including procedure calls 
plus an interface to Sqlite such that it binds a callback which can be a 
procedure in HTML or Javascript or both to a row so that the callback 
fires each time a row is delivered.  The VM places the row data into 
local storagei each time the DBMS delivers it a row.


A very common usage of a callback procedure is to form a row in a table.

A special HTML tag is defined to make the embedded instructions look 
like HTML.  The compiler strips out these tags and creates a byte code 
executable format which makes the generation of output pages efficient.


The HTML/Javascript pages is compiled into a byte code format and upon 
execution its variables are dereferenced from the local data store and 
embedded in the generated HTML page.


There is also an RPC capability linked to the XMLHttpRequest Javascript 
object.  A request from the web page in the browser sends data in JSON 
format and that loads Javascript variables which can be displayed.  That 
implements AJAX by allowing a web page to behave dynamcially without the 
need to refresh.  The RPC processor can alternatively deliver its data 
in XML.


The RPC capability is designed to make the interaction between the web 
page and the server as transparent and simple as possible.  These is a 
repository of RPCs and these are accessed by name.


RPC calls can also INSERT and UPDATE rows in the DB.

The application server holds each instance of an Sqlite database open 
exclusively and serves all the threads using it from the one instance. 
Each user connection is a thread in the application server.  The DB can 
be on a different machine without problems because it is accessed 
exclusively and no locking glitches get in the way of secure processing. 
 Synchronization is supplied by rwlocks on the threads.


A graphics processor is built in to allow charts as an alternative to 
tables and the generated images are embedded in the generated pages.


Finally the design of the server is based on the principle that business 
rules etc will be defined as database functions, not embedded in the 
workflow level which generates and supports web pages.


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



Re: [sqlite] exclusive2.test failures

2007-04-03 Thread Alexey Tourbin
On Tue, Apr 03, 2007 at 11:03:54PM +0700, Dan Kennedy wrote:
> > exclusive2-1.7...
> > Expected: [1]
> >  Got: [2]
> > exclusive2-1.9...
> > Expected: [1]
> >  Got: [0]
> > exclusive2-1.10... Ok
> > exclusive2-1.11... Ok
> > exclusive2-2.1... Ok
> > exclusive2-2.2... Ok
> > exclusive2-2.3... Ok
> > exclusive2-2.4... Ok
> > exclusive2-2.5...
> > Expected: [5]
> >  Got: [3]
> > exclusive2-2.6... Ok
> > exclusive2-2.7... Ok
> > exclusive2-2.8...
> > Expected: [1 {database disk image is malformed}]
> >  Got: [0 {64 ca9201f79a7fa971fb81ac2b382d71d2}]
> > exclusive2-3.0... Ok
> 
> Hi,
> 
> It could be that these are due to a defect in the test 
> script. I made some minor changes (added [flush] commands
> after file I/O) to the test script that is failing.
> 
> http://www.sqlite.org/cvstrac/getfile?f=sqlite/test/exclusive2.test&v=1.2
> 
> Could you help test this by downloading the new version
> of exclusive2.test from the above link, copying it
> over the old one (in the test/ directory of the source
> distribution) and re-running the "make test"? You don't
> need to do a make clean or rebuild or anything.

Nope, this does not help, but thank you anyway.  Maybe I'll try
to cope with this tomorrow, along with improving my tcl skills. :)


pgpTf3UN9dVBs.pgp
Description: PGP signature


Re: [sqlite] SQL help

2007-04-03 Thread Clark Christensen
Wow!  Thanks for pointing me back to Igor's example.  It is, as you say, very 
slick.  So slick, in fact, I missed it on first read, and assumed it wouldn't 
satisfy both requirements.  My humble apology to Igor :-))

I must admit, after reading the sum(is_complete) suggestion, it was like the 
coconut falling on my head - a big "DUH!" moment.  I still can't figure out why 
I didn't see it myself before asking.  That's the real value of a great 
community like this one.

 -Clark

- Original Message 
From: Dennis Cote <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Tuesday, April 3, 2007 3:07:44 PM
Subject: Re: [sqlite] SQL help

Clark Christensen wrote:
>
> Yeah, that's much cleaner.  Just once through the tech's module set instead 
> of twice, and it satisfies both requirements (at least some modules, and all 
> complete).
>
> Thanks again!
>
>   
Clark,

You are welcome. You should probably look at Igor's idea though.

It will eliminate the comparisons in your application code and return 
the allComplete value directly from the query. It's really very slick.

Dennis Cote

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





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



Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread Vivek Rajan

Thanks everyone. Appreciate your help. I am most proficient with PERL and
was hoping to use PERL. PHP looks interesting.

John- How do you generate AJAX style dynamic HTML? Can you provide more
info?



On 4/3/07, John Stanton <[EMAIL PROTECTED]> wrote:


You can use PHP to do that.

We are completing an application server which embeds Sqlite plus other
processors and both generates HTML and supports AJAX style dynamic HTML
by implementing remote procedure calls delivering JSON or XML
encapsulated data.  It is not quite ready yet but you can achieve a
similar result with PHP and some coding.

Vivek Rajan wrote:
> I need to generate dynamic HTML from contents in the SQLite database.
> Display some text/tables and related. Upon clicking on the web-page, the
> web-page can generate another query and display subsequent queries as
HTML
> on the web.
>
> On 4/3/07, John Stanton <[EMAIL PROTECTED]> wrote:
>
>>
>> What does the HTML have to do?
>>
>> Vivek Rajan wrote:
>> > Hello SQLite Community-
>> >
>> > For a personal project, I need to dynamically create HTML pages from
an
>> > on-disk SQLite database. I don't need cross-network capability, I
just
>> need
>> > the ability to query and dynamically generate HTML from an on-disk
>> SQLite
>> > database on a localhost (stand-alone unix machine). I am using PERL
as
>> the
>> > API for accessing/querying SQLite.
>> >
>> > Has someone done something like this? Could you please post any code
>> > snippets, suggestions and/or pointers for how to do this?
>> >
>> > Thanks in advance.
>> >
>> > Rajan
>> >
>>
>>
>>
>>
-
>>
>> To unsubscribe, send email to [EMAIL PROTECTED]
>>
>>
-
>>
>>
>>
>
>



-
To unsubscribe, send email to [EMAIL PROTECTED]

-





--
Vivek Rajan
(503) 646-3985


Re: [sqlite] SQL help

2007-04-03 Thread Dennis Cote

Ken wrote:

 sum(is_complete)  is  only the same as "where is_complete = 1"  when there is 
a check constraint guaranteeing that is complete will either be a 0 or 1.
 
  
Yes, that is true, and you could sum(is_complete != 0) if you want to be 
extra careful. This uses a C like definition of true as anything except 
zero.


I think its reasonable for an application to assume that a database 
field has a suitable value if it's the application that puts those 
values (i.e. 0 or 1 only for a boolean column) into the database.


Dennis Cote

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



Re: [sqlite] SQL help

2007-04-03 Thread Dennis Cote

Clark Christensen wrote:


Yeah, that's much cleaner.  Just once through the tech's module set instead of 
twice, and it satisfies both requirements (at least some modules, and all 
complete).

Thanks again!

  

Clark,

You are welcome. You should probably look at Igor's idea though.

It will eliminate the comparisons in your application code and return 
the allComplete value directly from the query. It's really very slick.


Dennis Cote

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



Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread John Stanton

You can use PHP to do that.

We are completing an application server which embeds Sqlite plus other 
processors and both generates HTML and supports AJAX style dynamic HTML 
by implementing remote procedure calls delivering JSON or XML 
encapsulated data.  It is not quite ready yet but you can achieve a 
similar result with PHP and some coding.


Vivek Rajan wrote:

I need to generate dynamic HTML from contents in the SQLite database.
Display some text/tables and related. Upon clicking on the web-page, the
web-page can generate another query and display subsequent queries as HTML
on the web.

On 4/3/07, John Stanton <[EMAIL PROTECTED]> wrote:



What does the HTML have to do?

Vivek Rajan wrote:
> Hello SQLite Community-
>
> For a personal project, I need to dynamically create HTML pages from an
> on-disk SQLite database. I don't need cross-network capability, I just
need
> the ability to query and dynamically generate HTML from an on-disk
SQLite
> database on a localhost (stand-alone unix machine). I am using PERL as
the
> API for accessing/querying SQLite.
>
> Has someone done something like this? Could you please post any code
> snippets, suggestions and/or pointers for how to do this?
>
> Thanks in advance.
>
> Rajan
>



- 


To unsubscribe, send email to [EMAIL PROTECTED]

- 










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



Re: [sqlite] SQL help

2007-04-03 Thread Clark Christensen
>You could try this:

>  select count(*) as mcount, sum(is_complete) as mcomplete
>  from tech_modules
>  where tech_id = ? and coll_id = ?;

Dennis,

Yeah, that's much cleaner.  Just once through the tech's module set instead of 
twice, and it satisfies both requirements (at least some modules, and all 
complete).

Thanks again!

 -Clark

- Original Message 
From: Dennis Cote <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Tuesday, April 3, 2007 12:27:54 PM
Subject: Re: [sqlite] SQL help

Clark Christensen wrote:
> I have a table, as described below, where I need to find out if the tech_id 
> in question has at least some modules in a particular collection (coll_id), 
> and they're all complete.
>
> At this point, I'm working with variations on:
>
> select
> (select count(*) from tech_modules
>  where tech_id = ? and coll_id = ?) as mcount,
> (select count(*) from tech_modules where tech_id = ? 
>  and coll_id = ? and is_complete = 1) as mcomplete;
>
> Performing the comparisons on mcount and mcomplete in the app ($mcount > 0 && 
> $mcomplete == $mcount) to get a boolean $allComplete.
>
> It performs OK (~50K rows in the table), using the unique index for both 
> subqueries, but the SQL seems crude.  Anybody have a more elegant solution to 
> share?
>
> Thanks!
>
>  -Clark
> 
> CREATE TABLE TECH_MODULES (
> TECH_ID integer,
> MODULE_ID integer,
> COLL_ID integer,
> IS_COMPLETE integer default 0,
> COMPLETION_TIME date,
> COMPLETION_TARGET date,
> DELETED integer
> );
>
> CREATE INDEX tech_modules_by_module_id ON TECH_MODULES (module_id);
>
> CREATE UNIQUE INDEX tech_modules_unique_module_id on TECH_MODULES (tech_id, 
> coll_id, module_id);
>
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>
>   
Clark,

You could try this:

  select count(*) as mcount, sum(is_complete) as mcomplete
  from tech_modules
  where tech_id = ? and coll_id = ?;

HTH
Dennis Cote

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





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



Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread Cesar Rodas

Take a look here http://www.php.net/sqlite

On 03/04/07, Vivek Rajan <[EMAIL PROTECTED]> wrote:


I need to generate dynamic HTML from contents in the SQLite database.
Display some text/tables and related. Upon clicking on the web-page, the
web-page can generate another query and display subsequent queries as HTML
on the web.

On 4/3/07, John Stanton <[EMAIL PROTECTED]> wrote:
>
> What does the HTML have to do?
>
> Vivek Rajan wrote:
> > Hello SQLite Community-
> >
> > For a personal project, I need to dynamically create HTML pages from
an
> > on-disk SQLite database. I don't need cross-network capability, I just
> need
> > the ability to query and dynamically generate HTML from an on-disk
> SQLite
> > database on a localhost (stand-alone unix machine). I am using PERL as
> the
> > API for accessing/querying SQLite.
> >
> > Has someone done something like this? Could you please post any code
> > snippets, suggestions and/or pointers for how to do this?
> >
> > Thanks in advance.
> >
> > Rajan
> >
>
>
>
>
-
> To unsubscribe, send email to [EMAIL PROTECTED]
>
>
-
>
>


--
Vivek Rajan
(503) 646-3985





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


Re: [sqlite] SQL help

2007-04-03 Thread Ken

 sum(is_complete)  is  only the same as "where is_complete = 1"  when there is 
a check constraint guaranteeing that is complete will either be a 0 or 1.
 
Dennis Cote <[EMAIL PROTECTED]> wrote: Clark Christensen wrote:
> I have a table, as described below, where I need to find out if the tech_id 
> in question has at least some modules in a particular collection (coll_id), 
> and they're all complete.
>
> At this point, I'm working with variations on:
>
> select
> (select count(*) from tech_modules
>  where tech_id = ? and coll_id = ?) as mcount,
> (select count(*) from tech_modules where tech_id = ? 
>  and coll_id = ? and is_complete = 1) as mcomplete;
>
> Performing the comparisons on mcount and mcomplete in the app ($mcount > 0 && 
> $mcomplete == $mcount) to get a boolean $allComplete.
>
> It performs OK (~50K rows in the table), using the unique index for both 
> subqueries, but the SQL seems crude. Anybody have a more elegant solution to 
> share?
>
> Thanks!
>
>  -Clark
> 
> CREATE TABLE TECH_MODULES (
> TECH_ID integer,
> MODULE_ID integer,
> COLL_ID integer,
> IS_COMPLETE integer default 0,
> COMPLETION_TIME date,
> COMPLETION_TARGET date,
> DELETED integer
> );
>
> CREATE INDEX tech_modules_by_module_id ON TECH_MODULES (module_id);
>
> CREATE UNIQUE INDEX tech_modules_unique_module_id on TECH_MODULES (tech_id, 
> coll_id, module_id);
>
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>
>   
Clark,

You could try this:

  select count(*) as mcount, sum(is_complete) as mcomplete
  from tech_modules
  where tech_id = ? and coll_id = ?;

HTH
Dennis Cote

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




Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread Vivek Rajan

I need to generate dynamic HTML from contents in the SQLite database.
Display some text/tables and related. Upon clicking on the web-page, the
web-page can generate another query and display subsequent queries as HTML
on the web.

On 4/3/07, John Stanton <[EMAIL PROTECTED]> wrote:


What does the HTML have to do?

Vivek Rajan wrote:
> Hello SQLite Community-
>
> For a personal project, I need to dynamically create HTML pages from an
> on-disk SQLite database. I don't need cross-network capability, I just
need
> the ability to query and dynamically generate HTML from an on-disk
SQLite
> database on a localhost (stand-alone unix machine). I am using PERL as
the
> API for accessing/querying SQLite.
>
> Has someone done something like this? Could you please post any code
> snippets, suggestions and/or pointers for how to do this?
>
> Thanks in advance.
>
> Rajan
>



-
To unsubscribe, send email to [EMAIL PROTECTED]

-





--
Vivek Rajan
(503) 646-3985


Re: [sqlite] Re: create or update question

2007-04-03 Thread Mark Richards

Eric S. Johansson wrote:


if the insert fails (i.e. record exists), it triggers an exception which 
I use to trigger an update. I get many more updates than inserts of 
course but I haven't figured out how to trigger an exception on update 
if the record doesn't exist.



From the FWIW dept, would an update be attempted if a record doesn't exist?

Perhaps test to see if the record exists first, then choose the 
applicable query?




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



[sqlite] Newbee Question

2007-04-03 Thread nshaw

I upgraded from 3.3.1.3 to 3.3.1.4.  Up till now, I've been experimenting
with SQLite3 via the CLP.  Now, I'm trying to access a DB via a C program
but I'm getting errors.  Here's a small code fragment:

#include 
#include 
#include "sqlite3.h"

int main (int argc, char **argv)
{
sqlite3 *db; /* from "the definitive guide to sqlite */

char *zErr;
int rc;
char *sql;

rc = sqlite3_open ("Family.db", &db);

return 0;
}

The error I get is (.text+0x16): undefined reference to 'sqlite3_open'.  

Any help will be greatly appreciated.
Thanks,

Nick.

-- 
View this message in context: 
http://www.nabble.com/Newbee-Question-tf3521982.html#a9825045
Sent from the SQLite mailing list archive at Nabble.com.


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



Re: [sqlite] Re: create or update question

2007-04-03 Thread Eric S. Johansson

Igor Tandetnik wrote:

Eric S. Johansson <[EMAIL PROTECTED]> wrote:

I'm trying to figure out how to do do the following:

if the record exists
  Update record with calculation ( a = a + v)
else
  insert record with default values

It seems like the "insert or replace into" capabilities is close to
what I need but I can't figure out how to update with a default on
the first record and update with a calculation on existing records.


I can't think of any way to avoid two requests. Run the update 
statement, use sqlite3_changes to check whether any row has actually 
been updated. If not, run the insert.


since I'm using pysqlite, I'm using the following model (which will 
probably make sql knowledgeable folks cringe)


---
insert_command = 'insert into test (x, y, z) values (?,?,?)'
update_command='update test set z = z + ? where (x=? and y=?)'
try:
   self.cursor.execute(insert_command, (ext_map, ID, 0.0))
except Exception, error:
   self.cursor.execute(update_command,(4.0, ext_map, ID,))
self.connection.commit()

---

if the insert fails (i.e. record exists), it triggers an exception which 
I use to trigger an update. I get many more updates than inserts of 
course but I haven't figured out how to trigger an exception on update 
if the record doesn't exist.


--
Speech-recognition in use.  It makes mistakes, I correct some.

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



Re: [sqlite] SQL help

2007-04-03 Thread Dennis Cote

Clark Christensen wrote:

I have a table, as described below, where I need to find out if the tech_id in 
question has at least some modules in a particular collection (coll_id), and 
they're all complete.

At this point, I'm working with variations on:

select
(select count(*) from tech_modules
 where tech_id = ? and coll_id = ?) as mcount,
(select count(*) from tech_modules where tech_id = ? 
 and coll_id = ? and is_complete = 1) as mcomplete;


Performing the comparisons on mcount and mcomplete in the app ($mcount > 0 && 
$mcomplete == $mcount) to get a boolean $allComplete.

It performs OK (~50K rows in the table), using the unique index for both 
subqueries, but the SQL seems crude.  Anybody have a more elegant solution to 
share?

Thanks!

 -Clark

CREATE TABLE TECH_MODULES (

TECH_ID integer,
MODULE_ID integer,
COLL_ID integer,
IS_COMPLETE integer default 0,
COMPLETION_TIME date,
COMPLETION_TARGET date,
DELETED integer
);

CREATE INDEX tech_modules_by_module_id ON TECH_MODULES (module_id);

CREATE UNIQUE INDEX tech_modules_unique_module_id on TECH_MODULES (tech_id, 
coll_id, module_id);




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


  

Clark,

You could try this:

 select count(*) as mcount, sum(is_complete) as mcomplete
 from tech_modules
 where tech_id = ? and coll_id = ?;

HTH
Dennis Cote

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



Re: [sqlite] SQL language issue, ticket #2282

2007-04-03 Thread Dennis Cote

[EMAIL PROTECTED] wrote:

Ticket #2282 against SQLite

   http://www.sqlite.org/cvstrac/tktview?tn=2282

complains that in an INSTEAD OF trigger on a view where
the trigger has a WHEN clause, if the WHEN clause is false
and the trigger does not fire, then the UPDATE statement
that provoked the trigger should fail.  I am skeptical
of this claim, but want the opinion of others before
I reject the ticket.

Is this really a bug?  What do INSTEAD OF triggers with
false WHEN clauses do on other SQL database engines?


  

Richard,

Instead of triggers are an extension to standard SQL. They do not appear 
in the SQL:1999 standard and are only mentioned in passing in the 
editors notes for SQL:2003.


They do seem to be a common extension, supported by Oracle, IBM, and 
Microsoft in addition to SQLite, but they are all done differently. 
PostgreSQL does not support the non standard INSTEAD OF triggers.


From Microsoft's SQL server documentation they don't support a when clause:

CREATE TRIGGER /trigger_name /
ON { /table/ | /view /}
[ WITH ENCRYPTION ]
{
{ {* *FOR | AFTER | INSTEAD OF } { [ INSERT ] [ *, *] [ UPDATE ] [ *, *] 
[ DELETE ] }

[ WITH APPEND ]
[ NOT FOR REPLICATION ]
AS
[ { IF UPDATE *( */column /*) *
[ { AND | OR } UPDATE *( */column /*) *]
[ .../n /]
| IF *(* COLUMNS_UPDATED *( ) *{ /bitwise_operator /} /updated_bitmask /*)*
{ /comparison_operator /} /column_bitmask/ [ .../n /]
} ]
/sql_statement/ [* *.../n /]
}
}

INSTEAD OF

Specifies that the trigger is executed /instead of/ the triggering SQL 
statement, thus overriding the actions of the triggering statements.


At most, one INSTEAD OF trigger per INSERT, UPDATE, or DELETE statement 
can be defined on a table or view. However, it is possible to define 
views on views where each view has its own INSTEAD OF trigger.


INSTEAD OF triggers are not allowed on updateable views WITH CHECK 
OPTION. SQL Server will raise an error if an INSTEAD OF trigger is added 
to an updateable view WITH CHECK OPTION specified. The user must remove 
that option using ALTER VIEW before defining the INSTEAD OF trigger.


{ [DELETE] [*,*] [INSERT] [*,*] [UPDATE] }

Are keywords that specify which data modification statements, when 
attempted against this table*/ /*or view, activate the trigger. At least 
one option must be specified. Any combination of these in any order is 
allowed in the trigger definition. If more than one option is specified, 
separate the options with commas.


For INSTEAD OF triggers, the DELETE option is not allowed on tables that 
have a referential relationship specifying a cascade action ON DELETE. 
Similarly, the UPDATE option is not allowed on tables that have a 
referential relationship specifying a cascade action ON UPDATE.




From mySQL documentation, they don't support a WHEN clause either:

CREATE
   [DEFINER = { /|user|/ | CURRENT_USER }]
   TRIGGER /|trigger_name|/ /|trigger_time|/ /|trigger_event|/
   ON /|tbl_name|/ FOR EACH ROW /|trigger_stmt|/

/|trigger_time|/ is the trigger action time. It can be |BEFORE| or 
|AFTER| to indicate that the trigger activates before or after the 
statement that activated it.


/|trigger_event|/ indicates the kind of statement that activates the 
trigger. The /|trigger_event|/ can be one of the following:


   *

 |INSERT|: The trigger is activated whenever a new row is inserted
 into the table; for example, through |INSERT|, |LOAD DATA|, and
 |REPLACE| statements.

   *

 |UPDATE|: The trigger is activated whenever a row is modified; for
 example, through |UPDATE| statements.

   *

 |DELETE|: The trigger is activated whenever a row is deleted from
 the table; for example, through |DELETE| and |REPLACE| statements.
 However, |DROP TABLE| and |TRUNCATE| statements on the table do
 /not/ activate this trigger, because they do not use |DELETE|. See
 Section 13.2.9, “|TRUNCATE| Syntax”
 .

It is important to understand that the /|trigger_event|/ does not 
represent a literal type of SQL statement that activates the trigger so 
much as it represents a type of table operation. For example, an 
|INSERT| trigger is activated by not only |INSERT| statements but also 
|LOAD DATA| statements because both statements insert rows into a table.


A potentially confusing example of this is the |INSERT INTO ... ON 
DUPLICATE KEY UPDATE ...| syntax: a |BEFORE INSERT| trigger will 
activate for every row, followed by either an |AFTER INSERT| trigger or 
both the |BEFORE UPDATE| and |AFTER UPDATE| triggers, depending on 
whether there was a duplicate key for the row.


There cannot be two triggers for a given table that have the same 
trigger action time and event. For example, you cannot have two |BEFORE 
UPDATE| triggers for a table. But you can have a |BEFORE UPDATE| and a 
|BEFORE INSERT| trigger, or a |BEFORE UPDATE| and an |AFTER UPDATE| trigger.



From the IBM DB2 documentation a WHEN clause is not allowed on an

[sqlite] Re: SQL help

2007-04-03 Thread Igor Tandetnik

Clark Christensen 
wrote:

I have a table, as described below, where I need to find out if the
tech_id in question has at least some modules in a particular
collection (coll_id), and they're all complete.


select coalesce(min(is_complete), 0) from tech_modules
where tech_id=? and coll_id=?;

This returns 0 if there's at least one record with is_complete=0 (min 
will select it), or if there are no matching records at all (min will 
produce NULL, coalesce will convert it to 0).


Igor Tandetnik 



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



Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread Cesar Rodas

PHP + SQLite... is the easiest way to develop something...

On 03/04/07, John Stanton <[EMAIL PROTECTED]> wrote:


What does the HTML have to do?

Vivek Rajan wrote:
> Hello SQLite Community-
>
> For a personal project, I need to dynamically create HTML pages from an
> on-disk SQLite database. I don't need cross-network capability, I just
need
> the ability to query and dynamically generate HTML from an on-disk
SQLite
> database on a localhost (stand-alone unix machine). I am using PERL as
the
> API for accessing/querying SQLite.
>
> Has someone done something like this? Could you please post any code
> snippets, suggestions and/or pointers for how to do this?
>
> Thanks in advance.
>
> Rajan
>



-
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]


Re: [sqlite] sqlite and generate dynamic html

2007-04-03 Thread John Stanton

What does the HTML have to do?

Vivek Rajan wrote:

Hello SQLite Community-

For a personal project, I need to dynamically create HTML pages from an
on-disk SQLite database. I don't need cross-network capability, I just need
the ability to query and dynamically generate HTML from an on-disk SQLite
database on a localhost (stand-alone unix machine). I am using PERL as the
API for accessing/querying SQLite.

Has someone done something like this? Could you please post any code
snippets, suggestions and/or pointers for how to do this?

Thanks in advance.

Rajan




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



[sqlite] SQL help

2007-04-03 Thread Clark Christensen
I have a table, as described below, where I need to find out if the tech_id in 
question has at least some modules in a particular collection (coll_id), and 
they're all complete.

At this point, I'm working with variations on:

select
(select count(*) from tech_modules
 where tech_id = ? and coll_id = ?) as mcount,
(select count(*) from tech_modules where tech_id = ? 
 and coll_id = ? and is_complete = 1) as mcomplete;

Performing the comparisons on mcount and mcomplete in the app ($mcount > 0 && 
$mcomplete == $mcount) to get a boolean $allComplete.

It performs OK (~50K rows in the table), using the unique index for both 
subqueries, but the SQL seems crude.  Anybody have a more elegant solution to 
share?

Thanks!

 -Clark

CREATE TABLE TECH_MODULES (
TECH_ID integer,
MODULE_ID integer,
COLL_ID integer,
IS_COMPLETE integer default 0,
COMPLETION_TIME date,
COMPLETION_TARGET date,
DELETED integer
);

CREATE INDEX tech_modules_by_module_id ON TECH_MODULES (module_id);

CREATE UNIQUE INDEX tech_modules_unique_module_id on TECH_MODULES (tech_id, 
coll_id, module_id);




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



Re: [sqlite] How can I change big-endian to little-endian in the database file

2007-04-03 Thread John Stanton
A very efficient way to re-arrange the byte ordering is to use a free 
union.  No function calls involved or tests.


Jakub Ladman wrote:

I think there is no need to change endianess.
Sqlite is shadowing out this and similar low level aspects.
If you need to get data from database and use it in something what needs it in 
other endianess, you may use something like this.


int change_endianess(unsigned char *data, int length)
{
unsigned char *buffer;
int i;
buffer = malloc(length);
for(i=0;i} 

For example, i have whole system with big endian, but only ferroelectric ram 
connected via i2c bus needs addresses in little endian, address is an 16bit 
number, so i must to swap the two bytes.


*((unsigned char *)&(buffer[0])) = addr >> 8;
*((unsigned char *)&(buffer[1])) = addr & 0xff;

If i understand it correctly, changing physical representation of data in the 
database conflicts with SQL and relational databases principle.


Jakub

Dne úterý 03 duben 2007 09:49 Martin Pfeifle napsal(a):


Dear all,
in an upcoming project, it is required to store all integer values as
little endian instead of big endian (don't ask why).
Nevertheless, I would like to use SQLite in that project.
What do we have to change in the sqlite library,
if we store the integers as little endian.
I came across some functions in B-tree.c and pager.c.

In B-tree.c
/* Read or write a two- and four-byte big-endian integer values.*/
get2byte,
get4byte,
put2byte,
put4byte
/* pager.c*/
** All values are stored on disk as big-endian.
*/
read32bits,
write32bits

Is that enough.
Another question, what do we have to change if we would
also store the utf-chars as little endian?
I appreciate your help.
Martin






___
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
http://mail.yahoo.de



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




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



Re: [sqlite] Index creation

2007-04-03 Thread John Stanton
There is an important element to bear in mind when using mmaping to take 
advanrage of physical memory.  The POSIX advisory file locks are not 
necessarily effective in that mode.


Joe Wilson wrote:

Sure, pre-caching is a hack - but a very effective one.

It has also been suggested to use MAP_POPULATE for mmap() and 
posix_fadvise() in Linux.


 http://www.mail-archive.com/monotone-devel@nongnu.org/msg03222.html

The general reaction against pre-caching (especially for tiny 100M 
databases) is amusing to me. Some programmers would rather wait 3 times 
longer for a database operation while the majority of the RAM in their 
machine goes unused. But if the OS did the same pre-cache thing behind 
their back without their knowledge - they would be good with that.


--- Scott Hess <[EMAIL PROTECTED]> wrote:


An interesting approach would be to use some sort of async I/O
facility to implement read-ahead.

Short of that, I have found that in some cases, on some operating
systems, implementing explicit read-ahead buffering for fts2 segment
merges improves performance when the disk caches are cold.  Linux
kernel 2.6 seems to get no benefit, 2.4 gets more.  This is somewhat
of a special case, though, as fts2 segment merges are merging streams
from different locations together, like an external sort.

-scott


On 3/26/07, Joe Wilson <[EMAIL PROTECTED]> wrote:


--- Joe Wilson <[EMAIL PROTECTED]> wrote:


improved dramatically. So I attempted the creation of the index off hours on
the production system, and after 4 hours no index.  I can't detect any
activity at all. The journal file and the .db file just sit at the same size
for 4 hours.  Why is this failing?  It seems like it is just sitting there
doing nothing.  When I created the test index, I noticed the journal file
changing and the .db file changing during the 2.5 hours to create.  On the
production .db file, nothing is happening.  I have all associated processes
killed that ineract with the db file, so I know it is not locked.


I assume that the copied "test" database was indexed immediately after its
creation. If this was the case then the entire file may have been in the OS
cache resulting in very quick indexing. Try running "wc prod.db" or
"cat prod.db >/dev/null" and then creating the indexes on prod.db to see
what happens.


The original poster confirmed that cat'ting the file to /dev/null reduced index
creation time to 2.5 hours on the original database file.

Could some optional heuristic be incorporated into SQLite's pager to do 
something
similar for such large transactions and/or queries?




 


Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

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




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



[sqlite] Default sqlite memory management policy

2007-04-03 Thread Rich Rattanni

All:
   I was wondering exactly how SQLite handles freeing memory used
from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?

   Will absolutely no memory be freed, or is there some default
memory management scheme used?

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



Re: [sqlite] -O3 compile w/ SQLite 3.3.14 (current cvs) Results

2007-04-03 Thread Kon Lovett

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Apr 3, 2007, at 9:14 AM, [EMAIL PROTECTED] wrote:


Kon Lovett <[EMAIL PROTECTED]> wrote:

Hi,

I recall a request for -O3 optimization results w/ the current  
source.


MacOS X 10.4.9
GCC 4.0.1 (Apple Extensions)
PowerPC G4 (32-bit)
Tcl 8.4

Configure: --enable-threadsafe --enable-cross-thread-connections --
enable-threads-override-locks --enable-tempstore



Can you try again without the "--enable-tempstore" and see what
happens?


0 errors out of 26431 tests

(So much for that option for me)


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


-- 
---

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




-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iEYEARECAAYFAkYSk3wACgkQJJNoeGe+5O7cAACghCc3DrQKjqAj/VEjbSqNyY2R
z1wAn0TBU8aEh5YSJXEYCGV1yR4FGrwW
=ZCc2
-END PGP SIGNATURE-

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



[sqlite] sqlite and generate dynamic html

2007-04-03 Thread Vivek Rajan

Hello SQLite Community-

For a personal project, I need to dynamically create HTML pages from an
on-disk SQLite database. I don't need cross-network capability, I just need
the ability to query and dynamically generate HTML from an on-disk SQLite
database on a localhost (stand-alone unix machine). I am using PERL as the
API for accessing/querying SQLite.

Has someone done something like this? Could you please post any code
snippets, suggestions and/or pointers for how to do this?

Thanks in advance.

Rajan


Re: [sqlite] SQL language issue, ticket #2282

2007-04-03 Thread Ken
Oracle does not allow a when clause on an instead of trigger.
 
when new.key=old.key
*
 ERROR at line 3:
 ORA-25004: WHEN clause is not allowed in INSTEAD OF triggers
 
 

[EMAIL PROTECTED] wrote: Ticket #2282 against SQLite

   http://www.sqlite.org/cvstrac/tktview?tn=2282

complains that in an INSTEAD OF trigger on a view where
the trigger has a WHEN clause, if the WHEN clause is false
and the trigger does not fire, then the UPDATE statement
that provoked the trigger should fail.  I am skeptical
of this claim, but want the opinion of others before
I reject the ticket.

Is this really a bug?  What do INSTEAD OF triggers with
false WHEN clauses do on other SQL database engines?

--
D. Richard Hipp  


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




RE: [sqlite] Version 3.3.14

2007-04-03 Thread Noah Hart
I found it, I was using an old sqlite3.def file for the exports.

Regards,

Noah 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 02, 2007 10:00 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Version 3.3.14

"Noah Hart" <[EMAIL PROTECTED]> wrote:
> Complies fine.
> 
> Linking shell.c I get the following errors
> 
> Error 326 error LNK2001: unresolved external symbol
> _sqlite3_io_trace shell.obj   
> Error 327 fatal error LNK1120: 1 unresolved externals
> F:\SQLite3\Projects\SQLite3C\bin\Debug\Sqlite3.exe
> 
> Any suggestions?
> 

Are you are using the latest code?  sqlite3_io_trace is an global symbol
in the core SQLite library that is not contained within #ifdef...#endif.
I do not see how it could not be defined.
--
D. Richard Hipp  <[EMAIL PROTECTED]>



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




CONFIDENTIALITY NOTICE: 
This message may contain confidential and/or privileged information. If you are 
not the addressee or authorized to receive this for the addressee, you must not 
use, copy, disclose, or take any action based on this message or any 
information herein. If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message. Thank you for 
your cooperation.




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



Re: [sqlite] exclusive2.test failures

2007-04-03 Thread Dan Kennedy

> exclusive2-1.7...
> Expected: [1]
>  Got: [2]
> exclusive2-1.9...
> Expected: [1]
>  Got: [0]
> exclusive2-1.10... Ok
> exclusive2-1.11... Ok
> exclusive2-2.1... Ok
> exclusive2-2.2... Ok
> exclusive2-2.3... Ok
> exclusive2-2.4... Ok
> exclusive2-2.5...
> Expected: [5]
>  Got: [3]
> exclusive2-2.6... Ok
> exclusive2-2.7... Ok
> exclusive2-2.8...
> Expected: [1 {database disk image is malformed}]
>  Got: [0 {64 ca9201f79a7fa971fb81ac2b382d71d2}]
> exclusive2-3.0... Ok

Hi,

It could be that these are due to a defect in the test 
script. I made some minor changes (added [flush] commands
after file I/O) to the test script that is failing.

http://www.sqlite.org/cvstrac/getfile?f=sqlite/test/exclusive2.test&v=1.2

Could you help test this by downloading the new version
of exclusive2.test from the above link, copying it
over the old one (in the test/ directory of the source
distribution) and re-running the "make test"? You don't
need to do a make clean or rebuild or anything.

Thanks very much.

Regards,
Dan.




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



Re: [sqlite] -O3 compile w/ SQLite 3.3.14 (current cvs) Results

2007-04-03 Thread drh
Kon Lovett <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I recall a request for -O3 optimization results w/ the current source.
> 
> MacOS X 10.4.9
> GCC 4.0.1 (Apple Extensions)
> PowerPC G4 (32-bit)
> Tcl 8.4
> 
> Configure: --enable-threadsafe --enable-cross-thread-connections -- 
> enable-threads-override-locks --enable-tempstore
> 

Can you try again without the "--enable-tempstore" and see what
happens?
--
D. Richard Hipp  <[EMAIL PROTECTED]>


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



RE: [sqlite] Difference in these indices?

2007-04-03 Thread McDermott, Andrew
Hi,
 
> > It might make sense to create a separate standalone utility program 
> > (like sqlite3_analyzer) that reuses some the sqlite  source 
> to do bulk 
> > inserts into a table in a database file as fast a possible with out 
> > having to worry about locking or journaling etc.
> 
> That would solve my problem too (thread: "CREATE INDEX 
> performance" on indexing a 5.8-million record table). I'd 
> love something like that!

Having such a utility would solve a lot of my problems regarding getting
data into the DB.  My current application does not allow access to the
data until the DB is populated so (in this case) I don't derive any
benefit from locking, journalling, etc.

Once the DB is populated I find SQLite to more than fast enough.

-- 
andy



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



[sqlite] -O3 compile w/ SQLite 3.3.14 (current cvs) Results

2007-04-03 Thread Kon Lovett

Hi,

I recall a request for -O3 optimization results w/ the current source.

MacOS X 10.4.9
GCC 4.0.1 (Apple Extensions)
PowerPC G4 (32-bit)
Tcl 8.4

Configure: --enable-threadsafe --enable-cross-thread-connections -- 
enable-threads-override-locks --enable-tempstore


Optimization Flags: -O3 -mcpu=7450 -mtune=7450
TCC += -DSQLITE_ENABLE_LOCKING_STYLE=1

conflict-6.2...
Expected: [0 {7 6 9} 1 1]
 Got: [0 {7 6 9} 1 0]
conflict-6.3...
Expected: [0 {6 7 3 9} 1 1]
 Got: [0 {6 7 3 9} 1 0]
conflict-6.7...
Expected: [0 {6 7 3 9} 1 1]
 Got: [0 {6 7 3 9} 1 0]
conflict-6.8...
Expected: [0 {7 6 9} 1 1]
 Got: [0 {7 6 9} 1 0]
conflict-6.9...
Expected: [0 {6 7 3 9} 1 1]
 Got: [0 {6 7 3 9} 1 0]
conflict-6.10...
Expected: [0 {7 6 9} 1 1]
 Got: [0 {7 6 9} 1 0]
conflict-6.11...
Expected: [0 {6 7 3 9} 1 1]
 Got: [0 {6 7 3 9} 1 0]
conflict-6.12...
Expected: [0 {6 7 3 9} 1 1]
 Got: [0 {6 7 3 9} 1 0]
conflict-6.13...
Expected: [0 {7 6 9} 1 1]
 Got: [0 {7 6 9} 1 0]

exclusive-1.0...
Expected: [normal normal exclusive]
 Got: [normal normal normal]
exclusive-1.2...
Expected: [exclusive exclusive exclusive]
 Got: [exclusive exclusive normal]
exclusive-1.4...
Expected: [normal normal exclusive]
 Got: [normal normal normal]
exclusive-1.6...
Expected: [normal normal exclusive]
 Got: [normal normal normal]
exclusive-1.8...
Expected: [normal exclusive exclusive]
 Got: [normal normal exclusive]
exclusive-1.12...
Expected: [normal exclusive normal normal]
 Got: [normal normal normal normal]
exclusive-1.13...
Expected: [normal exclusive normal normal normal]
 Got: [normal normal normal normal normal]

pragma-9.10...
Expected: [1 {no such table: temp_store_directory_test}]
 Got: [0 2]

Best Wishes,
Kon



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



Re: [sqlite] exclusive2.test failures

2007-04-03 Thread Alexey Tourbin
On Tue, Apr 03, 2007 at 01:52:30PM +, [EMAIL PROTECTED] wrote:
> Alexey Tourbin <[EMAIL PROTECTED]> wrote:
> > 
> > I have a few other modifications in which my sqlite3 snapshot differs
> > from that of cvs, which are
> > 1) debian patch for lemon,
> > 2) backward compatibility fix for nbytes==0 in sqlite3Prepare(),
> > 3) O_NOATIME flag in sqlite3CrashOpenExclusive() with delFlag==1
> > 4) SQLITE_TEMPNAME_SIZE=PATH_MAX in src/os.h
> > 5) --version-script=libsqlite3.map for libsqlite3.la
> > 6) default path for sqlite3UnixDlopen()
> > 
> 
> Can you post a complete set of diffs between your code and
> that which is in CVS?

Sure, here is (almost) complete diff.  The exact command which
I used to generatate the diff is

diff -urpN -b 
--exclude={.git,CVS,aclocal.m4,configure,config.{guess,sub},ltmain.sh} 
--ignore-matching-lines={'\$Id\>','\$Revision\>','\$Header\>'} sqlite3.checkout 
sqlite3

which excludes SCM and autoconf-generated stuff.  Here the 'sqlite3'
directory is my working tree, and 'sqlite3.checkout' is fresh plain
cvs checkout which I have just made (also to verify that git-cvsimport
is reliable).

(The diff is attached.)


sqlite3-3.3.14-alt1.diff.gz
Description: GNU Zip compressed data


pgpgQCHyqseGt.pgp
Description: PGP signature


[sqlite] Insertion failed because database is full.

2007-04-03 Thread Joel Cochran

Hi all,

I have searched the web, the newsgroups, and the archives, but all I can
find is one reference to someone having this trouble with Python and a bunch
of references that list this as predefined error #13
according to http://www.sqlite.org/capi3.html.

What I can't find is any help in determining why a program might receive
this error.  The database is only 203KB and has 6 tables (maybe 1,000 rows
in all the tables combined) running off a 1GB CompactFlash card on a Windows
Mobile 5 device with 256MB of onboard RAM: 50MB of that is dedicated to
programs and the rest is storage.  The only app running on the device is the
one in question.  The error occurs at seemingly random times and forces the
user to end the application and start over.

At this point I don't know much else: the user is in the field and I will
have the device back late this afternoon for debugging.  I was hoping to
have a head start before I get the device, because as it is I have no idea
what the cause could be.

Any thoughts would be greatly appreciated.

Thanks,

--
Joel Cochran


Re: [sqlite] Version 3.3.14

2007-04-03 Thread Gunnar Roth

[EMAIL PROTECTED] schrieb:

Gunnar Roth <[EMAIL PROTECTED]> wrote:
  

[EMAIL PROTECTED] schrieb:


SQLite version 3.3.14 is now available on the SQLite website
 We have also added 
the concept of "exclusive access mode".  In exclusive access 
mode, SQLite holds onto locks until you close the connection
  
  
I should maybe made clear that this new behaviour influences not only 
per process concurrency but also thread concurrency.





To make it really clear, when you set

   PRAGMA locking_mode=EXCLUSIVE;

You get no concurrency at all.  The one database connection
that holds the lock has exclusive access and no other database
connections are allowed to read or write to the database in
the meantime.

This is either a good thing or a bad thing, depending on your
needs.  Traditional RDBMS thinking is that this is a bad thing.
But SQLite is not used in traditional ways and so for many
uses of SQLite, locking down the database is a good thing.
For example:

In monotone, when syncing two to repositories (each repository
is an SQLite database in monotone) they want to break the sync
up into multiple transactions.  But they do not want another
process to slip in and modify the database during the brief
instant after committing one transaction and beginning the next.
They can now accomplish this by setting exclusive access mode.

Programs that use SQLite as an appliation file format (ex:
Adobe Lightroom) often cache active parts of the database
file in internal data structures.  They do not want other
processes slipping in and modifying the on-disk database
out from under them.  By going to exclusive access mode they
can prevent this.

A lot of users wrap the core SQLite library into a database
server.  Various threads or processes have to send messages
to the server and the server interacts with SQLite.  In this
case, there is only one connection to the database, so it
makes sense to put SQLite in exclusive access mode. 


Related to the last point:  As far as I am aware, SQLite is
the *only* SQL database engine in existance that allows two
or more independent processes to open and interact with the
same database file at the same time.  In every other SQL
database engine, there is a single server process that always
has exclusive access to the data and all clients must go through
that server.  Even other "embedded" databases such as 
MySQL-embedded, Firebird-embedded, and CloudScape, work by

setting up a separate server thread and funnelling all
disk traffic through that server thread, I am told.  So
to look at it another way, all other SQL database engines in
the world are locked down into exclusive access mode.  Only
SQLite has the ability for separate databases to talk to
the disk file independently of one another.  The "exclusive 
access mode" in SQLite is just giving SQLite the ability to 
turn this unique feature off in cases where it is not needed.



  

Thank you for you reply.
I just had made the fault to think it would be only exclusive to process.
but after setting it in my app, the main thread ( which is only reading) 
blocked all write accesses of the update thread.
so what i have learned is that if your apllication does access a sqlite 
db from more than one thread, one cannot use
the exclusive mode. i wonder if aperture does only access its db from 
one thread.


regards,
gunnar



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



Re: [sqlite] Version 3.3.14

2007-04-03 Thread drh
Gunnar Roth <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] schrieb:
> > SQLite version 3.3.14 is now available on the SQLite website
> >  We have also added 
> > the concept of "exclusive access mode".  In exclusive access 
> > mode, SQLite holds onto locks until you close the connection
> >   
> I should maybe made clear that this new behaviour influences not only 
> per process concurrency but also thread concurrency.
> 

To make it really clear, when you set

   PRAGMA locking_mode=EXCLUSIVE;

You get no concurrency at all.  The one database connection
that holds the lock has exclusive access and no other database
connections are allowed to read or write to the database in
the meantime.

This is either a good thing or a bad thing, depending on your
needs.  Traditional RDBMS thinking is that this is a bad thing.
But SQLite is not used in traditional ways and so for many
uses of SQLite, locking down the database is a good thing.
For example:

In monotone, when syncing two to repositories (each repository
is an SQLite database in monotone) they want to break the sync
up into multiple transactions.  But they do not want another
process to slip in and modify the database during the brief
instant after committing one transaction and beginning the next.
They can now accomplish this by setting exclusive access mode.

Programs that use SQLite as an appliation file format (ex:
Adobe Lightroom) often cache active parts of the database
file in internal data structures.  They do not want other
processes slipping in and modifying the on-disk database
out from under them.  By going to exclusive access mode they
can prevent this.

A lot of users wrap the core SQLite library into a database
server.  Various threads or processes have to send messages
to the server and the server interacts with SQLite.  In this
case, there is only one connection to the database, so it
makes sense to put SQLite in exclusive access mode. 

Related to the last point:  As far as I am aware, SQLite is
the *only* SQL database engine in existance that allows two
or more independent processes to open and interact with the
same database file at the same time.  In every other SQL
database engine, there is a single server process that always
has exclusive access to the data and all clients must go through
that server.  Even other "embedded" databases such as 
MySQL-embedded, Firebird-embedded, and CloudScape, work by
setting up a separate server thread and funnelling all
disk traffic through that server thread, I am told.  So
to look at it another way, all other SQL database engines in
the world are locked down into exclusive access mode.  Only
SQLite has the ability for separate databases to talk to
the disk file independently of one another.  The "exclusive 
access mode" in SQLite is just giving SQLite the ability to 
turn this unique feature off in cases where it is not needed.

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



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



Re: [sqlite] Version 3.3.14

2007-04-03 Thread Gunnar Roth

[EMAIL PROTECTED] schrieb:

SQLite version 3.3.14 is now available on the SQLite website
 We have also added 
the concept of "exclusive access mode".  In exclusive access 
mode, SQLite holds onto locks until you close the connection
  
I should maybe made clear that this new behaviour influences not only 
per process concurrency but also thread concurrency.


regards,
gunnar


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



Re: [sqlite] exclusive2.test failures

2007-04-03 Thread drh
Alexey Tourbin <[EMAIL PROTECTED]> wrote:
> 
> I have a few other modifications in which my sqlite3 snapshot differs
> from that of cvs, which are
> 1) debian patch for lemon,
> 2) backward compatibility fix for nbytes==0 in sqlite3Prepare(),
> 3) O_NOATIME flag in sqlite3CrashOpenExclusive() with delFlag==1
> 4) SQLITE_TEMPNAME_SIZE=PATH_MAX in src/os.h
> 5) --version-script=libsqlite3.map for libsqlite3.la
> 6) default path for sqlite3UnixDlopen()
> 

Can you post a complete set of diffs between your code and
that which is in CVS?

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


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



[sqlite] Re: create or update question

2007-04-03 Thread Igor Tandetnik

Eric S. Johansson <[EMAIL PROTECTED]> wrote:

I'm trying to figure out how to do do the following:

if the record exists
  Update record with calculation ( a = a + v)
else
  insert record with default values

It seems like the "insert or replace into" capabilities is close to
what I need but I can't figure out how to update with a default on
the first record and update with a calculation on existing records.


I can't think of any way to avoid two requests. Run the update 
statement, use sqlite3_changes to check whether any row has actually 
been updated. If not, run the insert.


Igor Tandetnik 



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



[sqlite] create or update question

2007-04-03 Thread Eric S. Johansson

I'm trying to figure out how to do do the following:

if the record exists
  Update record with calculation ( a = a + v)
else
  insert record with default values

It seems like the "insert or replace into" capabilities is close to what 
I need but I can't figure out how to update with a default on the first 
record and update with a calculation on existing records.


Seems like this should be a very common idiom but I can't find any notes 
on how to do it.


--- eric

--
Speech-recognition in use.  It makes mistakes, I correct some.

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



Re: [sqlite] exclusive2.test failures

2007-04-03 Thread Alexey Tourbin
On Tue, Apr 03, 2007 at 12:20:27PM +, [EMAIL PROTECTED] wrote:
> Some tests fail *for you*.  Other people report that everything
> is working fine, and indeed, we do not have any test failures

Sure.  The implied question was whether the test failures are easily
reproducible, and if they are, then I'm done (in sense of useful
feedback).  However, if they are not, this could very well be my own
fault, or something.

> on our Linux machines.  Can you help us to figure out what you
> are doing differently so that we can reproduce and diagnose your
> problem?
> 
> *  What processor?
> *  32 or 64 bit?
> *  What version of Tcl?
> *  How did you run the test?
> *  How did you build SQLite?

I build sqlite3 rpm packages for both i586 and x86_64, and
exclusive2.test fails on both of them.  Tcl version is 8.4.13.
I use autoreconf and ./configure.

To run the tests, I use "make test" with a few minor modifications
(for some reason, I link testfixture with static libsqlite3.a library).

I build sqlite3 with disabled -DSQLITE_OMIT_LOAD_EXTENSION=1 (i.e.
extension loading IS enabled), but I can't see offhand how it could
affect exclusive2.test.

I have a few other modifications in which my sqlite3 snapshot differs
from that of cvs, which are
1) debian patch for lemon,
2) backward compatibility fix for nbytes==0 in sqlite3Prepare(),
3) O_NOATIME flag in sqlite3CrashOpenExclusive() with delFlag==1
4) SQLITE_TEMPNAME_SIZE=PATH_MAX in src/os.h
5) --version-script=libsqlite3.map for libsqlite3.la
6) default path for sqlite3UnixDlopen()

Anyway my effort is available for revision here:
http://git.altlinux.org/people/at/packages/?p=sqlite3.git;a=summary
No, I don't mean you have to review that, maybe it just can be
interesting for someone who build rpm packages.


pgpfytED990sU.pgp
Description: PGP signature


Re: [sqlite] exclusive2.test failures

2007-04-03 Thread drh
Alexey Tourbin <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> With most recent sqlite3 cvs snapshot, some exclusive2 tests fail:
> 

Some tests fail *for you*.  Other people report that everything
is working fine, and indeed, we do not have any test failures
on our Linux machines.  Can you help us to figure out what you
are doing differently so that we can reproduce and diagnose your
problem?

*  What processor?
*  32 or 64 bit?
*  What version of Tcl?
*  How did you run the test?
*  How did you build SQLite?

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


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



[sqlite] exclusive2.test failures

2007-04-03 Thread Alexey Tourbin
Hello,

With most recent sqlite3 cvs snapshot, some exclusive2 tests fail:

$ ./testfixture test/exclusive2.test
exclusive2-1.0... Ok
exclusive2-1.1... Ok
exclusive2-1.2... Ok
exclusive2-1.3... Ok
exclusive2-1.4... Ok
exclusive2-1.5... Ok
exclusive2-1.6... Ok
exclusive2-1.7...
Expected: [1]
 Got: [2]
exclusive2-1.9...
Expected: [1]
 Got: [0]
exclusive2-1.10... Ok
exclusive2-1.11... Ok
exclusive2-2.1... Ok
exclusive2-2.2... Ok
exclusive2-2.3... Ok
exclusive2-2.4... Ok
exclusive2-2.5...
Expected: [5]
 Got: [3]
exclusive2-2.6... Ok
exclusive2-2.7... Ok
exclusive2-2.8...
Expected: [1 {database disk image is malformed}]
 Got: [0 {64 ca9201f79a7fa971fb81ac2b382d71d2}]
exclusive2-3.0... Ok
exclusive2-3.1... Ok
exclusive2-3.2... Ok
exclusive2-3.3... Ok
exclusive2-3.4... Ok
exclusive2-3.5... Ok
exclusive2-3.6... Ok
Thread-specific data deallocated properly
4 errors out of 27 tests
Failures on these tests: exclusive2-1.7 exclusive2-1.9 exclusive2-2.5 
exclusive2-2.8
$

linux-2.6.18 glibc-2.5


pgpY48fqOLt1p.pgp
Description: PGP signature


Re: [sqlite] How to reserve a specific size(for example 400k) when I create a database file?

2007-04-03 Thread drh
"Zhang Cheng-E7104C" <[EMAIL PROTECTED]> wrote:
> I want to reserve a  specific size for every database when it is
> created.
> Is that possible?
> 

This will only work if you do NOT enable auto-vacuum.  To
repeat: auto-vacuum must be switched off.

When you create the database, create a table and start inserting
bogus data into that table:

CREATE TABLE t1(x);
INSERT INTO t1 VALUES(randomblob(900));

Repeat the INSERT until your database is the desired size.
Then do:

DROP TABLE t1;

The size of the database file will not decrease.  But the disk
space formerly allocated to the T1 table will become available
for reuse.

You can use this technique to create a database template on
a workstation then transfer the template database over to your
embedded device, if you want.

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


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



[sqlite] How to reserve a specific size(for example 400k) when I create a database file?

2007-04-03 Thread Zhang Cheng-E7104C
I want to reserve a  specific size for every database when it is
created.
Is that possible?

 Thanks

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



Re: [sqlite] How can I change big-endian to little-endian in the database file

2007-04-03 Thread Jakub Ladman
I think there is no need to change endianess.
Sqlite is shadowing out this and similar low level aspects.
If you need to get data from database and use it in something what needs it in 
other endianess, you may use something like this.

int change_endianess(unsigned char *data, int length)
{
unsigned char *buffer;
int i;
buffer = malloc(length);
for(i=0;i> 8;
*((unsigned char *)&(buffer[1])) = addr & 0xff;

If i understand it correctly, changing physical representation of data in the 
database conflicts with SQL and relational databases principle.

Jakub

Dne úterý 03 duben 2007 09:49 Martin Pfeifle napsal(a):
> Dear all,
> in an upcoming project, it is required to store all integer values as
> little endian instead of big endian (don't ask why).
> Nevertheless, I would like to use SQLite in that project.
> What do we have to change in the sqlite library,
> if we store the integers as little endian.
> I came across some functions in B-tree.c and pager.c.
>
> In B-tree.c
> /* Read or write a two- and four-byte big-endian integer values.*/
> get2byte,
> get4byte,
> put2byte,
> put4byte
> /* pager.c*/
> ** All values are stored on disk as big-endian.
> */
> read32bits,
> write32bits
>
> Is that enough.
> Another question, what do we have to change if we would
> also store the utf-chars as little endian?
> I appreciate your help.
> Martin
>
>
>
>
>
>
> ___
> Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
> http://mail.yahoo.de

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



Re: [sqlite] How can I change big-endian to little-endian in the database file

2007-04-03 Thread drh
Martin Pfeifle <[EMAIL PROTECTED]> wrote:
> 
> in an upcoming project, it is required to store all 
> integer values as little endian instead of big endian...

Does that mean you are not allowed to use TCP/IP which
stores everything big-endian?  ;-)

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


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



Re: [sqlite] How can I change big-endian to little-endian in the database file

2007-04-03 Thread drh
Martin Pfeifle <[EMAIL PROTECTED]> wrote:
> Dear all,
> in an upcoming project, it is required to store all integer 
> values as little endian instead of big endian (don't ask why).
> Nevertheless, I would like to use SQLite in that project.
> What do we have to change in the sqlite library, 
> if we store the integers as little endian.
> I came across some functions in B-tree.c and pager.c.
> 
> In B-tree.c
> /* Read or write a two- and four-byte big-endian integer values.*/
> get2byte,
> get4byte,
> put2byte,
> put4byte 
> /* pager.c*/
> ** All values are stored on disk as big-endian.
> */
> read32bits,
> write32bits
>  
> Is that enough.

I think so.  Big-endian numbers have the nice property that
memcmp() compares positive integers in numerical order.  I
don't think we are using that property anywhere, but I might
be mistaken.  So if you do come up with a little-endian version
of SQLite, you will want to test it very carefully.

> Another question, what do we have to change if we would
> also store the utf-chars as little endian?

PRAGMA encoding=utf-16le;

The "le" at the end is the important part.

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


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



[sqlite] How can I change big-endian to little-endian in the database file

2007-04-03 Thread Martin Pfeifle
Dear all,
in an upcoming project, it is required to store all integer values as little 
endian
instead of big endian (don't ask why).
Nevertheless, I would like to use SQLite in that project.
What do we have to change in the sqlite library, 
if we store the integers as little endian.
I came across some functions in B-tree.c and pager.c.

In B-tree.c
/* Read or write a two- and four-byte big-endian integer values.*/
get2byte,
get4byte,
put2byte,
put4byte 
/* pager.c*/
** All values are stored on disk as big-endian.
*/
read32bits,
write32bits
 
Is that enough.
Another question, what do we have to change if we would
also store the utf-chars as little endian?
I appreciate your help.
Martin






___ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: 
http://mail.yahoo.de