Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread Christian Werner
jima wrote:
> 
> Hi,
> 
> I build **without** -DSQLITE_OMIT_LOAD_EXTENSION
> 
> I do ldd on sqlite3 and I get
> 
> libdl.so.2 => /lib/libdl.so.2 (0x00402000)
> 
> but I cannot load my Extension.so
> 
> Do Extension.c has to include sqlite3.h ?
> Presently I am only including sqlite3ext.h.

Including sqlite3ext.h is sufficient since it includes sqlite3.h.
As DRH wrote in an earlier posting it is essential to place the magic
macros in your extension source (SQLITE_EXTENSION_INIT1 outside of
any function, and SQLITE_EXTENSION_INIT2 at the beginnig of your
extension initialization function).

> If I have used --enable-thread at sqlite makefile configure time...can this
> cause an impact?

I don't think so; you linked your sqlite3 shell with -lpthread already,
right ? You can prove this with "ldd sqlite3"

HTH,
Christian

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



Re: [sqlite] Compiling PHP5 in order to use SQLite3

2006-09-15 Thread Lloyd Thomas
I far as i know you compile with php5-pdo-sqlite, but this was only tested 
on debian. Last time i looked this supports sqlite 3.2.8 and you have to use 
php's pdo functions and not the sqlite functions which only work with v2.


- Original Message - 
From: "Michael Young" <[EMAIL PROTECTED]>

To: 
Sent: Friday, September 15, 2006 10:42 PM
Subject: [sqlite] Compiling PHP5 in order to use SQLite3



I'm not a Unix programmer, but I would like to compile PHP5 so that
it will be able to read/write SQLite3 files on my Mac.

In particular, I have tried to follow the installation script
suggested at www.phpmac.com for Apache 2.2.2 and PHP 5.1.4. However,
this only results in a compilation that recognizes SQLite2 files.

If anyone can offer advice on compiling on Mac OS Tiger, I would be
most appreciative. Thanks in advance.

Here's the script (modified in bold from the one suggested at
www.phpmac.com) I have been using without success:

./configure --prefix=/apache2/php --with-zlib --enable-pdo=shared -- 
with-pdo-sqlite=shared --with-sqlite=shared --with-xml --with-ldap=/
usr --enable-cli --with-zlib-dir=/usr --enable-exif --enable-ftp -- 
enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-

iodbc=/usr --with-curl=/usr --with-apxs2=/apache2/bin/apxs

Regards,
Mike







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



Re: [sqlite] Concurrency with writer and read-only processes

2006-09-15 Thread Gerry Snyder

Liam Healy wrote:

I have a database that has one writer which runs once a day, and
potentially many readers running whenever someone wants some
information.  I am trying to understand concurrency in sqlite3 so that
I can have the writer run each day, regardless of whether a reader is
already running or a reader starts up after the writer is running.
The best you can do is make a copy of the database just before you want 
to run the writer, make the updates, and then switch the readers to the 
new file.


Using attach could make this simpler, and it could fly if the file can 
fit in RAM. Something like open a memory database, attach the real one, 
copy its contents to memory, do the updates, and in one transaction copy 
back. Or, since the writer runs just once a day, just keep an extra copy 
and update that.


There are various possibilities, but if you really really need the 
concurrency you talk about, SQLite is probably not for you.


HTH,

Gerry


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



Re: [sqlite] Concurrency with writer and read-only processes

2006-09-15 Thread Cory Nelson

SQLite databases are protected like a big reader-writer lock: there is
no way read while you are writing.  "BEGIN IMMEDIATE" simply changes
when it takes the write lock, and won't affect this.

On 9/15/06, Liam Healy <[EMAIL PROTECTED]> wrote:

I have a database that has one writer which runs once a day, and
potentially many readers running whenever someone wants some
information.  I am trying to understand concurrency in sqlite3 so that
I can have the writer run each day, regardless of whether a reader is
already running or a reader starts up after the writer is running.  I
am referring to the documentation
http://www.sqlite.org/lang_transaction.html and
http://sqlite.org/lockingv3.html but I can't quite figure out how to
do this.

I understand from lang_transaction that if the writer starts with
BEGIN IMMEDIATE
and ends with
END
then it will be possible for readers to read the database while the
writer is updating it: "After a BEGIN IMMEDIATE, you are guaranteed
that no other thread or process will be able to write to the database
or do a BEGIN IMMEDIATE or BEGIN EXCLUSIVE. Other processes can
continue to read from the database, however."
Yet when I try to start up the reader and open the database while the
writer is running, I get SQLITE_BUSY.

Any advice on how to have the reader and writer work without
interfering with each other (the reader is only trying to read old
data, not what the writer is inserting) would be appreciated.

Thank you.

Liam

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





--
Cory Nelson
http://www.int64.org

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



Re: [sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-15 Thread Kevin Stewart
Well, its a little more complicated than that. I don't want the whole 
table, just the set of records that matched the initial search criteria 
in the select. But thanks for your response. I did a little redesigning 
of the database schema and the way my code handles things and I came up 
with a better solution anyway. Maybe I shouldn't have jumped the gun and 
submitted this questionhowever I am still curious. Generally 
speaking, can one access the database inside the callback from select 
via sqlite_exec()?


Kevin

Jay Sprenkle wrote:

that's the hard way:
open db1
attach db2
insert into db2.destinationTable  select * from db1.sourceTable

done


On 9/15/06, Kevin Stewart <[EMAIL PROTECTED]> wrote:

I need to move some records from one database (and table) to another.
The tables are identical. My idea was to 'select' all records that match
my search criteria and in the callback that is called from sqlite_exec()
I can add them to the other table in the other database. This way I
don't need to save the records away or anything like thatjust sort
of a direct copy. After the select completes I can then execute a
'DELETE' on the same set of records using the same search criteria.

Thanks in advance for any help.

Kevin

- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 









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



Re: [sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-15 Thread Jay Sprenkle

that's the hard way:
open db1
attach db2
insert into db2.destinationTable  select * from db1.sourceTable

done


On 9/15/06, Kevin Stewart <[EMAIL PROTECTED]> wrote:

I need to move some records from one database (and table) to another.
The tables are identical. My idea was to 'select' all records that match
my search criteria and in the callback that is called from sqlite_exec()
I can add them to the other table in the other database. This way I
don't need to save the records away or anything like thatjust sort
of a direct copy. After the select completes I can then execute a
'DELETE' on the same set of records using the same search criteria.

Thanks in advance for any help.

Kevin

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





--
--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

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



[sqlite] Compiling PHP5 in order to use SQLite3

2006-09-15 Thread Michael Young
I'm not a Unix programmer, but I would like to compile PHP5 so that  
it will be able to read/write SQLite3 files on my Mac.


In particular, I have tried to follow the installation script  
suggested at www.phpmac.com for Apache 2.2.2 and PHP 5.1.4. However,  
this only results in a compilation that recognizes SQLite2 files.


If anyone can offer advice on compiling on Mac OS Tiger, I would be  
most appreciative. Thanks in advance.


Here's the script (modified in bold from the one suggested at  
www.phpmac.com) I have been using without success:


./configure --prefix=/apache2/php --with-zlib --enable-pdo=shared -- 
with-pdo-sqlite=shared --with-sqlite=shared --with-xml --with-ldap=/ 
usr --enable-cli --with-zlib-dir=/usr --enable-exif --enable-ftp -- 
enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with- 
iodbc=/usr --with-curl=/usr --with-apxs2=/apache2/bin/apxs


Regards,
Mike





[sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-15 Thread Kevin Stewart
I need to move some records from one database (and table) to another. 
The tables are identical. My idea was to 'select' all records that match 
my search criteria and in the callback that is called from sqlite_exec() 
I can add them to the other table in the other database. This way I 
don't need to save the records away or anything like thatjust sort 
of a direct copy. After the select completes I can then execute a 
'DELETE' on the same set of records using the same search criteria.


Thanks in advance for any help.

Kevin

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



Re: [sqlite] how sqlite works?

2006-09-15 Thread Cesar David Rodas Maldonado

I meen, If SQLite has two index and very large Index (about 10.000.000 each
one) how do i merge it, I mean (index1 = index2 for every one and limit it
in thousand).

Understand?


On 9/15/06, Dennis Cote <[EMAIL PROTECTED]> wrote:


Cesar David Rodas Maldonado wrote:
> If there a document of how SQLite Virtual Machine Works ( papers )? I
> would
> like do something similar with B-Tree, B+ Tree but i dont know how to
> merge
> a select with tow Index? Understand my question??
>
> Please answer me
>
see the links VDBE Tutorial and VDBE Opcodes near he bottom of the
documentation page http://www.sqlite.org/docs.html

Dennis Cote


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] how sqlite works?

2006-09-15 Thread Dennis Cote

Cesar David Rodas Maldonado wrote:
If there a document of how SQLite Virtual Machine Works ( papers )? I 
would
like do something similar with B-Tree, B+ Tree but i dont know how to 
merge

a select with tow Index? Understand my question??

Please answer me

see the links VDBE Tutorial and VDBE Opcodes near he bottom of the 
documentation page http://www.sqlite.org/docs.html


Dennis Cote

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



[sqlite] how sqlite works?

2006-09-15 Thread Cesar David Rodas Maldonado

If there a document of how SQLite Virtual Machine Works ( papers )? I would
like do something similar with B-Tree, B+ Tree but i dont know how to merge
a select with tow Index? Understand my question??

Please answer me


Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread jima

Hi,

I build **without** -DSQLITE_OMIT_LOAD_EXTENSION

I do ldd on sqlite3 and I get

libdl.so.2 => /lib/libdl.so.2 (0x00402000)

but I cannot load my Extension.so

Do Extension.c has to include sqlite3.h ?
Presently I am only including sqlite3ext.h.

If I have used --enable-thread at sqlite makefile configure time...can this
cause an impact?

jima



2006/9/15, Christian Werner <[EMAIL PROTECTED]>:


jima wrote:
>
> Thanks for the advice but it would not work either. I just tried with
the
> flags you mentioned at compile time and full path when loading.
>
> Do you know if I have to enclose that full path in quotes or something
at
> load time? like...
>
> ..load '/path/Extension.so'
>
> ?
>
> I tried several combinations of quotes but no luck here.
>
> I will recheck all what I have been doing just to make sure there is not
an
> easy explanation for this...

Did you rebuild your sqlite3 shell without -DSQLITE_OMIT_LOAD_EXTENSION
and does an ldd on sqlite3 indicate that has libdl.so linked, e.g.

$ ldd ./sqlite3
...
libdl.so.2 => /lib/libdl.so.2 (0x00402000)
...

Then that sqlite3 shell command should do what you want:

$ ./sqlite3
...
sqlite> load './Extension.so'

HTH,
Christian


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread Christian Werner
jima wrote:
> 
> Thanks for the advice but it would not work either. I just tried with the
> flags you mentioned at compile time and full path when loading.
> 
> Do you know if I have to enclose that full path in quotes or something at
> load time? like...
> 
> ..load '/path/Extension.so'
> 
> ?
> 
> I tried several combinations of quotes but no luck here.
> 
> I will recheck all what I have been doing just to make sure there is not an
> easy explanation for this...

Did you rebuild your sqlite3 shell without -DSQLITE_OMIT_LOAD_EXTENSION
and does an ldd on sqlite3 indicate that has libdl.so linked, e.g.

 $ ldd ./sqlite3
 ...
 libdl.so.2 => /lib/libdl.so.2 (0x00402000)
 ...

Then that sqlite3 shell command should do what you want:

 $ ./sqlite3
 ...
 sqlite> load './Extension.so'

HTH,
Christian

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



Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread jima

Better still, I have tried with full text search extension and I was able to
load it.

I will re-check my code. It is the most clear suspect now.

jima

2006/9/15, jima <[EMAIL PROTECTED]>:


I have them both...I read the wiki page before trying this myself. I will
try with the exact code that it is contained at the page.

Thanks for the hint.

jima


2006/9/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

> jima <[EMAIL PROTECTED]> wrote:
> >
> > unable to open shared library [Extension.so]
> >
> > Any clues of what is going on?
> >
>
> Did you base your implementation of Extension.c off of the
> example C code contained in the wiki?
>
>http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions
>
> The magic macros SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2
> really are necessary for everything to work right.  Did you,
> prehaps, omit one or both?
>
> --
> D. Richard Hipp   <[EMAIL PROTECTED]>
>
>
> -
>
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>



Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread jima

I have them both...I read the wiki page before trying this myself. I will
try with the exact code that it is contained at the page.

Thanks for the hint.

jima


2006/9/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:


jima <[EMAIL PROTECTED]> wrote:
>
> unable to open shared library [Extension.so]
>
> Any clues of what is going on?
>

Did you base your implementation of Extension.c off of the
example C code contained in the wiki?

   http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions

The magic macros SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2
really are necessary for everything to work right.  Did you,
prehaps, omit one or both?

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



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread drh
jima <[EMAIL PROTECTED]> wrote:
> 
> unable to open shared library [Extension.so]
> 
> Any clues of what is going on?
> 

Did you base your implementation of Extension.c off of the
example C code contained in the wiki?

   http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions

The magic macros SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2
really are necessary for everything to work right.  Did you,
prehaps, omit one or both?

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


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



Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread jima

Thanks for the advice but it would not work either. I just tried with the
flags you mentioned at compile time and full path when loading.

Do you know if I have to enclose that full path in quotes or something at
load time? like...

.load '/path/Extension.so'

?

I tried several combinations of quotes but no luck here.

I will recheck all what I have been doing just to make sure there is not an
easy explanation for this...

Thanks again,

jima

2006/9/15, Christian Werner <[EMAIL PROTECTED]>:


jima wrote:

> ...
> And then I go, no problems building. I have sqlite built with this
> feature I guess.
>
> But the thing is that I cannot make it to work. I prepared a c file
> following the template given in the wiki. I generated a .so using:
>
> gcc -I/path_to_sqlite-3.3.7/src -c -o Extension.o Extension.c

Add the compiler switch -fPIC here.

> And
>
> gcc -shared -o Extension.so Extension.o/path_to_libsqlite3.so/libsqlite3.so

Omit libsqlite3.so here, there's no need for it in the extension.

> ...
> When I do in sqlite3 prompt:
>
> ..load Extension.so

Use the full path to Extension.so or prefix it with ./

Hope that helps,
Christian


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread Christian Werner
jima wrote:

> ...
> And then I go, no problems building. I have sqlite built with this
> feature I guess.
> 
> But the thing is that I cannot make it to work. I prepared a c file
> following the template given in the wiki. I generated a .so using:
> 
> gcc -I/path_to_sqlite-3.3.7/src -c -o Extension.o Extension.c

Add the compiler switch -fPIC here.

> And
> 
> gcc -shared -o Extension.so Extension.o /path_to_libsqlite3.so/libsqlite3.so

Omit libsqlite3.so here, there's no need for it in the extension.

> ...
> When I do in sqlite3 prompt:
> 
> ..load Extension.so

Use the full path to Extension.so or prefix it with ./

Hope that helps,
Christian

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



[sqlite] Problem using loadable extension mechanism.

2006-09-15 Thread jima

Hi all,

I hope this is now the right place to tell this story after being
redirected to this list by drh. I first submitted this as a ticket
(sorry about that).

I am building sqlite from sources in a debian sarge box.

I am interested in Loadable Extensions.

I had to introduce into the Makefile the following lines to enable the
loadable extension mechanism:

TCC += -DHAVE_DLOPEN

and

TLIBS += /usr/lib/libdl.so

And then I go, no problems building. I have sqlite built with this
feature I guess.

But the thing is that I cannot make it to work. I prepared a c file
following the template given in the wiki. I generated a .so using:

gcc -I/path_to_sqlite-3.3.7/src -c -o Extension.o Extension.c

And

gcc -shared -o Extension.so Extension.o /path_to_libsqlite3.so/libsqlite3.so

I linked with this warning:

/usr/bin/ld: Warning: size of symbol 'sqlite3_api' changed from 4 to
460 in /path_to_libsqlite3.so/libsqlite3.so

But it produced the .so that I wanted.

When I do in sqlite3 prompt:

.load Extension.so

It goes:

unable to open shared library [Extension.so]

Any clues of what is going on?

Perhaps a sample gcc invokation line for building the extension would
also be a good thing in the docs.

Thank you very much.

jima

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



Re: [sqlite] Re: Re: Re: Which API to use to get resultant of query

2006-09-15 Thread Dennis Cote

Fred Williams wrote:


Just a suggestion.  When I am learning a new language, database, etc.  I
sometimes find working with and even stepping through supplied samples
prove to be the quickest way to gain insight into how the new entity
works.  Saves both me and a lot of other people a lot of time and
effort.

  
That sounds a lot like RTFM only presented in a much more pleasant 
manner. :-)


