Re: [Lazarus] SQLite Oddity with simple Select clause
On 21.7.2011 2:50, Luiz Americo Pereira Camara wrote: On 20/7/2011 06:04, Tommi Prami wrote: OK, it was my code, and I made some places where I change the SQL it to use .Active := False; .SQL := 'Select * from anywhere'; .Active := True; And it started to work... Weird part is that it worked some times/parts of my program and others not This is because RefetchData requires the field list to be exactly the same: Select x from table Select x, y from table RefetchData Wont work OK, That explains a Lot... -TP- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SQLite Oddity with simple Select clause
On 20/7/2011 06:04, Tommi Prami wrote: OK, it was my code, and I made some places where I change the SQL it to use .Active := False; .SQL := 'Select * from anywhere'; .Active := True; And it started to work... Weird part is that it worked some times/parts of my program and others not This is because RefetchData requires the field list to be exactly the same: Select x from table Select x, y from table RefetchData Wont work Luiz -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SQLite Oddity with simple Select clause
On 20.7.2011 4:34, Luiz Americo Pereira Camara wrote: On 19/7/2011 03:55, Tommi Prami wrote: Hello, I have Day or two old SVN (Trunk) Lazarus with FPC 2.4.4 I have simple select with simple where clause. Nothing fancy. If I run exact same SQL with SQLite Expert Personal I get the rows as expected. I looked my code, and did some debugging into the SQLite code, and this happened. 1. I call the .RefetchData; Then I Step into the Sqlite3DS unit TSqlite3Dataset.BuildLinkedList method. It successfully calls the sqlite3_prepare() etc... This code seems odd to me, but some parts of my App works perfectly so maybe this is just something that it does not seem to be : ... FRecordCount := 0; ColumnCount := sqlite3_column_count(vm); FRowCount := ColumnCount; ... Then comes the : FReturnCode := sqlite3_step(vm); while FReturnCode = SQLITE_ROW do begin loop, Which I think would fetch the Actual data. And first call (Outside the Loop returns ReturnCode 101 (SQLITE_DONEhttp://www.sqlite.org/c3ref/c_abort.html )... What in earth is going on... Any ideas What might be wrong in here? In mY Code or the SqLite Code. I dont know since you did not show your code. But i would bet is in your code. Refetch data is for statement already executed. Try calling Open. Also please ready the tutorials: http://sqlite4fpc.yolasite.com/documentation.php Luiz -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus OK, it was my code, and I made some places where I change the SQL it to use .Active := False; .SQL := 'Select * from anywhere'; .Active := True; And it started to work... Weird part is that it worked some times/parts of my program and others not But anyways... thanks!!! -TP- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SQLite Oddity with simple Select clause
On 19/7/2011 03:55, Tommi Prami wrote: Hello, I have Day or two old SVN (Trunk) Lazarus with FPC 2.4.4 I have simple select with simple where clause. Nothing fancy. If I run exact same SQL with SQLite Expert Personal I get the rows as expected. I looked my code, and did some debugging into the SQLite code, and this happened. 1. I call the .RefetchData; Then I Step into the Sqlite3DS unit TSqlite3Dataset.BuildLinkedList method. It successfully calls the sqlite3_prepare() etc... This code seems odd to me, but some parts of my App works perfectly so maybe this is just something that it does not seem to be : ... FRecordCount := 0; ColumnCount := sqlite3_column_count(vm); FRowCount := ColumnCount; ... Then comes the : FReturnCode := sqlite3_step(vm); while FReturnCode = SQLITE_ROW do begin loop, Which I think would fetch the Actual data. And first call (Outside the Loop returns ReturnCode 101 (SQLITE_DONEhttp://www.sqlite.org/c3ref/c_abort.html )... What in earth is going on... Any ideas What might be wrong in here? In mY Code or the SqLite Code. I dont know since you did not show your code. But i would bet is in your code. Refetch data is for statement already executed. Try calling Open. Also please ready the tutorials: http://sqlite4fpc.yolasite.com/documentation.php Luiz -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] SQLite Oddity with simple Select clause
Hello, I have Day or two old SVN (Trunk) Lazarus with FPC 2.4.4 I have simple select with simple where clause. Nothing fancy. If I run exact same SQL with SQLite Expert Personal I get the rows as expected. I looked my code, and did some debugging into the SQLite code, and this happened. 1. I call the .RefetchData; Then I Step into the Sqlite3DS unit TSqlite3Dataset.BuildLinkedList method. It successfully calls the sqlite3_prepare() etc... This code seems odd to me, but some parts of my App works perfectly so maybe this is just something that it does not seem to be : ... FRecordCount := 0; ColumnCount := sqlite3_column_count(vm); FRowCount := ColumnCount; ... Then comes the : FReturnCode := sqlite3_step(vm); while FReturnCode = SQLITE_ROW do begin loop, Which I think would fetch the Actual data. And first call (Outside the Loop returns ReturnCode 101 (SQLITE_DONEhttp://www.sqlite.org/c3ref/c_abort.html )... What in earth is going on... Any ideas What might be wrong in here? In mY Code or the SqLite Code. I have similar selects in other parts of the Code and even in same File and Same Table and they seem to work... Is there anything I should try??? Any ideas are welcome... -TP- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus