Re: [sqlite] client/server
Eugene Wee wrote: Not at all (if I correctly understand what you're trying to say). For example, there exists a SQLite extension in PHP (which comes bundled by default in PHP5, but currently does not support SQLite3). pecl, PDO extensions allows PHP to use SQLITE Version 3.X too :-) http://it2.php.net/manual/it/ref.pdo.php#pdo.drivers andr3a
Re: [sqlite] Basic Text Bind Question
Thanks Dan! Works like a charm now. On 6/7/05, Kiel W. <[EMAIL PROTECTED]> wrote: > > Ok, thanks for the responses. > > --Ulrik > >I think it stops right here, because you've got fname twice. That > >induces an error. > > You are correct, I'm not sure when I introduced that error, but thanks for > pointing it out. Its not in my running code so it was either C/P error or > something else dumb. > > -- Dr. H & Ted > Ok, I see what you guys are saying. I split my code up so I create and > populate the database with another set of sqlite3_exec() statements. I > confirmed the database is populated with the following results: > > $ ./sqlite3 test.db > SQLite version 3.2.1 > Enter ".help" for instructions > sqlite> select * from People; > fname|lname > John|Fullman > Mike|Fullman > Mike|Smith > > My select code is as follows: > > sqlite3_open( "test.db", &database ); > > size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" ); > > iPrep = sqlite3_prepare( database, buf, size, &statement, 0 ); > > sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC ); > > rc = sqlite3_step(statement); > std::cout << rc << " " << SQLITE_DONE; > > I would expect rc to be SQLITE_ROW, but it is SQLITE_DONE. I undertand > with getting multiple row back I will need to loop the sqlite3_step function > later. > > > -- > Kiel W. > [EMAIL PROTECTED] > -- > >> time is swift << > -- Kiel W. [EMAIL PROTECTED] -- >> time is swift <<
Re: [sqlite] Basic Text Bind Question
Ok, thanks for the responses. --Ulrik >I think it stops right here, because you've got fname twice. That >induces an error. You are correct, I'm not sure when I introduced that error, but thanks for pointing it out. Its not in my running code so it was either C/P error or something else dumb. -- Dr. H & Ted Ok, I see what you guys are saying. I split my code up so I create and populate the database with another set of sqlite3_exec() statements. I confirmed the database is populated with the following results: $ ./sqlite3 test.db SQLite version 3.2.1 Enter ".help" for instructions sqlite> select * from People; fname|lname John|Fullman Mike|Fullman Mike|Smith My select code is as follows: sqlite3_open( "test.db", &database ); size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" ); iPrep = sqlite3_prepare( database, buf, size, &statement, 0 ); sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC ); rc = sqlite3_step(statement); std::cout << rc << " " << SQLITE_DONE; I would expect rc to be SQLITE_ROW, but it is SQLITE_DONE. I undertand with getting multiple row back I will need to loop the sqlite3_step function later. -- Kiel W. [EMAIL PROTECTED] -- >> time is swift <<
Re: [sqlite] Basic Text Bind Question
> size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" ); ^^^ > rc = sqlite3_prepare( database, buf, -1, &statement, 0 ); > sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC ); > rc = sqlite3_step(statement); As others have pointed out, unless you omitted some code for clarity, the SELECT is never being executed. But after you get that fixed up, you also need to leave out the quotes around the question mark. With the quotes in, this is a literal question mark, not an SQL variable. Replace the SQL you have with: "SELECT * FROM People WHERE lname = ?" __ Discover Yahoo! Use Yahoo! to plan a weekend, have fun online and more. Check it out! http://discover.yahoo.com/
Re: [sqlite] Basic Text Bind Question
Kiel W. wrote: size = sprintf( buf, "CREATE TABLE People( fname varchar(25), fname varchar(25) );" ); size = sprintf( buf, "INSERT INTO People VALUES( 'John', 'Fullman' );" ); size = sprintf( buf, "INSERT INTO People VALUES( 'Sally', 'Fullman' );" ); size = sprintf( buf, "INSERT INTO People VALUES( 'Mike', 'Smith' );" ); size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" ); unless you deleted the code between the sprintf lines, this isn't doing what you think it is. -- Ted Unangst www.coverity.com Coverity, Inc.
Re: [sqlite] Basic Text Bind Question
On Tue, 2005-06-07 at 16:53 -0700, Kiel W. wrote: > size = sprintf( buf, "CREATE TABLE People( fname varchar(25), fname > varchar(25) );" ); > rc = sqlite3_prepare( database, buf, -1, &statement, 0 ); > sqlite3_prepare only processes the first statement in your list of SQL statements. It then returns a pointer to the beginning of the second statement so that you can process them all in a loop. But your code appears to omit this loop and thus is processing only the first one. It never reaches the SELECT. -- D. Richard Hipp <[EMAIL PROTECTED]>
Re: [sqlite] Basic Text Bind Question
Hi, Kiel W. wrote: Could someone point out what I missing or not understanding on this? I'm trying to do a simple text bind to search for people with the last name "Fullman". However my return code (rc) from sqlite3_step() is the same as SQLITE_DONE. I'm assuming this means it doesn't find anything. Also, how do I pull the character string of the sqlite statement to be executed from 'sqlite3_stmt' ? Thanks for the hand. -- code snipet -- sqlite3_open( "test.db", &database ); size = sprintf( buf, "CREATE TABLE People( fname varchar(25), fname varchar(25) );" ); I think it stops right here, because you've got fname twice. That induces an error. Also, I'd execute each statement by itself. HTH Ulrik Petersen -- Ulrik Petersen, PhD student, MA, B.Sc. University of Aalborg, Denmark
[sqlite] Re: Basic Text Bind Question
Added note... rc = sqlite3_prepare( database, buf, -1, &statement, 0 ); > I also tried this with rc = sqlite3_prepare( database, buf, strlen(buf), &statement, 0); -- Kiel W. [EMAIL PROTECTED] -- >> time is swift <<
[sqlite] Basic Text Bind Question
Could someone point out what I missing or not understanding on this? I'm trying to do a simple text bind to search for people with the last name "Fullman". However my return code (rc) from sqlite3_step() is the same as SQLITE_DONE. I'm assuming this means it doesn't find anything. Also, how do I pull the character string of the sqlite statement to be executed from 'sqlite3_stmt' ? Thanks for the hand. -- code snipet -- sqlite3_open( "test.db", &database ); size = sprintf( buf, "CREATE TABLE People( fname varchar(25), fname varchar(25) );" ); size = sprintf( buf, "INSERT INTO People VALUES( 'John', 'Fullman' );" ); size = sprintf( buf, "INSERT INTO People VALUES( 'Sally', 'Fullman' );" ); size = sprintf( buf, "INSERT INTO People VALUES( 'Mike', 'Smith' );" ); size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" ); rc = sqlite3_prepare( database, buf, -1, &statement, 0 ); sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC ); rc = sqlite3_step(statement); std::cout << rc << " " << SQLITE_DONE; // rc == SQLITE_DONE at this point --- end code --- -- Kiel W. [EMAIL PROTECTED] -- >> time is swift <<
Re: [sqlite] client/server
On Tue, Jun 07, 2005 at 11:52:30AM -0300, Mart?n Schamis wrote: > Hi, Eugene and everybody. > > The problem I have is this, I?m implementing a web aplication that will > require up to 300 users writing at Then why are you even looking at SQLite? IMNSHO, unless you have some compelling reasons otherwise, you should default to using PostgreSQL for that sort of thing. You haven't said much about what you're really doing, but a large busy database-backed website with many concurrent users is exactly the sort of OLTP niche where capable client/server RDBMSs like PostgreSQL or Oracle shine. -- Andrew Piskorski <[EMAIL PROTECTED]> http://www.piskorski.com/
Re: [sqlite] client/server
Martín Schamis said: > Hello, I´ve seen inthe sqllite page that,"If you have many client > programs accessing a common database over a network, you should consider > using a client/server database engine instead of SQLite" > > 1 .- This means that I can´t use a php on the web and the users acceding > to that page can`t modify the base ? > > 2.- Or there is a limi of users ? > > 3.- If there is a limit waht is it ? It means that the file shouldn't live on a network file system. It your web server folder is accessed via NFS or SMB (Windows File Share), SQLite isn't the tool for you. Given the volume of transaction processing you're indicating, you might want to consider if this is the right database for you. Consider if there will really be 300 simultaneous connections (which is different from 300 simultaneous application users) that you might instead be in need of a high availability client/server database model. PostgreSQL fares very well in this category, or some of the heftier commercial database offerings. Clay Dowling -- Lazarus Notes from Lazarus Internet Development http://www.lazarusid.com/notes/ Articles, Reviews and Commentary on web development
Re: [sqlite] client/server
Martín Schamis a écrit : > Hi, Eugene and everybody. > > The problem I have is this, I´m implementing a web aplication that will > require up to 300 users writing at > The same time to the database file simultaneously. you mean 300 users connected simultaaneously, writing occasionaly to the database I guess, which is not the same thing. Provided your queries are optimized and you take care of copen connections (not leaving connections open more than is strictly necessary) it could do the trick. It all depends on how database-intensive your application is. But even 300 simultaneious connections won't make it on a very powerful mysql server anyway. -- +---+ | David Morel <[EMAIL PROTECTED]> | | http://www.intradot.com | +---+ | Intradot Labs | | 2, rue Cuzin | | F-69120 Vaulx-en-Velin| | tel: +33 478 80 87 90 | +---+ signature.asc Description: OpenPGP digital signature
RE: [sqlite] client/server
Hi, Eugene and everybody. The problem I have is this, I´m implementing a web aplication that will require up to 300 users writing at The same time to the database file simultaneously. The question is, if sqllite will supported ? Thanks for your help. Martín -Mensaje original- De: Eugene Wee [mailto:[EMAIL PROTECTED] Enviado el: martes, 07 de junio de 2005 10:59 Para: sqlite-users@sqlite.org Asunto: Re: [sqlite] client/server Hi, Martín Schamis wrote: > 1 .- This means that I can´t use a php on the web and the users acceding > to that page can`t modify the base ? Not at all (if I correctly understand what you're trying to say). For example, there exists a SQLite extension in PHP (which comes bundled by default in PHP5, but currently does not support SQLite3). From what I see, the point that the documentation is trying to make is that SQLite is not suitable when you're dealing with a congested network environment. If you dont expect (many) users to be writing to the same database file simultaneously, SQLite may still be a feasible option. Eugene Wee
Re: [sqlite] client/server
Hi, Martín Schamis wrote: 1 .- This means that I can´t use a php on the web and the users acceding to that page can`t modify the base ? Not at all (if I correctly understand what you're trying to say). For example, there exists a SQLite extension in PHP (which comes bundled by default in PHP5, but currently does not support SQLite3). From what I see, the point that the documentation is trying to make is that SQLite is not suitable when you're dealing with a congested network environment. If you dont expect (many) users to be writing to the same database file simultaneously, SQLite may still be a feasible option. Eugene Wee
[sqlite] client/server
Hello, I´ve seen inthe sqllite page that,"If you have many client programs accessing a common database over a network, you should consider using a client/server database engine instead of SQLite" 1 .- This means that I can´t use a php on the web and the users acceding to that page can`t modify the base ? 2.- Or there is a limi of users ? 3.- If there is a limit waht is it ? Thanks, Martín
Re: [sqlite] Tiger: Error: file is encrypted or is not a database
On Jun 6, 2005, at 10:36 AM, Helmut Tschemernjak wrote: Hello, I try to look into the sqlite database in Mac OS X Tiger at: /.Spotlight-V100/ I cannot dump any data or schema and the file magic is not containing sqlite. The data is not encrypted. It looks like the file is incompatible with sqlite3. Any ideas how to find out what Tiger is storing? This isn't a SQLite file. I don't believe Spotlight uses SQLite. Mail's db is located here (no message body data; just subjects, addresses etc.): ~/Library/Mail/Envelope Index ...that is readable. -K
[sqlite] Integrity Check Pragma
Hi, Sorry to ask a stupid question, but how exactly do I get the return value from this pragma? Thanks in advance, Steve
Re: [sqlite] Only 128 inserts with NULL value for INTEGER PRIMARY KEY
Tom Deblauwe wrote: Tom Deblauwe wrote: D. Richard Hipp wrote: What happens when you try to insert the 129th value? I tried now the following: I get the same results in the windows commandline tool: MAX(iID) gives met 127 and COUNT(iID) gives me 29... Hereby is the database attached! sqlite_analyzer doesn't say it is broken or something. kind regards, Tom,