Anyway, it is good advice, and I second it.

Dennis Cote

P.S. I also think the quickstart page at the SQLite website should 
probably be enhanced to show a basic version of a query using the 
sqlite3_prepare/sqlite3_step/sqlite3_column_* APIs. This is a common 
question for people starting to use sqlite now, and the quickstart page 
only shows how to use the older depreciated (at least for queries) 
sqlite3_exec API.


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



Re: [sqlite] to retreive OID

2006-09-15 Thread Dennis Cote

Roger Binns wrote:


Alternately, you may want to consider the simpler sqlite3_exec api 


Roger,

The sqlite3_exec interface may seem simpler than the sqlite_prepare et 
al API at first glance, but it really isn't for queries. Yes you make 
fewer calls to sqlite functions, but you have to define a callback 
function to handles the results. Moreover, the results are all presented 
to your application as strings, so you have to convert any non string 
values to the required type, but no type information is available to the 
callback function.


The following code shows how to read the oid values into a vector using 
the sqlite3_prepare family of calls, but skips the error checking for 
clarity.


   vector oids;
   sqlite3_stmt *s;

   int rc = sqlite3_prepare(db, "select OID from tablename", -1, , NULL);

   while ((rc = sqlite3_step(s)) == SQLITE_ROW) {
   int oid = sqlite3_column_int(s, 0);
   oids.push_back(oid);
   }

   rc = sqlite3_finalize(s)

It really isn't any more complicated than the sqlite3_exec version, and 
many would find it easier to understand.


   vector oids;

   static int callback(void *user_data, int argc, char **argv, char 
**azColName)

   {
   int oid = atoi(argv[0]);
   ((vector*)user_data)->push_back(oid);
   }

   sqlite3_exec(db, "select OID from tablename", callback, , NULL);

The sqlite3_prepare interface avoids unnecessary string conversions, and 
has more potential for optimization by reusing previously prepared 
queries. It also allows the user to modify some parts of a prepared 
query using bound variables rather than recompiling the entire SQL query 
from scratch. I thinks its usually worth the time it takes to learn how 
to use it.


Dennis Cote

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



Re: [sqlite] Error: database is locked on _all_ sqlite tables

2006-09-15 Thread Jay Johnston

NFS.  The same test works fine in /tmp, which is apparently local.  I'll
report the problem to the host.  Thanks for the help.

On 9/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


