[sqlite] select max(field1), field2 from table1
Had a look at the new option as in the SQL above. Noticed it will only return one record, even if there are more records where field1 equals max(field1). I suppose it returns the first record it finds where field1 = max(field1). Is this indeed how it works? RBS ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] select max(field1), field2 from table1
On Wed, Sep 12, 2012 at 6:15 AM, Bart Smissaert bart.smissa...@gmail.comwrote: Had a look at the new option as in the SQL above. Noticed it will only return one record, even if there are more records where field1 equals max(field1). I suppose it returns the first record it finds where field1 = max(field1). Is this indeed how it works? Yes. RBS ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] select max(field1), field2 from table1
OK, thanks for confirming that. RBS On 9/12/12, Richard Hipp d...@sqlite.org wrote: On Wed, Sep 12, 2012 at 6:15 AM, Bart Smissaert bart.smissa...@gmail.comwrote: Had a look at the new option as in the SQL above. Noticed it will only return one record, even if there are more records where field1 equals max(field1). I suppose it returns the first record it finds where field1 = max(field1). Is this indeed how it works? Yes. RBS ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite select max(field1), field2 from table1
On 12 Sep 2012 at 11:37, Richard Hipp d...@sqlite.org wrote: On Wed, Sep 12, 2012 at 6:15 AM, Bart Smissaert bart.smissa...@gmail.comwrote: Had a look at the new option as in the SQL above. Noticed it will only return one record, even if there are more records where field1 equals max(field1). I suppose it returns the first record it finds where field1 = max(field1). Is this indeed how it works? Yes. Is there any means of influencing which record would be returned in this circumstance, such as by an ORDER BY? Or does that merely order the (one) returned record :-) -- Cheers -- Tim ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite upgrade issue
Please manually download and upgrade SQLite from SQLite's websitehttp://sqlite.org/download.html . *Brandon Sky Pimenta* On Tue, Sep 11, 2012 at 11:39 AM, Robert Calco bobca...@gmail.com wrote: Upgrading from 1.0.66 to 1.0.82 on .NET 4.0 I am running into an issue that appears to stem from assumptions about when/how SQLiteConnection instances are disposed. I'm working on a code base with which I'm not yet entirely familiar. The previous developer created a sort of wrapper connection concept that implements IDisposable. When calling the Close() method on this abstraction, the Connection variable (an instance of SQLiteConnection) is throwing ObjectDisposedException. Has anyone else run into this or a similar problem? -- *Bob Calco* ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.DataSQLite locking problem
I've experienced this problem in the past. According to herehttp://technosophos.com/node/242, I found a solution. *Brandon's Tips on How to Unlock SQLite Databases* 1. Open a command line prompt window. 2. Type *sqlite* *dbname*.sqlite in the command line prompt, replacing dbname with the SQLite database name. 3. In the secondary prompt that appears, type *.backup* full *dbname* .sqlite, replacing dbname with the SQLite database name. 4. Type *.exit *to return to the ordinary command prompt. 5. Type *mv* *dbname*.sqlite old.sqlite, then *mv* backup.sqlite *dbname* .sqlite in the command line, replacing dbname with the SQLite database name. 6. Try the task you were attempting to do before you did all of the above instructions. 7. *You are done!* *Brandon Sky Pimenta* On Tue, Sep 11, 2012 at 10:35 AM, Serge Fournier tech...@gmail.com wrote: Hi, I'm not sure if it's Windows 8 or the latest version of the library (1.0.82) but I have a new problem with the same code that was working before. Simply put, i I open a database and then close it in an application then I reopen it again, I cannot write to it anymore; it is always locked. I tried doing a close, dispose and shutdown to my connection and then reopning it and do a simple vaccum; it tell me that there's still sql queries in progress when none were sent to the database. I cannot test this in Windows 7 yet, but I'm wandering if it's a problem with Windows 8; or a bug in the new version of System.Data.SQlite. I use Visual Studio 2010. Thanks. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite select max(field1), field2 from table1
On Wed, Sep 12, 2012 at 7:51 AM, Tim Streater t...@clothears.org.uk wrote: On 12 Sep 2012 at 11:37, Richard Hipp d...@sqlite.org wrote: On Wed, Sep 12, 2012 at 6:15 AM, Bart Smissaert bart.smissa...@gmail.comwrote: Had a look at the new option as in the SQL above. Noticed it will only return one record, even if there are more records where field1 equals max(field1). I suppose it returns the first record it finds where field1 = max(field1). Is this indeed how it works? Yes. Is there any means of influencing which record would be returned in this circumstance, such as by an ORDER BY? No. If you have multiple rows with the same maximum value, then the one that ends up being returned is arbitrary. -- Cheers -- Tim ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.DataSQLite locking problem
Did you try it with a Windows 8? I have a feeling that the problem is more with this OS then the library. Here's something simple that doesn't work: SQLconnect.ConnectionString = Data Source= Application.StartupPath \data.db; SQLconnect.SetPassword(infoConnection) SQLconnect.Open() sqlconnect.close() sqlconnect.dispose() Dim SQLconnect As New SQLite.SQLiteConnection Dim SQLcommand As New SQLite.SQLiteCommand Dim SQLreader As SQLite.SQLiteDataReader Dim SQLquery As String SQLconnect.ConnectionString = Data Source= Application.StartupPath \data.db; SQLconnect.SetPassword(infoConnection) SQLconnect.Open() SQLquery = VACUUM Try SQLcommand = SQLconnect.CreateCommand SQLcommand.CommandText = SQLquery SQLcommand.ExecuteNonQuery() SQLcommand.Dispose() Catch sqlexception As SQLite.SQLiteException MessageBox.Show(sqlexception.Message, Error!, MessageBoxButtons.OK, MessageBoxIcon.Error) Catch ex As Exception MessageBox.Show(ex.Message, Error!, MessageBoxButtons.OK, MessageBoxIcon .Error) End Try It gives the Still SQL queries to process error. On Tue, Sep 11, 2012 at 10:07 PM, Joe Mistachkin sql...@mistachkin.comwrote: Serge Fournier wrote: Simply put, it's only possible to open a database once in the application for writing; it's like the lock doesn't get released until the application is closed. I'm unable to reproduce the issue you describe here. Could you show us some sample code that demonstrates the issue? -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.DataSQLite locking problem
The thing here is that my code was working perfectly with the prior version of the library and Windows 7. The same code with 1.0.82 and Windows 8 doesn't work anymore. I cannot use your solution, because the way my appliation works; it creates the database at first run and miust be able to run on many computers. I've tried recreating the database; and so many things; the only thing that works is to only open the database once in my application which is no a good solution for me since I have to remove some functions like VACUUM etc... Thanks. On Tue, Sep 11, 2012 at 3:18 PM, Brandon Pimenta brandonskypime...@gmail.com wrote: I've experienced this problem in the past. According to herehttp://technosophos.com/node/242, I found a solution. *Brandon's Tips on How to Unlock SQLite Databases* 1. Open a command line prompt window. 2. Type *sqlite* *dbname*.sqlite in the command line prompt, replacing dbname with the SQLite database name. 3. In the secondary prompt that appears, type *.backup* full *dbname* .sqlite, replacing dbname with the SQLite database name. 4. Type *.exit *to return to the ordinary command prompt. 5. Type *mv* *dbname*.sqlite old.sqlite, then *mv* backup.sqlite *dbname* .sqlite in the command line, replacing dbname with the SQLite database name. 6. Try the task you were attempting to do before you did all of the above instructions. 7. *You are done!* *Brandon Sky Pimenta* On Tue, Sep 11, 2012 at 10:35 AM, Serge Fournier tech...@gmail.com wrote: Hi, I'm not sure if it's Windows 8 or the latest version of the library (1.0.82) but I have a new problem with the same code that was working before. Simply put, i I open a database and then close it in an application then I reopen it again, I cannot write to it anymore; it is always locked. I tried doing a close, dispose and shutdown to my connection and then reopning it and do a simple vaccum; it tell me that there's still sql queries in progress when none were sent to the database. I cannot test this in Windows 7 yet, but I'm wandering if it's a problem with Windows 8; or a bug in the new version of System.Data.SQlite. I use Visual Studio 2010. Thanks. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] C++ - HOW MANY rows?
Try using this method...you just need to ensure mystmt is set to NULL to start with and reset to NULL in finalize(). const int mySQLite3::read_int(int pos) throw(somexception) { if (mystmt == NULL) { // Ensure mystmt is set to NULL in constructor rc = sqlite3_prepare_v2(db, SQLStatement.c_str(), -1, mystmt, NULL); if(rc != SQLITE_OK) { try { this-display(rc, FILE, METHOD, LINE); } catch(somexception e) { throw e; } } } rc = sqlite3_step(mystmt); if(rc == SQLITE_ROW ) { apint = sqlite3_column_int(mystmt,pos); counter++; return apint; } if (rc != SQLITE_DONE) { this-display(rc,FILE,METHOD,LINE+:+sqlite3_errmsg(db)); } try { this-finalize(); // ensure mystmt set to null in finalize } catch(somexception e) { throw e; } return -1; // how do you know when you're done? Will -1 work? } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Arbol One [arbol...@gmail.com] Sent: Tuesday, September 11, 2012 9:44 PM To: 'General Discussion of SQLite Database' Subject: EXT :Re: [sqlite] C++ - HOW MANY rows? Thanks Igor for your prompt response. Since the call to the sqlite3_step function is inside the mySQLite3::read_* class-function/method, I call the read_* method from Runner::read_tblName() for each datum I need to retrieve. Now, in a while loop inside Runner::read_tblName() I could call the mySQLite3::read_* for the data to be retrieved, but instead of reading the next row of data, it keeps on reading the same row again and again. Furthermore, I have no way to let Runner::read_tblName 'know' that there is no more data, hence stopping the while loop. Obviously my problem is in design, but I don't have enough experience using SQLite3 to come up with a better idea. My question is, really, how do you, C++ programmers, have resolved this issue? There must be a solution. void Runner::read_tblName() { . sql_statement = SELECT * FROM name; //while(there is more data){ // I have no-way to report to this method that there is no more data in the bank // I could add a flag to the mySQLite3 class and have the while loop check on its status, // or a signal that would be trigger by the ending of the while loop. db-setStmt(sql_statement); int pos = 0; data1 = db-read_int(pos); db-setStmt(sql_statement); pos = 1; data2 = db-read_str(pos); data3 = db-read_str(++pos); data4 = db-read_str(++pos); data5 = db-read_str(++pos); Glib::ustring str; str = apstr.format(data1); str += ; str += data2; str += . ; str += data3; str += ; str += data4; str += ; str += data5; apex-setException(str, FILE, METHOD, LINE); apex-Display(); // } --- } const int mySQLite3::read_int(int pos) throw(somexception) { rc = sqlite3_prepare_v2(db, SQLStatement.c_str(), -1, mystmt, NULL); if(rc != SQLITE_OK) { try { this-display(rc, FILE, METHOD, LINE); } catch(somexception e) { throw e; } } else { counter++; } rc = sqlite3_step(mystmt); if(rc == SQLITE_ROW ) { apint = sqlite3_column_int(mystmt,pos); } try { this-finalize(); } catch(somexception e) { throw e; } return apint; } const Glib::ustring mySQLite3::read_str(const int pos) throw(somexception) { //if(pos == 0) { rc = sqlite3_prepare_v2(db, this-SQLStatement.c_str(), -1, mystmt, NULL); //} if(rc != SQLITE_OK) { try { this-display(rc, FILE, METHOD, LINE); } catch(somexception e) { throw e; } } else { counter++; } rc = sqlite3_step(mystmt); if(rc == SQLITE_ROW ) { apstr = (const char*)sqlite3_column_text(mystmt,pos); } try { this-finalize(); } catch(somexception e) { throw e; } return apstr; } ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite select max(field1), field2 from table1
On 12 Sep 2012, at 1:03pm, Richard Hipp d...@sqlite.org wrote: On Wed, Sep 12, 2012 at 7:51 AM, Tim Streater t...@clothears.org.uk wrote: On 12 Sep 2012 at 11:37, Richard Hipp d...@sqlite.org wrote: On Wed, Sep 12, 2012 at 6:15 AM, Bart Smissaert bart.smissa...@gmail.comwrote: [snip] max(field1) [snip] Is there any means of influencing which record would be returned in this circumstance, such as by an ORDER BY? No. If you have multiple rows with the same maximum value, then the one that ends up being returned is arbitrary. In other words, there's no way to do what you want in a single SELECT. You can do one SELECT just to find the value for max(field1), and then another SELECT which uses ORDER BY to choose one of the records with that value for field1. I think you might even be able to do it using a sub-SELECT: SELECT field2, field3 FROM myTable WHERE field1 = (SELECT max(field1) FROM myTable) ORDER BY acquisitionDate DESC LIMIT 1 I may have the above syntax wrong since I don't use sub-selects myself. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Covering index scan optimization
Hello, I've just wanted to ask about using covering indexes for scans. A very rudimentary test: create table t (c1,c2, c3, c4); create index idxtc1 on t(c1); The simple select scans the full table: explain query plan select c1 from t; SCAN TABLE t (~100 rows) A select with a dummy order by uses the covering index: explain query plan select c1 from t order by c1; SCAN TABLE t USING COVERING INDEX idxtc1 (~100 rows) It seems to me that using a covering index scan would always be faster in both cases (fewer disk page reads). Am i wrong? Is there a reason for SQLite to not use a covering index for scans? Thank you in advance, lefteris ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Reducing size
Hi. I use a sqlite database in read-only mode. The database itself contains just one table with an unique key, several strings and a double number per row: 0 'book1' 'author1' 10.00 1 'book2' 'author2' 12.05 2 'book3' 'author3' 9.35 ... I use just the following SQL commands in my application to query from this database: SELECT ... FROM ... WHERE ... SELECT DISTINCT FROM ... WHERE ... I plan to compile sqlite3.c by myself and embed it into my app. Which SQLITE_* directives I can use in compile-time to disable unused SQLITE features to reduce the size of sqlite3.o? Thanks. -- ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] C++ - HOW MANY rows?
Look, Sir, I appreciate that you have spend your time and energy responding to my question, in fact, I have used your suggestion to have a look at the other guys' C++ wrappers of the SQLite3 library, but my intention is to learn SQL using the SQLite3 API. I am using C++ and not the 'prompt', because I will ultimately use C++ to implement my knowledge of SQL and SQLite3. Just so that we are clear, I don't mind trying and failing a thousand times, I need to know how this thing works! On the other hand, I really like your analogy of the book being opened, the pages being read and then closing the book again, it is brilliant concept. I see now that I need to reorganize my class so that I can have the 'finalizer' method called only once at the end of the database transaction. I hope, and I am counting on everyone here, to eventually release mySQLite3 in the public domain. Again, thanks so much for your help and have a wonderful day. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik Sent: Tuesday, September 11, 2012 11:24 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] C++ - HOW MANY rows? Arbol One arbol...@gmail.com wrote: Since the call to the sqlite3_step function is inside the mySQLite3::read_* class-function/method ... it is clear that you have a poor class design. As you would generally want to read several columns from the same row, it is unwise to have a read_* method call sqlite3_step, thus advancing to the next row. It is even less wise to have it call sqlite3_prepare and sqlite3_finalize. Now, in a while loop inside Runner::read_tblName() I could call the mySQLite3::read_* for the data to be retrieved, but instead of reading the next row of data, it keeps on reading the same row again and again. Because you prepare and finalize the stament again and again. Think about it this way: sqlite3_prepare call opens a book, sqlite3_step call turns a page, sqlite3_finalize call closes the book shut. Your read_* method opens the book, turns to the first page, reads one line, then closes the book. The next read_* call opens the book again, turns to the first page again, reads another line, and closes the book. Again, and again. Is it still surprising that you never progress past the first page? Obviously my problem is in design Indeed. but I don't have enough experience using SQLite3 to come up with a better idea. In this case, perhaps you should consider using, or at least studying, some existing libraries. There's no shortage of them: http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] C++ - HOW MANY rows?
On 12 Sep 2012, at 6:31pm, Arbol One arbol...@gmail.com wrote: Look, Sir, I appreciate that you have spend your time and energy responding to my question, in fact, I have used your suggestion to have a look at the other guys' C++ wrappers of the SQLite3 library, but my intention is to learn SQL using the SQLite3 API. Now that you understand the basics of the SQLite API I think you might be at a good stage to read through the documentation on the SQLite site. For instance, if you read http://www.sqlite.org/c3ref/stmt.html you will learn that it is necessary to call _step() multiple times after calling _prepare() once. So go read through /all/ of it, not necessarily every word but definitely every page, making notes as you read about which pages are going to be useful once you go back to programming again. One thing I'll point out is that you should handle the result codes returned by /every/ call to the API. This not only helps your wrapper to handle errors properly but will help you detect problems while you're writing your wrapper. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] C++ - HOW MANY rows?
yes, it worked, thanks Michael. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Black, Michael (IS) Sent: Wednesday, September 12, 2012 8:13 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] C++ - HOW MANY rows? Try using this method...you just need to ensure mystmt is set to NULL to start with and reset to NULL in finalize(). const int mySQLite3::read_int(int pos) throw(somexception) { if (mystmt == NULL) { // Ensure mystmt is set to NULL in constructor rc = sqlite3_prepare_v2(db, SQLStatement.c_str(), -1, mystmt, NULL); if(rc != SQLITE_OK) { try { this-display(rc, FILE, METHOD, LINE); } catch(somexception e) { throw e; } } } rc = sqlite3_step(mystmt); if(rc == SQLITE_ROW ) { apint = sqlite3_column_int(mystmt,pos); counter++; return apint; } if (rc != SQLITE_DONE) { this-display(rc,FILE,METHOD,LINE+:+sqlite3_errmsg(db)); } try { this-finalize(); // ensure mystmt set to null in finalize } catch(somexception e) { throw e; } return -1; // how do you know when you're done? Will -1 work? } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Arbol One [arbol...@gmail.com] Sent: Tuesday, September 11, 2012 9:44 PM To: 'General Discussion of SQLite Database' Subject: EXT :Re: [sqlite] C++ - HOW MANY rows? Thanks Igor for your prompt response. Since the call to the sqlite3_step function is inside the mySQLite3::read_* class-function/method, I call the read_* method from Runner::read_tblName() for each datum I need to retrieve. Now, in a while loop inside Runner::read_tblName() I could call the mySQLite3::read_* for the data to be retrieved, but instead of reading the next row of data, it keeps on reading the same row again and again. Furthermore, I have no way to let Runner::read_tblName 'know' that there is no more data, hence stopping the while loop. Obviously my problem is in design, but I don't have enough experience using SQLite3 to come up with a better idea. My question is, really, how do you, C++ programmers, have resolved this issue? There must be a solution. void Runner::read_tblName() { . sql_statement = SELECT * FROM name; //while(there is more data){ // I have no-way to report to this method that there is no more data in the bank // I could add a flag to the mySQLite3 class and have the while loop check on its status, // or a signal that would be trigger by the ending of the while loop. db-setStmt(sql_statement); int pos = 0; data1 = db-read_int(pos); db-setStmt(sql_statement); pos = 1; data2 = db-read_str(pos); data3 = db-read_str(++pos); data4 = db-read_str(++pos); data5 = db-read_str(++pos); Glib::ustring str; str = apstr.format(data1); str += ; str += data2; str += . ; str += data3; str += ; str += data4; str += ; str += data5; apex-setException(str, FILE, METHOD, LINE); apex-Display(); // } --- } const int mySQLite3::read_int(int pos) throw(somexception) { rc = sqlite3_prepare_v2(db, SQLStatement.c_str(), -1, mystmt, NULL); if(rc != SQLITE_OK) { try { this-display(rc, FILE, METHOD, LINE); } catch(somexception e) { throw e; } } else { counter++; } rc = sqlite3_step(mystmt); if(rc == SQLITE_ROW ) { apint = sqlite3_column_int(mystmt,pos); } try { this-finalize(); } catch(somexception e) { throw e; } return apint; } const Glib::ustring mySQLite3::read_str(const int pos) throw(somexception) { //if(pos == 0) { rc = sqlite3_prepare_v2(db, this-SQLStatement.c_str(), -1, mystmt, NULL); //} if(rc != SQLITE_OK) { try { this-display(rc, FILE, METHOD, LINE); } catch(somexception e) { throw e; } } else { counter++; } rc = sqlite3_step(mystmt); if(rc == SQLITE_ROW ) { apstr = (const char*)sqlite3_column_text(mystmt,pos); } try { this-finalize(); } catch(somexception e) { throw e; } return apstr; } ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] C++ - HOW MANY rows?
On 9/12/2012 1:31 PM, Arbol One wrote: Just so that we are clear, I don't mind trying and failing a thousand times, Well, the participants in this list might not possess quite as infinite a patience. If you plan to post a what am I doing wrong type of message to the list a thousand times after each such attempt, you run the risk of outstaying your welcome. I need to know how this thing works! Which part, specifically, do you find unclear? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing size
Why are you concerned about the size of sqlite3.o? RobR ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing size
On 12 Sep 2012, at 7:05pm, Rob Richardson rdrichard...@rad-con.com wrote: Why are you concerned about the size of sqlite3.o? Or, to clarify Rob's question, modern compiler chains include only code for routines which are referred to from main() on down. If no part of your code refers to sqlite3_status() then it never makes it to your app. This is one advantage of compiling sqlite3.c into your app rather than making a library which has to have every routine in it. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing size
2012/9/12 Simon Slavin slav...@bigfraud.org On 12 Sep 2012, at 7:05pm, Rob Richardson rdrichard...@rad-con.com wrote: Why are you concerned about the size of sqlite3.o? Or, to clarify Rob's question, modern compiler chains include only code for routines which are referred to from main() on down. If no part of your code refers to sqlite3_status() then it never makes it to your app. This is one advantage of compiling sqlite3.c into your app rather than making a library which has to have every routine in it. Hi. Actually this is a dynamically loaded plugin, so compiler won't strip unused functions. I cannot change this behaviour. That's why I'm asking about SQLITE_* directives. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- Regards, Krasu ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.DataSQLite locking problem
Doing more testing on this I can say that I have the same problems with Windows 7. On Wed, Sep 12, 2012 at 8:08 AM, Serge Fournier tech...@gmail.com wrote: The thing here is that my code was working perfectly with the prior version of the library and Windows 7. The same code with 1.0.82 and Windows 8 doesn't work anymore. I cannot use your solution, because the way my appliation works; it creates the database at first run and miust be able to run on many computers. I've tried recreating the database; and so many things; the only thing that works is to only open the database once in my application which is no a good solution for me since I have to remove some functions like VACUUM etc... Thanks. On Tue, Sep 11, 2012 at 3:18 PM, Brandon Pimenta brandonskypime...@gmail.com wrote: I've experienced this problem in the past. According to herehttp://technosophos.com/node/242, I found a solution. *Brandon's Tips on How to Unlock SQLite Databases* 1. Open a command line prompt window. 2. Type *sqlite* *dbname*.sqlite in the command line prompt, replacing dbname with the SQLite database name. 3. In the secondary prompt that appears, type *.backup* full *dbname* .sqlite, replacing dbname with the SQLite database name. 4. Type *.exit *to return to the ordinary command prompt. 5. Type *mv* *dbname*.sqlite old.sqlite, then *mv* backup.sqlite *dbname* .sqlite in the command line, replacing dbname with the SQLite database name. 6. Try the task you were attempting to do before you did all of the above instructions. 7. *You are done!* *Brandon Sky Pimenta* On Tue, Sep 11, 2012 at 10:35 AM, Serge Fournier tech...@gmail.com wrote: Hi, I'm not sure if it's Windows 8 or the latest version of the library (1.0.82) but I have a new problem with the same code that was working before. Simply put, i I open a database and then close it in an application then I reopen it again, I cannot write to it anymore; it is always locked. I tried doing a close, dispose and shutdown to my connection and then reopning it and do a simple vaccum; it tell me that there's still sql queries in progress when none were sent to the database. I cannot test this in Windows 7 yet, but I'm wandering if it's a problem with Windows 8; or a bug in the new version of System.Data.SQlite. I use Visual Studio 2010. Thanks. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] EXTERNAL: Re: sqlite3_trace() threadsafe
I am using the sqlite3_unlock_notify () mechanism along with shared cache in a multithreaded application that uses SQLite version 3.7.13. I have been attaching sqlite3_trace () to all database connections in the application to log all operations performed on the database. In the sqlite3_trace () callback function that I registered, I simply lock a mutex, print the statement to stdout, flush stdout, then unlock the mutex. I have been getting seemingly random statements printed more than they are supposed to be, but the database operation itself seemed to be executing fine without errors. I think that in the following code from http://www.sqlite.org/unlock_notify.html: int sqlite3_blocking_step(sqlite3_stmt *pStmt){ int rc; while( SQLITE_LOCKED==(rc = sqlite3_step(pStmt)) ){ rc = wait_for_unlock_notify(sqlite3_db_handle(pStmt)); if( rc!=SQLITE_OK ) break; sqlite3_reset(pStmt); } return rc; } the sqlite3_trace () callback function seems to be called even when sqlite3_step () returns SQLITE_LOCKED and the operation is not successful. This seems to be why some statements are being duplicated from test programs that I have written. Is this analysis correct? If so, is there any way to get the sqlite3_trace () callback to only get called when sqlite3_step returns SQLITE_DONE? In other words, how do I have sql statements printed in the callback only when it is actually performed on the database. Thanks, Eric -- View this message in context: http://sqlite.1065341.n5.nabble.com/sqlite3-trace-threadsafe-tp64004p64224.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing size
On 12 Sep 2012, at 8:00pm, Dmitry Baryshev ksquirrel...@gmail.com wrote: Actually this is a dynamically loaded plugin, so compiler won't strip unused functions. I cannot change this behaviour. That's why I'm asking about SQLITE_* directives. Ah. In that case you want section 1.6 of http://www.sqlite.org/compile.html Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Library routine called out sequence error.
I am working on an example project using X Code 4.4.1 and even though what I have entered is the same as what is printed this one section of code is not working. I would appreciate any input as to what is causing my Sqlite3_Prepare to spit out this error. I have included the section of code in Question. - (void) findContact { sqlite3_stmt *statement; const char *dbpath = [databasePath UTF8String]; if (sqlite3_open(dbpath, contactDB) == SQLITE_OK) { NSString *querySQL = [NSString stringWithFormat: @SELECT address, phone, FROM contacts WHERE name = \%@\, name.text]; const char *query_stmt = [querySQL UTF8String]; if (sqlite3_prepare_v2(contactDB, query_stmt, -1, statement, NULL) == SQLITE_OK) { if (sqlite3_step(statement) == SQLITE_ROW) { NSString *addressField = [[NSString alloc] initWithUTF8String: (const char *) sqlite3_column_text(statement, 0)]; address.text = addressField; NSString *phoneField = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 1)]; phone.text = phoneField; status.text = @Match Found; } else { status.text = @Match not found; address.text = @; phone.text = @; } sqlite3_finalize(statement); } sqlite3_close(contactDB); NSLog(@ error '%s, sqlite3_errmsg(contactDB) ); } } ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Library routine called out sequence error.
Donald Steele xln...@sbcglobal.net wrote: sqlite3_close(contactDB); NSLog(@ error '%s, sqlite3_errmsg(contactDB) ); The error is produced not by sqlite3_prepare_v2 but by sqlite3_errmsg, as you are calling it on an already-closed handle. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users