Re: [sqlite] Implementing busy-waiting on SQLite
On Mon, Jun 13, 2011 at 06:21:10PM +0200, Jean-Christophe Deschamps scratched on the wall: > Hi Jay, > > >> Invoke sqlite3_busy_timeout() with a safe timeout for every connection > >> to the DB. > >> Use IMMEDIATE transactions everywhere. > >> > >> That's all you have to do. > > > > Well, yes and no. You still have to deal with the case of > > SQLITE_BUSY being returned due to deadlocks. Setting a timeout and > > using BEGIN IMMEDIATE will help significantly, but not completely > > eliminate this issue. It also means that if an SQLITE_BUSY does slip > > through, you have no choice but to rollback the transaction and start > > all over. > > > > For more specifics, see: > > > > http://sqlite.org/lockingv3.html > > http://sqlite.org/c3ref/busy_handler.html <= deadlock info > > http://sqlite.org/c3ref/busy_timeout.html > > I'm not sure you can get deadlocks with immediate transactions. As > I understand it, it would defeat the purpose of immediate > transactions. Do you have a sample test pseudo-code to show how it > can happen? Looking at this again, it would seem you are correct. The BEGIN IMMEDIATE can, of course, fail, but once that's passed you should be good to go. Without the busy handler you can still get _BUSY return codes from any command (including the final COMMIT), but you should be able to wait them out-- assuming all read interactions with the database finish and reset/finalize their statements in a reasonable amount of time. That doesn't apply to other connections from other processes, of course. The BEGIN IMMEDIATE only "protects" the database connection that issues it. If another database connection attempts to modify the DB under a DEFERRED transaction (including an auto-commit transaction) a deadlock can still occur. However, in that case, it would normally be the responsibility of the DEFERRED connection to give up and release all the locks. Of course, many, many applications out there don't deal with this correctly, so you would need to be careful with a general-access database. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
I made changes with an other sqlite editor and now it works fine. It was not a code problem. Thanks for your help Philippe RIO -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 7:56 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Try changing just the last char. Then drop just the last char. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT For example "Test" -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 7:30 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT If you change the table name to what? Same # of chars? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:08 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT If I change the table name it works. I tryed the same query using SqLite3Explorer and it does not give any result ! -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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 ___ 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] A simple SELECT
The result always is the same : NONE -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 7:56 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Try changing just the last char. Then drop just the last char. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT For example "Test" -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 7:30 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT If you change the table name to what? Same # of chars? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:08 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT If I change the table name it works. I tryed the same query using SqLite3Explorer and it does not give any result ! -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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 ___ 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] A simple SELECT
Try changing just the last char. Then drop just the last char. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT For example "Test" -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 7:30 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT If you change the table name to what? Same # of chars? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:08 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT If I change the table name it works. I tryed the same query using SqLite3Explorer and it does not give any result ! -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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 ___ 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] EXT :Re: A simple SELECT
For example "Test" -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 7:30 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: A simple SELECT If you change the table name to what? Same # of chars? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:08 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT If I change the table name it works. I tryed the same query using SqLite3Explorer and it does not give any result ! -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to compile both DLLs with another .NET framework
Dear all, Following Pavel's answers to my topic "Cannot load SQLite.Interop.dll but file is in the folder" (cf. below), it seems necessary for me to re-compile both DLLs (System.Data.SQLite.dll and SQLite.Interop.dll) with a specific framework version (my application uses the framework 3.0). However, I have only the Express versions (not the studio one) and it seems that it is thus not possible for me to re-compile SQLite.NET. First question: am I right? Second question: how to re-compile then? Thank you very much for your support Regards, Cyrille ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] EXT :Re: A simple SELECT
If you change the table name to what? Same # of chars? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Moi (Ph RIO Biz) [m...@phrio.biz] Sent: Monday, June 13, 2011 12:08 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT If I change the table name it works. I tryed the same query using SqLite3Explorer and it does not give any result ! -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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] A simple SELECT
If I change the table name it works. I tryed the same query using SqLite3Explorer and it does not give any result ! -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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] A simple SELECT
Records are inserted using SqLiteExpertPro. The program only read datas. These tables have one index for the text and an other for the language, like this I have a record for French language (mine) and an other for english language. Many languages can be added like this. Here is the table content in sql script // /* */ /* Test.SQL */ /* */ // /* Begin Transaction */ begin transaction; /* Database [F32-Serveur] */ pragma auto_vacuum=1; pragma default_cache_size=2000; pragma encoding='UTF-8'; pragma page_size=1024; /* Drop table [LibLogInf] */ drop table if exists [LibLogInf]; /* Table structure [LibLogInf] */ CREATE TABLE [LibLogInf] ( [_Index] INTEGER COLLATE BINARY DEFAULT (0), [_Langue] INTEGER COLLATE BINARY DEFAULT (0), [_Libelle] VARCHAR(255) COLLATE BINARY, CONSTRAINT [sqlite_autoindex_LibLogInf_1] PRIMARY KEY ([_Index] COLLATE BINARY ASC, [_Langue])); /* Data [LibLogInf] */ insert into [LibLogInf] values(1, 1, 'La création d''un nouveau serveur dans la table des serveurs hébergés a été abandonnée.'); insert into [LibLogInf] values(1, 2, 'The user canceled the create process for the hosted server table.'); insert into [LibLogInf] values(2, 1, 'La création d''une connexion MySql a été abandonnée'); insert into [LibLogInf] values(2, 2, 'The user canceled the MySql''s connection creation'); insert into [LibLogInf] values(3, 1, 'Station en cours de démarrage.'); insert into [LibLogInf] values(3, 2, 'Station starting'); insert into [LibLogInf] values(4, 1, 'Connexion au serveur MySql réussie'); insert into [LibLogInf] values(4, 2, 'You are now connected to MySql server'); /* Commit Transaction */ commit transaction; My query is : SELECT LTRIM(RTRIM(_Libelle)) FROM LibLogInf WHERE ((_Index = 3) AND (_Langue = 1)) The debug session is at http://mathenay.com/AsmForum/Debug.jpg The full database can be downloaded at http://mathenay.com/AsmForum/F32-Serveur.sql Here is the open database code SqLite_InitPROC__lpszDatabase:LPSTR,__lpSql:Ptr HANDLE INVOKEPathFileExists,__lpszDatabase testeax,eax jnz@InitiOk xoreax,eax stc ret ALIGN16 @InitiOk : INVOKEsqlite3_open,__lpszDatabase,__lpSql testeax,eax jz@Success moveax,__lpSql INVOKEsqlite3_errcode,DWord Ptr [eax] stc ret ALIGN16 @Success : moveax,TRUE clc ret SqLite_InitENDP Thanks for your help Ph RIO -Message d'origine- From: Black, Michael (IS) Sent: Monday, June 13, 2011 6:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ 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] A simple SELECT
Oops...sorry...you're correct...been far too long since I've done assembler. Are we to understand that if you simply give this table a different name it works? That seems to be what you said in your initial email. Are you inserting records in the table in your assembler too? Are you absolutly SURE the data is in the database you are opening in your assembler code? Can you give us a dump of that database? And show in your code where you open it? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 11:28 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
Already made ! -Message d'origine- From: Simon Slavin Sent: Monday, June 13, 2011 6:39 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT On 13 Jun 2011, at 5:36pm, Moi (Ph RIO Biz) wrote: > The second parameter is used when there is a syntax error, this a pointer > of > the starting error text. > I used SqLiteExplorer to read my table and it does not retrieve any data, > only SqLiteExpert can ! This is why its name is "EXPERT" ! > > This is not a code problem, there is a problem into the table. > I copied the datas from the LogLibInf table to LogLibMsg table and now all > the datas from this table cannot be retrieved, but before I added the > datas > I could. So run an integrity check on it. Simon. ___ 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] A simple SELECT
On 13 Jun 2011, at 5:36pm, Moi (Ph RIO Biz) wrote: > The second parameter is used when there is a syntax error, this a pointer of > the starting error text. > I used SqLiteExplorer to read my table and it does not retrieve any data, > only SqLiteExpert can ! This is why its name is "EXPERT" ! > > This is not a code problem, there is a problem into the table. > I copied the datas from the LogLibInf table to LogLibMsg table and now all > the datas from this table cannot be retrieved, but before I added the datas > I could. So run an integrity check on it. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
The second parameter is used when there is a syntax error, this a pointer of the starting error text. I used SqLiteExplorer to read my table and it does not retrieve any data, only SqLiteExpert can ! This is why its name is "EXPERT" ! This is not a code problem, there is a problem into the table. I copied the datas from the LogLibInf table to LogLibMsg table and now all the datas from this table cannot be retrieved, but before I added the datas I could. -Message d'origine- From: Bogdan Ureche Sent: Monday, June 13, 2011 6:28 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche On Mon, Jun 13, 2011 at 10:11 AM, Black, Michael (IS) < michael.bla...@ngc.com> wrote: > You do this: > > INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx > > Then this: > > INVOKE sqlite3_step,_lpSQLStatment > > You probably want > > INVOKE sqlite3_prepare_v2,__hSql,__lpSQLStatement,-1,eax,edx > > At least from what I tell of your logic. > > > > You're not using the same variable fo the statement handle in both calls. > > > > > Michael D. Black > > Senior Scientist > > NG Information Systems > > Advanced Analytics Directorate > > > > > From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on > behalf of Bogdan Ureche [bogdan...@gmail.com] > Sent: Monday, June 13, 2011 9:19 AM > To: General Discussion of SQLite Database > Subject: EXT :Re: [sqlite] A simple SELECT > > Sorry, please disregard my previous message. It seems I experienced a page > refresh issue and I didn't see your full message on the forum. > > Bogdan > > On Mon, Jun 13, 2011 at 9:16 AM, Bogdan Ureche> wrote: > > > > > > > On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz) wrote: > > > >> You are right, I corrected it but this is not the problem. > >> The problem is coming from only ONE table : LibLogInf. > >> I exported it, destroyed it, re-created it and re-entered the datas the > >> problem always exists ! > >> > > > > You mean you don't get any records when running your query? > > > > > >> If I made the same query with just changing the table name there is no > >> problem ! > >> Generaly, I use SqlExpert to create the query, like this I am sure of > the > >> syntax, then I copy the query to my assembler program. > >> I removed the index too. > >> Sincerally, I don't understand. > >> I have the last SqLite version too. > >> I made a vacuum, a repair, I re-indexed all the table, no errors found. > >> Is this table too small ? > >> > >> > > By the way, I hope you realize that anyone reading the messages on the > > forum is totally confused because they are not aware of the assembler > code > > you sent me. If you expect helpful replies from other forum members then > you > > should post the full description of the problem there including the > > assembler code and the expected result. Otherwise we can just continue > the > > discussion by email. > > > > So if I understand correctly, you don't get any records when running > > your > > assembler code, but you do get one record when running the query in > SQLite > > Expert. If this is correct, can you please send me the assembler code > with > > your new corrections? > > > > Bogdan > > > ___ > 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
I think this line is correct as it is: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx The second parameter is __lpszQuery (the text of the query UTF-8 encoded). The statement handle is returned at the address stored in eax and is subsequently used when calling sqlite3_step. Bogdan Ureche On Mon, Jun 13, 2011 at 10:11 AM, Black, Michael (IS) < michael.bla...@ngc.com> wrote: > You do this: > > INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx > > Then this: > > INVOKE sqlite3_step,_lpSQLStatment > > You probably want > > INVOKE sqlite3_prepare_v2,__hSql,__lpSQLStatement,-1,eax,edx > > At least from what I tell of your logic. > > > > You're not using the same variable fo the statement handle in both calls. > > > > > Michael D. Black > > Senior Scientist > > NG Information Systems > > Advanced Analytics Directorate > > > > > From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on > behalf of Bogdan Ureche [bogdan...@gmail.com] > Sent: Monday, June 13, 2011 9:19 AM > To: General Discussion of SQLite Database > Subject: EXT :Re: [sqlite] A simple SELECT > > Sorry, please disregard my previous message. It seems I experienced a page > refresh issue and I didn't see your full message on the forum. > > Bogdan > > On Mon, Jun 13, 2011 at 9:16 AM, Bogdan Ureche> wrote: > > > > > > > On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz) wrote: > > > >> You are right, I corrected it but this is not the problem. > >> The problem is coming from only ONE table : LibLogInf. > >> I exported it, destroyed it, re-created it and re-entered the datas the > >> problem always exists ! > >> > > > > You mean you don't get any records when running your query? > > > > > >> If I made the same query with just changing the table name there is no > >> problem ! > >> Generaly, I use SqlExpert to create the query, like this I am sure of > the > >> syntax, then I copy the query to my assembler program. > >> I removed the index too. > >> Sincerally, I don't understand. > >> I have the last SqLite version too. > >> I made a vacuum, a repair, I re-indexed all the table, no errors found. > >> Is this table too small ? > >> > >> > > By the way, I hope you realize that anyone reading the messages on the > > forum is totally confused because they are not aware of the assembler > code > > you sent me. If you expect helpful replies from other forum members then > you > > should post the full description of the problem there including the > > assembler code and the expected result. Otherwise we can just continue > the > > discussion by email. > > > > So if I understand correctly, you don't get any records when running your > > assembler code, but you do get one record when running the query in > SQLite > > Expert. If this is correct, can you please send me the assembler code > with > > your new corrections? > > > > Bogdan > > > ___ > 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] Implementing busy-waiting on SQLite
Hi Jay, > > Invoke sqlite3_busy_timeout() with a safe timeout for every connection > > to the DB. > > Use IMMEDIATE transactions everywhere. > > > > That's all you have to do. > > Well, yes and no. You still have to deal with the case of > SQLITE_BUSY being returned due to deadlocks. Setting a timeout and > using BEGIN IMMEDIATE will help significantly, but not completely > eliminate this issue. It also means that if an SQLITE_BUSY does slip > through, you have no choice but to rollback the transaction and start > all over. > > For more specifics, see: > > http://sqlite.org/lockingv3.html > http://sqlite.org/c3ref/busy_handler.html <= deadlock info > http://sqlite.org/c3ref/busy_timeout.html I'm not sure you can get deadlocks with immediate transactions. As I understand it, it would defeat the purpose of immediate transactions. Do you have a sample test pseudo-code to show how it can happen? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Version 1.0.73.0
I'm a new user trying *sqlite-dotnet-x86-1007300.exe* at http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki According to SQLite.NET Class Library Documentation bundled with the download and the section "*Installing SQLite Visual Studio Design-Time Support*" I should begin by navigating to *SQLite.Net\bin\Designer *and use installer.exe, but the download has not created a Designer folder nor is there an installer.exe anywhere else in the tree which the download created. * * ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Implementing busy-waiting on SQLite
On Mon, Jun 13, 2011 at 12:40:14PM +0200, Jean-Christophe Deschamps scratched on the wall: > > >As was being discussed yesterday, I have four processes accessing the > >same database file. When they perform an sqlite action, I wish them to > >block if the DB is not available. SQLite does not block if it finds the > >db busy or locked, it returns an error code. > > You can have SQLite do all this by itself, I mean without any extra > code. I've found this is the easiest way to handle the situation. > > Invoke sqlite3_busy_timeout() with a safe timeout for every connection > to the DB. > Use IMMEDIATE transactions everywhere. > > That's all you have to do. Well, yes and no. You still have to deal with the case of SQLITE_BUSY being returned due to deadlocks. Setting a timeout and using BEGIN IMMEDIATE will help significantly, but not completely eliminate this issue. It also means that if an SQLITE_BUSY does slip through, you have no choice but to rollback the transaction and start all over. For more specifics, see: http://sqlite.org/lockingv3.html http://sqlite.org/c3ref/busy_handler.html <= deadlock info http://sqlite.org/c3ref/busy_timeout.html -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
You do this: INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx Then this: INVOKE sqlite3_step,_lpSQLStatment You probably want INVOKE sqlite3_prepare_v2,__hSql,__lpSQLStatement,-1,eax,edx At least from what I tell of your logic. You're not using the same variable fo the statement handle in both calls. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Bogdan Ureche [bogdan...@gmail.com] Sent: Monday, June 13, 2011 9:19 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] A simple SELECT Sorry, please disregard my previous message. It seems I experienced a page refresh issue and I didn't see your full message on the forum. Bogdan On Mon, Jun 13, 2011 at 9:16 AM, Bogdan Urechewrote: > > > On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz) wrote: > >> You are right, I corrected it but this is not the problem. >> The problem is coming from only ONE table : LibLogInf. >> I exported it, destroyed it, re-created it and re-entered the datas the >> problem always exists ! >> > > You mean you don't get any records when running your query? > > >> If I made the same query with just changing the table name there is no >> problem ! >> Generaly, I use SqlExpert to create the query, like this I am sure of the >> syntax, then I copy the query to my assembler program. >> I removed the index too. >> Sincerally, I don't understand. >> I have the last SqLite version too. >> I made a vacuum, a repair, I re-indexed all the table, no errors found. >> Is this table too small ? >> >> > By the way, I hope you realize that anyone reading the messages on the > forum is totally confused because they are not aware of the assembler code > you sent me. If you expect helpful replies from other forum members then you > should post the full description of the problem there including the > assembler code and the expected result. Otherwise we can just continue the > discussion by email. > > So if I understand correctly, you don't get any records when running your > assembler code, but you do get one record when running the query in SQLite > Expert. If this is correct, can you please send me the assembler code with > your new corrections? > > Bogdan > ___ 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] Tcl: $ and @
On Mon, Jun 13, 2011 at 10:33 AM, Edward Brekelbaumwrote: > > package require sqlite3 > sqlite db test.db > db eval {CREATE TABLE t1(x, data) } > db eval {INSERT INTO t1 VALUES('0', 'cheese')} > db eval {INSERT INTO t1 VALUES('four', 'bread')} > > set x 0 > db eval {SELECT * FROM t1 WHERE x=$x} > # returns empty string > Change the schema to: CREATE TABLE t1(x TEXT, data) to clear this problem -- 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] ATTACH DATABASE .tables .schema ?
On Sun, Jun 12, 2011 at 05:29:32PM -0400, ap scratched on the wall: > When I attach additional DB's with ATTACH DATABASE how can I view the schema > or tables in the (non main) databases? > > > > ATTACH DATABASE 'C:\temp\test.db' AS T > > .schema T > > .tables T > > Produce no results. You can't. The CLI dot-commands only show results for the "main" and "temp" databases. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [sqlite-dev] Is there an option to not lock during transaction?
> Hmm... unless read_uncommited is persistant somehow; looks like if I > just don't try to use shared cache it works... I thought I had > disabled cache before alone and still got the same results... read_uncommitted works only when shared_cache is on. To answer your original question: if you disable shared cache, start reading transaction on one connection and start writing transaction on the other connection then you'll be able to read on the first connection database in the state it was before writing transaction. But if your writing transaction will grow too big then it won't be able to proceed until reading transaction is finished. Pavel On Sun, Jun 12, 2011 at 4:11 PM, J Deckerwrote: > If I disable enable_shared_cache then there is a pragme > read_uncommitted that doesn't generate the locks; so non shared, > read_uncommited combination works; > > I tried 'PRAGMA journal_mode=WAL' which says it returns a string; I > assume that if I treat it as a query and sqlite3_step I should get > back this string? sqlite3_step returns SQLITE_DONE not SQLITE_ROW so > it looks like there is no data. I'm currently using version 3.7.5 > amalgamation compiled with vs2010. updated to 3.7.6.3 and still get > no result from the pramga. > > Hmm... unless read_uncommited is persistant somehow; looks like if I > just don't try to use shared cache it works... I thought I had > disabled cache before alone and still got the same results... > > > > On Sun, Jun 12, 2011 at 5:48 AM, Florian Weimer wrote: >> * J. Decker: >> >>> I have enabled sqlite3_enable_shared_cache( 1 ); >>> I have basically two connections to the same database in the same >>> process. One connection is used for selects, the other is used for >>> insert and replace. I can end up with several threads with selects, >>> but the writer is only used in by a single thread[at a time]. >> >> The question seems to belong to the sqlite-users list; Reply-To set. >> >> Have you tried using WAL mode? >> ___ >> sqlite-dev mailing list >> sqlite-...@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-dev >> > ___ > sqlite-dev mailing list > sqlite-...@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-dev > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Tcl: $ and @
Hello, Sorry this took some time to create a test case for... - Original Message > From: Richard Hipp> Sent: Wed, June 8, 2011 7:14:40 AM > Subject: Re: [sqlite] Tcl: $ and @ > > On Wed, Jun 8, 2011 at 6:37 AM, Edward Brekelbaum wrote: >> Hello, >> Let me start by saying using SQLite in Tcl is a real pleasure! >> >> I am having a problem determining when to use $ and when to use @ (and >> maybe I should use :, but I haven't tried it). > > You should always use $, except when you want to insert a blob when you > might consider using @, though $ will likely work in that case too. > > @ should only be used in the rare case when you have a TCL variable that has > both a string representation and a bytearray representation and you want to > use the bytearray representation and insert it as a blob. I have discovered my problem is with comparisons between integer and string. package require sqlite3 sqlite db test.db db eval {CREATE TABLE t1(x, data) } db eval {INSERT INTO t1 VALUES('0', 'cheese')} db eval {INSERT INTO t1 VALUES('four', 'bread')} set x 0 db eval {SELECT * FROM t1 WHERE x=$x} # returns empty string set x four db eval {SELECT * FROM t1 WHERE x=$x} # returns "four bread" Do I need to put types on the columns? Or is casts a better way to go? Thanks! Ned ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
I copied your SqLite3 dll to my program folder and get the same result, that means none. I changed SqLiteExpert to use external library and the query gives the expected result. That means this is not a SqLite bug (I would be suprised to find one), but my assembler code is ok. Could it be a problem into the database ? This is the only way where I can find a problem. If my code was wrong (I used since many months), using others tables would give wrong result, but it works fine with others tables. I have no idea. I submitted the problem to sqlite.org but did not get any answer. -Message d'origine- From: Bogdan Ureche Sent: Monday, June 13, 2011 4:19 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Sorry, please disregard my previous message. It seems I experienced a page refresh issue and I didn't see your full message on the forum. Bogdan On Mon, Jun 13, 2011 at 9:16 AM, Bogdan Urechewrote: > > > On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz) wrote: > >> You are right, I corrected it but this is not the problem. >> The problem is coming from only ONE table : LibLogInf. >> I exported it, destroyed it, re-created it and re-entered the datas the >> problem always exists ! >> > > You mean you don't get any records when running your query? > > >> If I made the same query with just changing the table name there is no >> problem ! >> Generaly, I use SqlExpert to create the query, like this I am sure of the >> syntax, then I copy the query to my assembler program. >> I removed the index too. >> Sincerally, I don't understand. >> I have the last SqLite version too. >> I made a vacuum, a repair, I re-indexed all the table, no errors found. >> Is this table too small ? >> >> > By the way, I hope you realize that anyone reading the messages on the > forum is totally confused because they are not aware of the assembler code > you sent me. If you expect helpful replies from other forum members then > you > should post the full description of the problem there including the > assembler code and the expected result. Otherwise we can just continue the > discussion by email. > > So if I understand correctly, you don't get any records when running your > assembler code, but you do get one record when running the query in SQLite > Expert. If this is correct, can you please send me the assembler code with > your new corrections? > > Bogdan > ___ 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] A simple SELECT
Thanks for your help. The assembler code and the debugging session is on the forum at http://sqliteexpert.com/forum/YaBB.pl?num=1307955468/0 I don't get any data, but just with one table. If I change the table name into the same query, I get a result. I am looking if I can change SqLiteExpert to use external libray to get the problem. -Message d'origine- From: Bogdan Ureche Sent: Monday, June 13, 2011 4:16 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz)wrote: > You are right, I corrected it but this is not the problem. > The problem is coming from only ONE table : LibLogInf. > I exported it, destroyed it, re-created it and re-entered the datas the > problem always exists ! > You mean you don't get any records when running your query? > If I made the same query with just changing the table name there is no > problem ! > Generaly, I use SqlExpert to create the query, like this I am sure of the > syntax, then I copy the query to my assembler program. > I removed the index too. > Sincerally, I don't understand. > I have the last SqLite version too. > I made a vacuum, a repair, I re-indexed all the table, no errors found. > Is this table too small ? > > By the way, I hope you realize that anyone reading the messages on the forum is totally confused because they are not aware of the assembler code you sent me. If you expect helpful replies from other forum members then you should post the full description of the problem there including the assembler code and the expected result. Otherwise we can just continue the discussion by email. So if I understand correctly, you don't get any records when running your assembler code, but you do get one record when running the query in SQLite Expert. If this is correct, can you please send me the assembler code with your new corrections? Bogdan ___ 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] A simple SELECT
Sorry, please disregard my previous message. It seems I experienced a page refresh issue and I didn't see your full message on the forum. Bogdan On Mon, Jun 13, 2011 at 9:16 AM, Bogdan Urechewrote: > > > On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz) wrote: > >> You are right, I corrected it but this is not the problem. >> The problem is coming from only ONE table : LibLogInf. >> I exported it, destroyed it, re-created it and re-entered the datas the >> problem always exists ! >> > > You mean you don't get any records when running your query? > > >> If I made the same query with just changing the table name there is no >> problem ! >> Generaly, I use SqlExpert to create the query, like this I am sure of the >> syntax, then I copy the query to my assembler program. >> I removed the index too. >> Sincerally, I don't understand. >> I have the last SqLite version too. >> I made a vacuum, a repair, I re-indexed all the table, no errors found. >> Is this table too small ? >> >> > By the way, I hope you realize that anyone reading the messages on the > forum is totally confused because they are not aware of the assembler code > you sent me. If you expect helpful replies from other forum members then you > should post the full description of the problem there including the > assembler code and the expected result. Otherwise we can just continue the > discussion by email. > > So if I understand correctly, you don't get any records when running your > assembler code, but you do get one record when running the query in SQLite > Expert. If this is correct, can you please send me the assembler code with > your new corrections? > > Bogdan > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
On Mon, Jun 13, 2011 at 8:44 AM, Moi (Ph RIO Biz)wrote: > You are right, I corrected it but this is not the problem. > The problem is coming from only ONE table : LibLogInf. > I exported it, destroyed it, re-created it and re-entered the datas the > problem always exists ! > You mean you don't get any records when running your query? > If I made the same query with just changing the table name there is no > problem ! > Generaly, I use SqlExpert to create the query, like this I am sure of the > syntax, then I copy the query to my assembler program. > I removed the index too. > Sincerally, I don't understand. > I have the last SqLite version too. > I made a vacuum, a repair, I re-indexed all the table, no errors found. > Is this table too small ? > > By the way, I hope you realize that anyone reading the messages on the forum is totally confused because they are not aware of the assembler code you sent me. If you expect helpful replies from other forum members then you should post the full description of the problem there including the assembler code and the expected result. Otherwise we can just continue the discussion by email. So if I understand correctly, you don't get any records when running your assembler code, but you do get one record when running the query in SQLite Expert. If this is correct, can you please send me the assembler code with your new corrections? Bogdan ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] A simple SELECT
You are right, I corrected it but this is not the problem. The problem is coming from only ONE table : LibLogInf. I exported it, destroyed it, re-created it and re-entered the datas the problem always exists ! If I made the same query with just changing the table name there is no problem ! Generaly, I use SqlExpert to create the query, like this I am sure of the syntax, then I copy the query to my assembler program. I removed the index too. Sincerally, I don't understand. I have the last SqLite version too. I made a vacuum, a repair, I re-indexed all the table, no errors found. Is this table too small ? -Message d'origine- From: Bogdan Ureche Sent: Monday, June 13, 2011 3:30 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] A simple SELECT Hello Philippe, My assembler is a bit rusty, but it looks like you perform the jump to @ReadyToGetData when the return code is either SQLITE_ROW or SQLITE_DONE. You should only attempt to get the data when the return code is SQLITE_ROW. Bogdan On Mon, Jun 13, 2011 at 2:47 AM, Moi (Ph RIO Biz)wrote: > I encounter a big problem with a simple query. Here is the query > > SELECT LTRIM(RTRIM(_Libelle)) FROM LibLogInf WHERE ((_Index = 3) AND > (_Langue = 1)) > > When I run it from SqLiteExpertPro there is no problem and I get my > result. > Into my program I get a NULL pointer. > > The table is defined like this : > > CREATE TABLE "LibLogInf" ( > [_Index] INTEGER COLLATE BINARY DEFAULT (0), > [_Langue] INTEGER COLLATE BINARY DEFAULT (0), > [_Libelle] VARCHAR(255) COLLATE BINARY, > CONSTRAINT [sqlite_autoindex_LibLogInf_1] PRIMARY KEY ([_Index], > [_Langue])); > > Here is the program code in assembly language : > > SqLite_GetText PROC __hSql:HANDLE,__lpszQuery:LPSTR,__lpszResult:LPSTR > LOCAL _lpSQLStatment:DWord > LOCAL _lpszErrorMessage:LPSTR > > lea edx,_lpszErrorMessage > lea eax,_lpSQLStatment > > mov DWord Ptr [edx],0 > mov DWord Ptr [eax],0 > > INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx > > test eax,eax > jz @Success > > xor eax,eax > > stc > ret > > ALIGN 16 > > @Success : > > INVOKE sqlite3_step,_lpSQLStatment > > cmp eax,SQLITE_ROW > je @ReadyToGetData > > cmp eax,SQLITE_DONE > je @ReadyToGetData > > INVOKE sqlite3_finalize,_lpSQLStatment > > mov edx,__lpszResult > xor eax,eax > mov [edx],eax > > stc > ret > > ALIGN 16 > > @ReadyToGetData : > > INVOKE sqlite3_column_text,_lpSQLStatment,0 > cmp __lpszResult,NULL > jne @CopyString > > xor eax,eax > > stc > ret > > ALIGN 16 > > @CopyString : > > test eax,eax > jnz @Copy > > INVOKE sqlite3_finalize,_lpSQLStatment > > mov eax,__lpszResult > mov Byte Ptr [eax],0 > > xor eax,eax > > stc > ret > > ALIGN 16 > > @Copy : > > INVOKE lstrcpy,__lpszResult,eax > INVOKE sqlite3_finalize,_lpSQLStatment > > mov eax,__lpszResult > > clc > ret > SqLite_GetText ENDP > > Can someone help me ? > ___ > 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] A simple SELECT
Hello Philippe, My assembler is a bit rusty, but it looks like you perform the jump to @ReadyToGetData when the return code is either SQLITE_ROW or SQLITE_DONE. You should only attempt to get the data when the return code is SQLITE_ROW. Bogdan On Mon, Jun 13, 2011 at 2:47 AM, Moi (Ph RIO Biz)wrote: > I encounter a big problem with a simple query. Here is the query > > SELECT LTRIM(RTRIM(_Libelle)) FROM LibLogInf WHERE ((_Index = 3) AND > (_Langue = 1)) > > When I run it from SqLiteExpertPro there is no problem and I get my result. > Into my program I get a NULL pointer. > > The table is defined like this : > > CREATE TABLE "LibLogInf" ( > [_Index] INTEGER COLLATE BINARY DEFAULT (0), > [_Langue] INTEGER COLLATE BINARY DEFAULT (0), > [_Libelle] VARCHAR(255) COLLATE BINARY, > CONSTRAINT [sqlite_autoindex_LibLogInf_1] PRIMARY KEY ([_Index], > [_Langue])); > > Here is the program code in assembly language : > > SqLite_GetText PROC __hSql:HANDLE,__lpszQuery:LPSTR,__lpszResult:LPSTR > LOCAL _lpSQLStatment:DWord > LOCAL _lpszErrorMessage:LPSTR > > lea edx,_lpszErrorMessage > lea eax,_lpSQLStatment > > mov DWord Ptr [edx],0 > mov DWord Ptr [eax],0 > > INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx > > test eax,eax > jz @Success > > xor eax,eax > > stc > ret > > ALIGN 16 > > @Success : > > INVOKE sqlite3_step,_lpSQLStatment > > cmp eax,SQLITE_ROW > je @ReadyToGetData > > cmp eax,SQLITE_DONE > je @ReadyToGetData > > INVOKE sqlite3_finalize,_lpSQLStatment > > mov edx,__lpszResult > xor eax,eax > mov [edx],eax > > stc > ret > > ALIGN 16 > > @ReadyToGetData : > > INVOKE sqlite3_column_text,_lpSQLStatment,0 > cmp __lpszResult,NULL > jne @CopyString > > xor eax,eax > > stc > ret > > ALIGN 16 > > @CopyString : > > test eax,eax > jnz @Copy > > INVOKE sqlite3_finalize,_lpSQLStatment > > mov eax,__lpszResult > mov Byte Ptr [eax],0 > > xor eax,eax > > stc > ret > > ALIGN 16 > > @Copy : > > INVOKE lstrcpy,__lpszResult,eax > INVOKE sqlite3_finalize,_lpSQLStatment > > mov eax,__lpszResult > > clc > ret > SqLite_GetText ENDP > > Can someone help me ? > ___ > 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] Patch for fts3_tokenizer.c to compile FTS3 extension as a loadable module
In fts3_tokenizer.c these lines are invalid: #include "sqlite3ext.h" #ifndef SQLITE_CORE SQLITE_EXTENSION_INIT1 #endif Use single line instead: #include "sqlite3.h" -- Best regards, Alexey Pechnikov. http://pechnikov.tel/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] To index or not to index?
Ummm...wouldn't it be a whole lot simpler and faster to have an "Online" table? One id is all that's needed unless you want other info. Then you're just inserting and deleting records and the whole table is "online" at any moment. I don't see any reason why this online status needs to be smashed into any other table which contains everybody. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] To index or not to index?
On Mon, Jun 13, 2011 at 8:46 AM, Richard Hippwrote: > That depends on what fraction of entries have isOnline=1. If isOnline is > rare, then an index might be helpful. But if roughly have the entires have I wondered about that. > It seems to me, though, that you are committing the classic error of > premature optimization. Don't worry about indices at this point. Get you > application running first. You can create and drop indices later, while the > application is live, to see what effect, if any, indices have on > performance. If the application is not running then indexes make little sense. However, I have seen far too many databases going to production without any of the required indexes. Initially the database runs well but gets progressively slower as data is added. The speed reduction is often not noticed as it occurs over time. At some point you reach a data level where you start seeing application errors because the queries are so slow. A lot of application developers do not seem to understand indexes and never add any. Given some thought about how the application uses data, most of the indexes could be thought of before it hits production where you require change requests and testing cycles to add indexes. Regardless, indexes interest me because I have had to add them to production databases so often in the past ... Tim ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] To index or not to index?
On Mon, Jun 13, 2011 at 6:51 AM, Ian Hardinghamwrote: > Hey guys, once again sorry for spamming at the moment. > > This is a simple question. > > My user account table has a field "isOnline INT". This table has, say, > 100,000 rows. > > Every ten seconds I need to compile a list of all users where isOnline is > 1. > > However, people log in and out at a rate of about 10 a second, so I'm > updating the account table 10 times a second. > > The question - should I put an index on isOnline or not? I'm very > worried about such an often-run transaction as logging in and out be as > fast as possible. > That depends on what fraction of entries have isOnline=1. If isOnline is rare, then an index might be helpful. But if roughly have the entires have isOnline=1, then an index will actually slow you down. It seems to me, though, that you are committing the classic error of premature optimization. Don't worry about indices at this point. Get you application running first. You can create and drop indices later, while the application is live, to see what effect, if any, indices have on performance. > > Thanks, > Ian > ___ > 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] To index or not to index?
On Mon, Jun 13, 2011 at 7:51 AM, Ian Hardinghamwrote: > Hey guys, once again sorry for spamming at the moment. > > This is a simple question. > > My user account table has a field "isOnline INT". This table has, say, > 100,000 rows. My understanding is that if the number of possible values in a field are low (two in your case) then there is little benefit to a index (general SQL experience). In your case since the field would be rapidly changing as well I would guess that it would just add overhead. You may be able to use an already indexed field to limit your query before looking at the isOnline field. Something like: select * from users where last_login > 2011-05-30 and isOnline = 1 I would expect that to be fairly fast if your table as a similar field but I don't have much experience with sqlite indexes. Tim ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] To index or not to index?
Hey guys, once again sorry for spamming at the moment. This is a simple question. My user account table has a field "isOnline INT". This table has, say, 100,000 rows. Every ten seconds I need to compile a list of all users where isOnline is 1. However, people log in and out at a rate of about 10 a second, so I'm updating the account table 10 times a second. The question - should I put an index on isOnline or not? I'm very worried about such an often-run transaction as logging in and out be as fast as possible. Thanks, Ian ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] ATTACH DATABASE .tables .schema ?
When I attach additional DB's with ATTACH DATABASE how can I view the schema or tables in the (non main) databases? ATTACH DATABASE 'C:\temp\test.db' AS T .schema T .tables T Produce no results. Thanks. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [sqlite-dev] Is there an option to not lock during transaction?
If I disable enable_shared_cache then there is a pragme read_uncommitted that doesn't generate the locks; so non shared, read_uncommited combination works; I tried 'PRAGMA journal_mode=WAL' which says it returns a string; I assume that if I treat it as a query and sqlite3_step I should get back this string? sqlite3_step returns SQLITE_DONE not SQLITE_ROW so it looks like there is no data. I'm currently using version 3.7.5 amalgamation compiled with vs2010. updated to 3.7.6.3 and still get no result from the pramga. Hmm... unless read_uncommited is persistant somehow; looks like if I just don't try to use shared cache it works... I thought I had disabled cache before alone and still got the same results... On Sun, Jun 12, 2011 at 5:48 AM, Florian Weimerwrote: > * J. Decker: > >> I have enabled sqlite3_enable_shared_cache( 1 ); >> I have basically two connections to the same database in the same >> process. One connection is used for selects, the other is used for >> insert and replace. I can end up with several threads with selects, >> but the writer is only used in by a single thread[at a time]. > > The question seems to belong to the sqlite-users list; Reply-To set. > > Have you tried using WAL mode? > ___ > sqlite-dev mailing list > sqlite-...@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-dev > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Store result of calculation or not
Many thanks Igor. Would this index be enough: CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable (player1,player2) Or do I need the opposite as well? CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable (player2,player1) Why I have two queries: the order of the arguments are different - I am looking for games where player1 is Ian and player2 is Igor, but I also want games where player1 is Igor and player2 is Ian. Cheers, Ian On 12/06/2011 15:28, Igor Tandetnik wrote: > Ian Hardinghamwrote: >> I often need to get the "record" between two people - how many games >> they've won and lost against each other. For reference, the query is at >> the end of the email. Once again, multiturnTable has a million rows, I >> have separate indexes on complete and player1 and player2 (should I >> also add an index on player1, player2?), and I know that I should be >> using ids rather than strings for players! > Yes, an index on (player1, player2) would help. Once you have this index, I > don't think the query would be noticeably slower than selecting from a > dedicated table with running totals (but of course you can, and probably > should, test it). > >> %r = db.query("SELECT count(*) TotalGames, sum(score> 0) >> GamesWonByPlayer1, sum(score< 0) GamesWonByPlayer2, sum(score = 0) >> Draws FROM multiturnTable WHERE complete=1 AND player1 = '?' AND player2 >> = '?'", 0, %username, %opp); >> >> %r2 = db.query("SELECT count(*) TotalGames, sum(score< 0) >> GamesWonByPlayer1, sum(score> 0) GamesWonByPlayer2, sum(score = 0) >> Draws FROM multiturnTable WHERE complete=1 AND player1 = '?' AND player2 >> = '?'", 0, %opp, %username); > Why do you need two? It seems that the only difference between them is the > order of columns in SELECT clause. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Using the same database from four separate applications
Hey guys. I believe it's fine to have four applications open the same database file and use it concurrently. I have a few questions. 1. Do I need to use any special PRAGMA or other option to use this functionality best? 2. Is it possible to (ab)use SQLite to perform as some kind of mutex? Could I go "down" on one table and "up" once I've finished a section of code in my application which I wish to be only run once at any given time? Thanks, Ian ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Implementing busy-waiting on SQLite
>As was being discussed yesterday, I have four processes accessing the >same database file. When they perform an sqlite action, I wish them to >block if the DB is not available. SQLite does not block if it finds the >db busy or locked, it returns an error code. You can have SQLite do all this by itself, I mean without any extra code. I've found this is the easiest way to handle the situation. Invoke sqlite3_busy_timeout() with a safe timeout for every connection to the DB. Use IMMEDIATE transactions everywhere. That's all you have to do. >Any feedback on this (especially with reference to how long I should >sleep for) would be much appreciated. Also, I know this is pretty >horrible - any suggestions for a better approach would also be great. How long should the timeout be? I'd say as long as possible and here's why. After DB connections call sqlite3_busy_timeout() with a nonzero timeout, when an immediate transaction A can't start due to another transaction B locking the DB, SQLite will first retry a few times by itself, then put A to sleep internally for some time after which it will retry until either completion of the transaction or timeout reached. You might say "so I need a timeout a bit larger than the longest transaction". No, things are not that simple. If another transaction C is launched by another process and get blocked like A, it will enter its own cycle of retries but asynchronously with A. When C terminates, you have no clue as to which of A or C will be next to eventually lock the DB. Even if A was first in the "queue", C could very well get active before A, just because SQLite has no queue. That's why your timeout needs to be much longer than the longest possible sequence of the longest transactions. Sounds like A could very well never execute if B, C, D, C, B, .. transactions take precedence every time. Just like in quantum physics, it's possible! In practice you should have a good idea of how long it is reasonable to wait. In most of my (business) applications, I now set 60 (10 minutes). Thus even in the worst case I'm sure that all my trasactions will eventually find their way. That or I'm terribly unlucky! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Implementing busy-waiting on SQLite
Hey guys. As was being discussed yesterday, I have four processes accessing the same database file. When they perform an sqlite action, I wish them to block if the DB is not available. SQLite does not block if it finds the db busy or locked, it returns an error code. I plan on using busy-waiting to implement my block - here is my code: bool tryAgain = true; while (tryAgain) { tryAgain = false; ClearErrorString(); iResult = sqlite3_exec(m_pDatabase, sql, Callback, (void*)pResultSet, _szErrorString); if (iResult == SQLITE_LOCKED || iResult == SQLITE_BUSY) { tryAgain = true; Platform::sleep(10); } } Any feedback on this (especially with reference to how long I should sleep for) would be much appreciated. Also, I know this is pretty horrible - any suggestions for a better approach would also be great. Thanks, Ian ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] A simple SELECT
I encounter a big problem with a simple query. Here is the query SELECT LTRIM(RTRIM(_Libelle)) FROM LibLogInf WHERE ((_Index = 3) AND (_Langue = 1)) When I run it from SqLiteExpertPro there is no problem and I get my result. Into my program I get a NULL pointer. The table is defined like this : CREATE TABLE "LibLogInf" ( [_Index] INTEGER COLLATE BINARY DEFAULT (0), [_Langue] INTEGER COLLATE BINARY DEFAULT (0), [_Libelle] VARCHAR(255) COLLATE BINARY, CONSTRAINT [sqlite_autoindex_LibLogInf_1] PRIMARY KEY ([_Index], [_Langue])); Here is the program code in assembly language : SqLite_GetText PROC __hSql:HANDLE,__lpszQuery:LPSTR,__lpszResult:LPSTR LOCAL _lpSQLStatment:DWord LOCAL _lpszErrorMessage:LPSTR lea edx,_lpszErrorMessage lea eax,_lpSQLStatment mov DWord Ptr [edx],0 mov DWord Ptr [eax],0 INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx test eax,eax jz @Success xor eax,eax stc ret ALIGN 16 @Success : INVOKE sqlite3_step,_lpSQLStatment cmp eax,SQLITE_ROW je @ReadyToGetData cmp eax,SQLITE_DONE je @ReadyToGetData INVOKE sqlite3_finalize,_lpSQLStatment mov edx,__lpszResult xor eax,eax mov [edx],eax stc ret ALIGN 16 @ReadyToGetData : INVOKE sqlite3_column_text,_lpSQLStatment,0 cmp __lpszResult,NULL jne @CopyString xor eax,eax stc ret ALIGN 16 @CopyString : test eax,eax jnz @Copy INVOKE sqlite3_finalize,_lpSQLStatment mov eax,__lpszResult mov Byte Ptr [eax],0 xor eax,eax stc ret ALIGN 16 @Copy : INVOKE lstrcpy,__lpszResult,eax INVOKE sqlite3_finalize,_lpSQLStatment mov eax,__lpszResult clc ret SqLite_GetText ENDP Can someone help me ? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users