"Jay Johnston" <[EMAIL PROTECTED]> wrote:
> Yes, the directory is writable.  No, there is no journal file -- this
> happens even when creating a new database.
>
> 
> [barranca]$ whoami
> jpj
> [barranca]$ ls -dl ./
> drwxr-x--x  38 jpj pg547368 4096 2006-09-15 09:25 ./
> [barranca]$ echo "create table foo(x varchar(12));" | ~/src/sqlite3-
> 3.3.7.bin test.db
> SQL error: database is locked
> 
>

I've seen this happen on NFS filesystems with busted posix
locking support.  Is it a local disk or an NFS mount?
--
D. Richard Hipp   <[EMAIL PROTECTED]>



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread Noel Frankinet

sandhya a écrit :

You mean there is no need for me to take care of this function calls ..Its
just enough having definition there.
But by doing that i am not getting any kind of output ie my OID.

  


No you should write the callback and do whatever you want with the 
passed data.

You the pass the call_back name to the relevant sqlite function.
sqlite will call it for every row selected by your query.



- Original Message - 
From: "Noel Frankinet" <[EMAIL PROTECTED]>

To: 
Sent: Friday, September 15, 2006 8:02 PM
Subject: Re: [sqlite] Which API to use to get resultant of query


  

sandhya a écrit :


Thanks  a lot for your response
Actually there is one function call in some sample found like,

static int callback(void *NotUsed, int argc, char **argv, char
  

**azColName)
  

{
  int i;
  for(i=0; i

To: 
Sent: Friday, September 15, 2006 7:38 PM
Subject: Re: [sqlite] Which API to use to get resultant of query



  

On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:



sprintf(szQuery,"select oid from %s where filename =

  

'%s'",sampletbl,test.htm);

  

there's an example program here:
http://sqlite.org/quickstart.html
and a more involved one here
http://www.reddawn.net/~jsprenkl/Sqlite

--
--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com



-
  

-
  

---

  

To unsubscribe, send email to [EMAIL PROTECTED]


-
  

-
  

---




  

--


---
  

To unsubscribe, send email to [EMAIL PROTECTED]
  

--


---
  



  

--
Noël Frankinet
Gistek Software SA
http://www.gistek.net


--


---
  

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


---
  




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



  



--
Noël Frankinet
Gistek Software SA
http://www.gistek.net


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



Re: [sqlite] Error: database is locked on _all_ sqlite tables

2006-09-15 Thread Jay Johnston

Yes, the directory is writable.  No, there is no journal file -- this
happens even when creating a new database.


[barranca]$ whoami
jpj
[barranca]$ ls -dl ./
drwxr-x--x  38 jpj pg547368 4096 2006-09-15 09:25 ./
[barranca]$ echo "create table foo(x varchar(12));" | ~/src/sqlite3-
3.3.7.bin test.db
SQL error: database is locked


On 9/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


"Jay Johnston" <[EMAIL PROTECTED]> wrote:
> Yes, I can open the file created on the server on my laptop.  No, I
haven't
> changed anything on the server that would have caused this.  Even when I
run
> the static binary from sqlite.org I receive the same error, so it
doesn't
> seem to be a library issue.
>

Is that journal file with the database?  Is the journal
file readable?  Is the directory that contains the database
writable?
--
D. Richard Hipp   <[EMAIL PROTECTED]>



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




RE: [sqlite] Re: Re: Re: Which API to use to get resultant of query

2006-09-15 Thread Fred Williams


> -Original Message-
> From: Igor Tandetnik [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 15, 2006 10:27 AM
> To: SQLite
> Subject: [sqlite] Re: Re: Re: Which API to use to get
> resultant of query
>
>
> sandhya <[EMAIL PROTECTED]> wrote:
> > But where as when i am executing the same from command prompt it is
> > showing
> > the OID alone.
> > Why it is showing DONE when i am doing it through program?Anything
> > wrong?
>
> Check your condition. Make sure it's the same as the one you use in
> console. Most likely, you've simply misspelled the string in
> the sprintf
> call and it cannot be found in the table.
>
> As a sanity check, drop the condition and see if you can get
> anything at
> all with a simple query like "select oid from tablename;"
>
> Igor Tandetnik
>

Just a suggestion.  When I am learning a new language, database, etc.  I
sometimes find working with and even stepping through supplied samples
prove to be the quickest way to gain insight into how the new entity
works.  Saves both me and a lot of other people a lot of time and
effort.

Fred


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



[sqlite] Re: Re: Re: Which API to use to get resultant of query

2006-09-15 Thread Igor Tandetnik

sandhya <[EMAIL PROTECTED]> wrote:

But where as when i am executing the same from command prompt it is
showing
the OID alone.
Why it is showing DONE when i am doing it through program?Anything
wrong?


Check your condition. Make sure it's the same as the one you use in 
console. Most likely, you've simply misspelled the string in the sprintf 
call and it cannot be found in the table.


As a sanity check, drop the condition and see if you can get anything at 
all with a simple query like "select oid from tablename;"


Igor Tandetnik 



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



Re: [sqlite] Re: Re: Which API to use to get resultant of query

2006-09-15 Thread sandhya
yaI got now...
But where as when i am executing the same from command prompt it is showing
the OID alone.
Why it is showing DONE when i am doing it through program?Anything wrong?
Whether i should do in some other way?
please help me

-Sandhya

- Original Message - 
From: "Igor Tandetnik" <[EMAIL PROTECTED]>
To: "SQLite" 
Sent: Friday, September 15, 2006 8:27 PM
Subject: [sqlite] Re: Re: Which API to use to get resultant of query


> sandhya <[EMAIL PROTECTED]> wrote:
> > Ya now i am getting error code which says SQLITE_DONE
>
> It's not an error. It's a success code meaning that you've reached the
> end of resultset. If you get that on the very first call to
> sqlite3_step, it means your resultset is empty - there are no rows
> matching your condition.
>
> When sqlite3_step successfully retrieves a row from resultset, it
> returns SQLITE_ROW. At this point, use sqlite3_column_* calls to
> retrieve individual fields from this row. E.g.
>
> int oid = sqlite3_column_int(pStmt, 0);
>
> Igor Tandetnik
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing

2006-09-15 Thread xin.ye
Hi,

Dennis,thank you very much for your advice. You are right. I do make some 
stupid mistake when I wrap the realloc() function for my os-less platform.

But now a new problem has emerged.

sqlite3_exec(db, "create table myt(age smallint)", NULL, NULL, NULL);

during the parser parsing the above line, it generates the some statement like 
this:
UPDATE 'main'.sqlite_master xxx
but when sqlite3Parser() begins to parse .sqlite_master, it generates an error 
like "near .s syntax error..."
when I trace into parse.c, I find that the variable 'yyact' behaves weird. 

So, is it possible that this problem is also caused by the memory alllcator I 
wrapped? How can I set breakpoint to catch this bug?

Thanks in advance.

Sarah



>Sarah wrote:
>> I'm facing new problems right now. the record cann't be inserted correctly 
>> when I execute the following statements. 
>> ..
>> char * database = ":memory:";
>>  sqlite3 * db;
>>   sqlite3_open(database, );
>>   sqlite3_exec(db, "create table myt(name varchar(30),age smallint)", NULL, 
>> NULL, NULL);
>>   sqlite3_exec(db, "insert into myt values('sarah',27)", NULL, NULL, NULL);
>>   sqlite3_exec(db, "select * from myt", NULL, NULL, NULL);
>>   sqlite3_close(db);
>> ..
>>
>> The behavior is that , when executing "insert into myt values('sarah',27)",  
>> the program goes into the following statements in sqlite3RunParser() and 
>> returns 
>> SQLITE_NOMEM. How and why? 
>> ..
>> abort_parse:
>>   if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){
>> if( lastTokenParsed!=TK_SEMI ){
>>   sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
>>   pParse->zTail = [i];
>> }
>> sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
>>   }
>>   sqlite3ParserFree(pEngine, sqlite3FreeX);
>>   if( sqlite3MallocFailed() ){
>> pParse->rc = SQLITE_NOMEM;
>>   }
>> ..
>>
>> I totally have no idea of the principals of parser and how it works. Could 
>> someone tell me or give me some links?
>>
>> finally, a stupid question:
>> should I add a semicolon at the end of the sql statement in sqlite3_exec(); 
>> Will that affect the execution of parser?
>>
>>   
>Sarah,
>
>First adding a semicolon at the end of your SQL statements will make no 
>difference.
>
>What happened was that sqlite ran out of memory at some point while 
>parsing your SQL. The sqlite3MallocFailed call simply checks if sqlite's 
>internal malloc has ever failed to get the requested memory.  Since this 
>is a very simple SQL statement, the memory requirements for parsing 
>should be quite low. I would suspect a problem with your memory 
>allocator which is being called by sqlite through the standard malloc 
>API. You should be able to see where this is happening by setting a 
>breakpoint on sqlite3FailedMalloc in util.c and looking back through the 
>call stack.
>
>HTH
>Dennis Cote
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>
>

Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread sandhya
I got but the return type of all API's  is int..So where the result will get
stored and how can i get..Please don't get fed up with the same question
again and again
i am not getting how to ask this?
i used
sqlite_exec() i don't know where the result stored and how to get it.
I also used the following here also i am getting SQLITE_OK but where the
result i am not getting

sqlite3_prepare(db,szQuery, -1 , , 0);

errcode = sqlite3_step(pStmt);

Now where my result will be .Please do needful.I am very thankful to
you

-Sandhya





- Original Message - 
From: "Jay Sprenkle" <[EMAIL PROTECTED]>
To: 
Sent: Friday, September 15, 2006 8:10 PM
Subject: Re: [sqlite] Which API to use to get resultant of query


> On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:
> > Actually my query is returing only one data ie OID of the fileIn
this
> > case what i can do to get that data.Where it will get stored?
>
> look at the documentation for sqlite_bind():
> http://sqlite.org/capi3ref.html#sqlite3_bind_text
> It explains how to send parameters to a query
>
> to get the results:
> http://sqlite.org/capi3ref.html#sqlite3_column_int
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: [sqlite] Error: database is locked on _all_ sqlite tables

2006-09-15 Thread Jay Johnston

Yes, I can open the file created on the server on my laptop.  No, I haven't
changed anything on the server that would have caused this.  Even when I run
the static binary from sqlite.org I receive the same error, so it doesn't
seem to be a library issue.

On 9/15/06, Jay Sprenkle <[EMAIL PROTECTED]> wrote:


On 9/15/06, Jay Johnston <[EMAIL PROTECTED]> wrote:
> No trac.db in the results of lsof.  Also, no processes owned by me in
> /proc/locks.

can you open the file created on the server on your laptop?
if you're dynamically linking it may be loading the wrong shared libs.
Have you installed anything on the server that might put new sqlite
libs in place?


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




[sqlite] Re: Re: Which API to use to get resultant of query

2006-09-15 Thread Igor Tandetnik

sandhya <[EMAIL PROTECTED]> wrote:

Ya now i am getting error code which says SQLITE_DONE


It's not an error. It's a success code meaning that you've reached the 
end of resultset. If you get that on the very first call to 
sqlite3_step, it means your resultset is empty - there are no rows 
matching your condition.


When sqlite3_step successfully retrieves a row from resultset, it 
returns SQLITE_ROW. At this point, use sqlite3_column_* calls to 
retrieve individual fields from this row. E.g.


int oid = sqlite3_column_int(pStmt, 0);

Igor Tandetnik 



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



RE: [sqlite] Re: Which API to use to get resultant of query

2006-09-15 Thread Richard Stern
> Ya now i am getting error code which says SQLITE_DONE...so how can get my
> resultant now?
> Which API i should use?Please tell me

After running prepare, you can get the data like this:

//This while loop will step through every row one by one
while (sqlite3_step(pStmt) == SQLITE_ROW)
{
//This will store the data from the first column in the row
char* cData = (const char*)sqlite3_column_text(pStmt, 0);

//to get data from additional columns, just specify which one in
that//last value, like so:
char* cData2 = (const char*)sqlite3_column_text(pStmt, 1);
}

//Don't forget to call this when you're done:
sqlite3_finalize(pStmt);

---
Hope that helps

Richard



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



Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread sandhya
You mean there is no need for me to take care of this function calls ..Its
just enough having definition there.
But by doing that i am not getting any kind of output ie my OID.




- Original Message - 
From: "Noel Frankinet" <[EMAIL PROTECTED]>
To: 
Sent: Friday, September 15, 2006 8:02 PM
Subject: Re: [sqlite] Which API to use to get resultant of query


> sandhya a écrit :
> > Thanks  a lot for your response
> > Actually there is one function call in some sample found like,
> >
> > static int callback(void *NotUsed, int argc, char **argv, char
**azColName)
> > {
> >   int i;
> >   for(i=0; i > printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
> >   }
> >   printf("\n");
> >   return 0;
> > }
> >
>
> you don't call that callback , its called by sqlite...
> In your case argc will be 1, argv[0] will contains the oid and
> azColNames[0] will be "oid"
>
> > I reffered Shell.c also where in they also has the same function,If i am
not
> > passing my arguments through command prompt...
> > What i should pass as 2 and 3 arguments in the above function call ie
argc
> > and argv.Is there any API which directly gives the result.
> > Actually my query is returing only one data ie OID of the fileIn
this
> > case what i can do to get that data.Where it will get stored?
> > Please help me...in doing this
> >
> > Thank you
> > Sandhya
> > - Original Message - 
> > From: "Jay Sprenkle" <[EMAIL PROTECTED]>
> > To: 
> > Sent: Friday, September 15, 2006 7:38 PM
> > Subject: Re: [sqlite] Which API to use to get resultant of query
> >
> >
> >
> >> On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:
> >>
> >>> sprintf(szQuery,"select oid from %s where filename =
> >>>
> > '%s'",sampletbl,test.htm);
> >
> >> there's an example program here:
> >> http://sqlite.org/quickstart.html
> >> and a more involved one here
> >> http://www.reddawn.net/~jsprenkl/Sqlite
> >>
> >> -- 
> >> --
> >> SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
> >> http://www.reddawn.net/~jsprenkl/Sqlite
> >>
> >> Cthulhu Bucks!
> >> http://www.cthulhubucks.com
> >>
>
>> -
-
> >>
> > ---
> >
> >> To unsubscribe, send email to [EMAIL PROTECTED]
>
>> -
-
> >>
> > ---
> >
> >
> >
> >
>
> --
---
> > To unsubscribe, send email to [EMAIL PROTECTED]
>
> --
---
> >
> >
> >
> >
>
>
> -- 
> Noël Frankinet
> Gistek Software SA
> http://www.gistek.net
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: [sqlite] Error: database is locked on _all_ sqlite tables

2006-09-15 Thread Jay Sprenkle

On 9/15/06, Jay Johnston <[EMAIL PROTECTED]> wrote:

No trac.db in the results of lsof.  Also, no processes owned by me in
/proc/locks.


can you open the file created on the server on your laptop?
if you're dynamically linking it may be loading the wrong shared libs.
Have you installed anything on the server that might put new sqlite
libs in place?

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



Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread Jay Sprenkle

On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:

Actually my query is returing only one data ie OID of the fileIn this
case what i can do to get that data.Where it will get stored?


look at the documentation for sqlite_bind():
http://sqlite.org/capi3ref.html#sqlite3_bind_text
It explains how to send parameters to a query

to get the results:
http://sqlite.org/capi3ref.html#sqlite3_column_int

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



Re: [sqlite] Re: Which API to use to get resultant of query

2006-09-15 Thread sandhya
Ya now i am getting error code which says SQLITE_DONE...so how can get my
resultant now?
Which API i should use?Please tell me


- Original Message - 
From: "Igor Tandetnik" <[EMAIL PROTECTED]>
To: "SQLite" 
Sent: Friday, September 15, 2006 7:57 PM
Subject: [sqlite] Re: Which API to use to get resultant of query


> sandhya <[EMAIL PROTECTED]> wrote:
> > sprintf(szQuery,"select oid from %s where filename =
> > '%s'",sampletbl,test.htm);
> >
> > sqlite3_prepare(db,szQuery, 512 , , 0);
>
> It is unlikely that szQuery string is 512 characters long. So you
> instruct SQLite to compile a long string of garbage. sqlite3_prepare
> most likely fails (I can't help but note that you don't check error code
> here). Just pass -1 as the third parameter.
>
> > errcode = sqlite3_step(pStmt);
> >
> > But the error code i am getting is 21
>
> This means sqlite3_prepare has failed, pStmt remains uninitialized so
> you are passing garbage to sqlite3_step.
>
> Igor Tandetnik
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: [sqlite] Error: database is locked on _all_ sqlite tables

2006-09-15 Thread Jay Johnston

No trac.db in the results of lsof.  Also, no processes owned by me in
/proc/locks.

On 9/15/06, Jay Sprenkle <[EMAIL PROTECTED]> wrote:


On 9/14/06, Jay Johnston <[EMAIL PROTECTED]> wrote:
> I'm having a strange problem since earlier today where all sqlite tables
on
> my shared webserver seem to be locked.  I have a trac installation using
> sqlite that started giving me "database is locked" errors earlier today
and
> continues to do so.  This is not an intermittent problem -- since it
began I
> have not been able to open a sqlite file.  If I copy a database file and
try
> and open it, I receive the same error.  Further, if I create a sqlite
file
> on my laptop and upload it to the server, even as a different user, I
> receive the same error.  Could a change have been made on this server
> causing POSIX locking to fail?

did you check if some other process is locking it?
on unix/linux  the lsof command might help
http://www.netadmintools.com/html/lsof.man.html


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread Noel Frankinet

sandhya a écrit :

Thanks  a lot for your response
Actually there is one function call in some sample found like,

static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
  int i;
  for(i=0; i

To: 
Sent: Friday, September 15, 2006 7:38 PM
Subject: Re: [sqlite] Which API to use to get resultant of query


  

On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:


sprintf(szQuery,"select oid from %s where filename =
  

'%s'",sampletbl,test.htm);
  

there's an example program here:
http://sqlite.org/quickstart.html
and a more involved one here
http://www.reddawn.net/~jsprenkl/Sqlite

--
--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

--


---
  

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


---
  




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



  



--
Noël Frankinet
Gistek Software SA
http://www.gistek.net


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



[sqlite] Re: Which API to use to get resultant of query

2006-09-15 Thread Igor Tandetnik

sandhya <[EMAIL PROTECTED]> wrote:

sprintf(szQuery,"select oid from %s where filename =
'%s'",sampletbl,test.htm);

sqlite3_prepare(db,szQuery, 512 , , 0);


It is unlikely that szQuery string is 512 characters long. So you 
instruct SQLite to compile a long string of garbage. sqlite3_prepare 
most likely fails (I can't help but note that you don't check error code 
here). Just pass -1 as the third parameter.



errcode = sqlite3_step(pStmt);

But the error code i am getting is 21


This means sqlite3_prepare has failed, pStmt remains uninitialized so 
you are passing garbage to sqlite3_step.


Igor Tandetnik 



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



Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread sandhya
Thanks  a lot for your response
Actually there is one function call in some sample found like,

static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
  int i;
  for(i=0; i
To: 
Sent: Friday, September 15, 2006 7:38 PM
Subject: Re: [sqlite] Which API to use to get resultant of query


> On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:
> > sprintf(szQuery,"select oid from %s where filename =
'%s'",sampletbl,test.htm);
> >
>
>
> there's an example program here:
> http://sqlite.org/quickstart.html
> and a more involved one here
> http://www.reddawn.net/~jsprenkl/Sqlite
>
> -- 
> --
> SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
> http://www.reddawn.net/~jsprenkl/Sqlite
>
> Cthulhu Bucks!
> http://www.cthulhubucks.com
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: [sqlite] Error: database is locked on _all_ sqlite tables

2006-09-15 Thread Jay Sprenkle

On 9/14/06, Jay Johnston <[EMAIL PROTECTED]> wrote:

I'm having a strange problem since earlier today where all sqlite tables on
my shared webserver seem to be locked.  I have a trac installation using
sqlite that started giving me "database is locked" errors earlier today and
continues to do so.  This is not an intermittent problem -- since it began I
have not been able to open a sqlite file.  If I copy a database file and try
and open it, I receive the same error.  Further, if I create a sqlite file
on my laptop and upload it to the server, even as a different user, I
receive the same error.  Could a change have been made on this server
causing POSIX locking to fail?


did you check if some other process is locking it?
on unix/linux  the lsof command might help
http://www.netadmintools.com/html/lsof.man.html

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



Re: [sqlite] Which API to use to get resultant of query

2006-09-15 Thread Jay Sprenkle

On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote:

sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm);




there's an example program here:
http://sqlite.org/quickstart.html
and a more involved one here
http://www.reddawn.net/~jsprenkl/Sqlite

--
--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

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



Re: [sqlite] how to create timestamp trigger?

2006-09-15 Thread Jay Sprenkle

hi list

in other DBs one can create time stamp column with

CREATE TABLE todo (
  id serial primary key,
  title text,
  created timestamp default now(),
  done boolean default 'f'
);


I thought this was fixed. Which version do you have?


The DEFAULT constraint specifies a default value to use when doing an
INSERT. The value may be NULL, a string constant or a number. Starting
with version 3.1.0, the default value may also be one of the special
case-independant keywords CURRENT_TIME, CURRENT_DATE or
CURRENT_TIMESTAMP. If the value is NULL, a string constant or number,
it is literally inserted into the column whenever an INSERT statement
that does not specify a value for the column is executed. If the value
is CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP, then the current
UTC date and/or time is inserted into the columns. For CURRENT_TIME,
the format is HH:MM:SS. For CURRENT_DATE, -MM-DD. The format for
CURRENT_TIMESTAMP is "-MM-DD HH:MM:SS".

http://sqlite.org/lang_createtable.html

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



[sqlite] Which API to use to get resultant of query

2006-09-15 Thread sandhya
sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm);

sqlite3_prepare(db,szQuery, 512 , , 0);

errcode = sqlite3_step(pStmt);

But the error code i am getting is 21..Somethig when i read in docs it gave 
misuseCan you please tell me where i did mistake.

Is there any documets which shows the usage of these API's please mail me.

Please help me where my resultant of the query get stored.

I need it badly...Kindly do needful.

Thank you,

-Sandhya R




[sqlite] how to create timestamp trigger?

2006-09-15 Thread emilia12
hi list

in other DBs one can create time stamp column with

CREATE TABLE todo (
  id serial primary key,
  title text,
  created timestamp default now(),
  done boolean default 'f'
);

in SQLITE probably I have to add a trigger on the INSERT
event (right?) to do the same:

CREATE TABLE todo (
  id INTEGER primary key,
  title text,
  created TEXT,
  done TEXT default 'f'
);

CREATE TRIGGER add_timestamp INSERT ON todo
  BEGIN
UPDATE todo SET created = (select datetime('now') )
WHERE ; <=#== BUT HOW TO POINT TO THE RIGHT RECORD ?
  END;

Or if there is an other way pls - tell me.

thanks in advance
-e-


-

Спортни залагания!
bg.sportingbet.com


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



Re: [sqlite] reg:Sqlite API's

2006-09-15 Thread sandhya
Thanks  a lot for your response
Actually there is one function call in some sample found like,

static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
  int i;
  for(i=0; i
To: 
Sent: Friday, September 15, 2006 6:31 PM
Subject: Re: [sqlite] reg:Sqlite API's


> sandhya wrote:
> > Hi all,
> >Can you please tell me the usage of sqlite_prepare()
/sqlite_exec()
> Have you looked at the SQLite source code? The stand-alone executable
> should be of help. I believe it is shell.c
>
> HTH,
>
> Gerry
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: [sqlite] reg:Sqlite API's

2006-09-15 Thread Gerry Snyder

sandhya wrote:

Hi all,
   Can you please tell me the usage of sqlite_prepare() /sqlite_exec()
Have you looked at the SQLite source code? The stand-alone executable 
should be of help. I believe it is shell.c


HTH,

Gerry

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



[sqlite] reg:Sqlite API's

2006-09-15 Thread sandhya
Hi all,
   Can you please tell me the usage of sqlite_prepare() /sqlite_exec() inorder 
to execute a query say for example,
I have given a query like ,

strcpy(szQuery," SELECT OID from table sample where name ="XXX"");

I have used sqlite_exec(db,szQuery,0,0,0);

Where my resultant data will get stored.Can any one please tell me how to 
retrieve the result from the above API.

I saw in documentation that we can also use sqlite_prepare() is there any 
difference btn these two.Which i can use?
How to get the resultant data from this API?
Very new to this so little bit confused with these API's.Is there any document 
which explains how to work with the sqlite with some samples.Please do mail me 
the link so i will be very thankful to you.This is very much required for me to 
complete my task with in short period.

Kindly do needful...Looking forward for ur reply

Thank you very much
Sandhya R

Re: [sqlite] null pointer problem

2006-09-15 Thread drh
Dixon Hutchinson <[EMAIL PROTECTED]> wrote:
> I am running version 3.3.6 compiled with Visual Studio .net 2003 in a 
> single threaded app.
> 
> While using sqlite3_exec to execute a "COMMIT;", in run into a null 
> pointer problem in sqlite3_step.
> 
> I added tests for the null pointer to vdbeapi.c:
> 
>  if (NULL == p) {
>   DebugBreak();
>   }
> #ifndef SQLITE_OMIT_EXPLAIN
>   if( p->explain ){
> rc = sqlite3VdbeList(p);
>   }else
> #endif /* SQLITE_OMIT_EXPLAIN */
>   {
> rc = sqlite3VdbeExec(p);
>   }
> 
>   if (NULL == p) {
>   DebugBreak();  /* This is the point the failure is detectected */
>   }
> 
> 
> So it seems that sqlite3VdbeExec(p) is somehow clobbering my statement 
> pointer.
> 

In as much as C is call-by-value, there is nothing that
sqlite3VdbeExec can do to change the value of p.  It looks
like your stack is being overwritten somewhere, perhaps due
to a buffer overrun.
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



Re: [sqlite] legacy_file_format

2006-09-15 Thread drh
Mark Richards <[EMAIL PROTECTED]> wrote:
> With sqlite version 3.3.7 if I create a new database using:
> 
>  if (sqlite3_open("/var/tmp/solarwave/aem.db", )!=0)
>  {
>  printf("Cannot open db\n");
>  return(false);
>  }
> 
> and then issue the following:
> 
>  snprintf(query, QUERY_SIZE, "%s", "PRAGMA legacy_file_format = ON");
>  nResult=sqlite3_exec(db, query, NULL, NULL, );
> 
> 
>  snprintf(query, QUERY_SIZE, "%s", "PRAGMA auto_vacuum = 1");
>  nResult=sqlite3_exec(db, query, NULL, NULL, );
>  snprintf(query, QUERY_SIZE, "%s", "PRAGMA empty_result_callbacks = 
>   1");
>  nResult=sqlite3_exec(db, query, NULL, NULL, );
>  snprintf(query, QUERY_SIZE, "%s", "PRAGMA synchronous = NORMAL");
>  nResult=sqlite3_exec(db, query, NULL, NULL, );
> 
> 
> Everything works fine - within the application.  However I have a 
> php/sqlite combo that also talks to the same database.  When it does, I get
> 
>   Warning: sqlite_open(): file is encrypted or is not a database
>   in /mnt/flash/runtime/exec/dumprecords.php on line 46
> 
> Doesn't PRAGMA legacy_file_format = ON cover this?  The docs state:
> 
>   When this flag is on, new SQLite databases are created in a file
>   format that is readable and writable by all versions of SQLite
>   going back to 3.0.0. When the flag is off, new databases are
>   created using the latest file format which might to be readable
>   or writable by older versions of SQLite.
> 

Version 3.3.7 creates (by default) a database file that can be read or 
written by any version of SQLite back to version 3.0.0.  There is no
need to do the "PRAGMA legacy_file_format=ON".  That is now the default.

But you are trying to read the database with SQLite version 2.8.17,
which is earlier (and vastly different) from version 3.0.0.
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



RE: [sqlite] Very wide tables and performance

2006-09-15 Thread Denis Povshedny
Hi Jose,

thanks for your explanations. :)

AFAIR it is a good practice to separate OLTP and OLAP databases. In this
case you do not impact interactivity and feel free to
rotate/transform/reformat data as you wish.

WBR, Denis

-Original Message-
From: jose simas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 14, 2006 4:42 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Very wide tables and performance


Hi Dennis,

This is an OLAP product and indeed we don't know upfront how much of
that data is relevant to the processing. I had a normalized group of
tables for those sets but it took an awfull time to load and to process.
In practice the wider tables are usually 25,000 columns per 50 to 100
rows and it would make sense to "rotate" the data before processing and
store it in 50 to 100 columns per 25k rows. But the problem is that the
same application has to cope with sets with say 5 columns and some
100,000 rows. Rotating sometimes and not in others would increase the
complexity of the code. The application is very "interactive" and we try
to keep the data load as low as possible so load time is key for us.

SQLite performance is oustanding in comparison with what we used before
(Access), our load times improved up to ten times and with Access we
were limited to 250 columns and the normalized version took forever to
load one million data points.

Of course the schemas are generated when the user loads their data...
and you are right, they are unreadable :-)

Cheers
Jose

On 9/14/06, Denis Povshedny <[EMAIL PROTECTED]> wrote:
> Hi Jose!
>
> It is really hard to believe that you do not have a sparse matrix. I 
> mean that for every single row: from 2 colums only a several 
> columns are used and others are nil. This is a point to perform 
> so-called normalizations for the table. The single exception what I 
> remember is OLAP databases.
>
> Anyway, I (and probably not only me) am very excited to see definition

> for this table ;)
>
> WBR, Denis
>
> -Original Message-
> From: jose simas [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 13, 2006 11:05 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Very wide tables and performance
>
>
> Thanks for your answers! I am very happy with SQLite as it is I was 
> just wondering if I could improve it for this case.
>
> I am using tables with this configuration for performance reasons. I 
> have to support an indeterminate number of columns (user data) and a 
> "normal" design is not as fast as this solution. I can't remember the 
> results of the tests right now but the differences in loading data 
> into the database and reading it to memory were very large.
>
> Thanks,
> Jose
>
> On 9/13/06, Dennis Cote <[EMAIL PROTECTED]> wrote:
> > jose simas wrote:
> > > My application uses SQLite as its file format and up to two of the

> > > tables can have several thousand columns (up to 20 or 30 thousand 
> > > at
>
> > > times).
> > >
> > > When I open a connection there's a noticeable pause (around one 
> > > second on a file with a table of 7,000 columns, for example). 
> > > There is also a noticeable delay in sorting them by the primary 
> > > key.
> > >
> > > Is there anything I can do to favour this kind of tables?
> > >
> > Jose,
> >
> > What can you possibly be doing with tables that have that many 
> > columns? Are you sure you don't mean 20K-30K rows? In SQL a row 
> > corresponds to a record, and a column corresponds to a field in a 
> > record.
> >
> > If you really mean columns, then your best approach is probably to 
> > redesign your tables to move much of the data into other related 
> > tables. Can you give us some idea of your table schema and how it is

> > used?
> >
> > There will be little or no benefit to compiling sqlite yourself.
> >
> > Dennis Cote
> >
> > 
> > --
> > ---
> > To unsubscribe, send email to [EMAIL PROTECTED]
> >
> --
> --
> -
> >
> >
>
> --
> --
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>

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

-
>
>


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


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



Re: [sqlite] reg:BOLB data

2006-09-15 Thread sandhya
Thank you very much Snyder.


- Original Message - 
From: "Gerry Snyder" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, September 13, 2006 6:56 PM
Subject: Re: [sqlite] reg:BOLB data


> sandhya wrote:
> > Hi,
> > I created a table with fileds filename and the value of type text and
BLOB
> > respectively...
> > I stored a file and  checked whether it is existing or not from command
> > prompt with sqlite3 exe..It is displaying but the problem is i can
able
> > to see the whole content of the file which i stored.
> > Where as i thought it will be in form of some OID's.?
> >
> The OID is there, but is not shown in a query by default. Try something
> like:
>
> select OID,* from tablename;
>
>
> Hope this helps,
>
> Gerry
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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