I created small app derived from example app provided with sqlite4delphi (v 0.4.4) but am having some problems with it.
Here is a D7 project (just unzip and build it's all there) http://www.chorlya.com/sqlite/pronetApp.zip
Looks like that PRAGMA that is raising error is returning 6 cols instead of 5, but when I change that to 6 then somethig else raises error and we go like that...
So I'm wondering if this is a bug or am I doing something wrong here?
Any help will be greatly appreciated :)
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all - I think you are useing CVS version (since 0.4.4 is rather old... :| )
The problem is that 6 columns in that pragma result is quite new in SQLite. Download new version and check again. Please add information about SQLite engine vesion.
My polisy is to work with last stable vesion of SQLite. I'm not sure what to do with binary (BLOB) support, bit it is future.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just downloaded files from CVS and now I have some problems building it. Please take a look at file build_log.txt included with project files here http://www.chorlya.com/sqlite/pronetAppCVS.zip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm not familiar with D7, I'm using D6 but try this:
in SLDataSet, you'll find
{$IFDEF D6}
Variants,
{$ELSE}
Forms,
{$ENDIF}
just disable or remove IFDEF/ELSE/ENDIF compile directives and try again.
Regards,
padigon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I do have 'INTEGER PRIMARY KEY' field and I chaged that query as you sudgested but its still the same.
I can get the cell in grid to look like it can be edited (it gets highlighted like its selected for editing) but I can't change text in it.
Also, I only have first 4 buttons of DBNavigator available (Move First, Previous, Next and Move Last). Is there any setting in SQLite4Delphi that can affect this (can I change something in SQLite4Delphi to enable editing in Grid)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Sorry for the delay.
I think your problem is in SLOptions, in the current version, you can not use soHideROWIDs or you'll have a read-only dataset.
So, your code must be something like :
SLOptions := [soUseROWIDs, soHideTableName];
If you do not want to show rowid column to your end users, just do it in your dbgrid.
Hope it fixes your problem.
Please note you also need to have a query like "select _rowid_ as _rowid_ from tablename ..." if you have an auto increment column in your table.
Sorry for bad english.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Hope it fixes your problem.
Yes it does, well at least the part we discussed ;)
Now I'm able to edit, add and delete fields in grid, but when I restart the app its same old version of db file in the grid. So what ever I do in dbGrid it does not change db file it self. Is there some other setting in sqlite4delphi that could prevent it from commiting changes to db file?
As soon as I start the app journal file is created and is kept open as long as the app is open. I guess this means that there is a transaction open. Can somebody tell me why is this transaction open all the time and when dose it get commited?
thanks for all your help :)
btw. padigon, your english is excellent ;)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
> when I restart the app its same old version
You have to commit the transation.
You can add a button for it or put someting like
if FSLDB.InTransaction then
FSLDB.Commit;
in the Dataset AfterPost Event.
You may also add
CommitOnExit: Boolean;
to SLDBOptions. This way, if there is a pending transaction when you close your app, it's commited.
> As soon as I start the app journal file is created
Yes, you asked for it ;) here is part of your code :
with SLDBOptions do begin
//BusyTimeOut := 0;
ForceTransaction := True; << Here you're asking for starting a transaction
Mode := fmOpenReadWrite;
end; {with}
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I created small app derived from example app provided with sqlite4delphi (v 0.4.4) but am having some problems with it.
Here is a D7 project (just unzip and build it's all there) http://www.chorlya.com/sqlite/pronetApp.zip
Looks like that PRAGMA that is raising error is returning 6 cols instead of 5, but when I change that to 6 then somethig else raises error and we go like that...
So I'm wondering if this is a bug or am I doing something wrong here?
Any help will be greatly appreciated :)
Thanks
First of all - I think you are useing CVS version (since 0.4.4 is rather old... :| )
The problem is that 6 columns in that pragma result is quite new in SQLite. Download new version and check again. Please add information about SQLite engine vesion.
My polisy is to work with last stable vesion of SQLite. I'm not sure what to do with binary (BLOB) support, bit it is future.
I am using SQLite 2.8.9 and sqlite4delphi 0.4.4 since that is the latest version in "Files" section.
I'll try CVS version and get back to you tomorrow
Texxas,
I just downloaded files from CVS and now I have some problems building it. Please take a look at file build_log.txt included with project files here http://www.chorlya.com/sqlite/pronetAppCVS.zip
Hi,
I'm not familiar with D7, I'm using D6 but try this:
in SLDataSet, you'll find
{$IFDEF D6}
Variants,
{$ELSE}
Forms,
{$ENDIF}
just disable or remove IFDEF/ELSE/ENDIF compile directives and try again.
Regards,
padigon
padigon,
this does get it to comple all right:
{$IFDEF D7}
Variants,
Forms,
{$ENDIF}
but now I have to comment out the "BusyTimeOut := 0;" line because it says its unknown identifier???
Can any one tell me why I'm getting read only dbGrid even if I have its option dgEditing set to true?
Here is the initialization code:
procedure TForm1.FormCreate(Sender: TObject);
begin
FSLDB := TSLDataBase.Create (Self);
with FSLDB do begin
Name := 'DB';
DBName := 'nada.sdb';
with SLDBOptions do begin
//BusyTimeOut := 0;
ForceTransaction := True;
Mode := fmOpenReadWrite;
end; {with}
Open;
end; {with}
FSLDataSet := TSLDataSet.Create (Self);
with FSLDataSet do begin
Name := 'DataSet';
SLOptions := [soUseROWIDs, soHideROWIDs, soHideTableName];
DataBase := FSLDB;
GettingMethod := gmCallback;
SQL.Text := 'SELECT rowid,* FROM preporuke;';
Open;
end; {with}
pronetDS.DataSet := FSLDataSet;
end;
Hi,
I suppose you have a 'INTEGER PRIMARY KEY' field in your database correct ?
If so, try this:
SQL.Text := 'SELECT _ROWID_ AS _ROWID_, * FROM preporuke;';
Yes, I do have 'INTEGER PRIMARY KEY' field and I chaged that query as you sudgested but its still the same.
I can get the cell in grid to look like it can be edited (it gets highlighted like its selected for editing) but I can't change text in it.
Also, I only have first 4 buttons of DBNavigator available (Move First, Previous, Next and Move Last). Is there any setting in SQLite4Delphi that can affect this (can I change something in SQLite4Delphi to enable editing in Grid)?
Hi,
Sorry for the delay.
I think your problem is in SLOptions, in the current version, you can not use soHideROWIDs or you'll have a read-only dataset.
So, your code must be something like :
SLOptions := [soUseROWIDs, soHideTableName];
If you do not want to show rowid column to your end users, just do it in your dbgrid.
Hope it fixes your problem.
Please note you also need to have a query like "select _rowid_ as _rowid_ from tablename ..." if you have an auto increment column in your table.
Sorry for bad english.
padigon,
> Hope it fixes your problem.
Yes it does, well at least the part we discussed ;)
Now I'm able to edit, add and delete fields in grid, but when I restart the app its same old version of db file in the grid. So what ever I do in dbGrid it does not change db file it self. Is there some other setting in sqlite4delphi that could prevent it from commiting changes to db file?
As soon as I start the app journal file is created and is kept open as long as the app is open. I guess this means that there is a transaction open. Can somebody tell me why is this transaction open all the time and when dose it get commited?
thanks for all your help :)
btw. padigon, your english is excellent ;)
Hi,
> when I restart the app its same old version
You have to commit the transation.
You can add a button for it or put someting like
if FSLDB.InTransaction then
FSLDB.Commit;
in the Dataset AfterPost Event.
You may also add
CommitOnExit: Boolean;
to SLDBOptions. This way, if there is a pending transaction when you close your app, it's commited.
> As soon as I start the app journal file is created
Yes, you asked for it ;) here is part of your code :
with SLDBOptions do begin
//BusyTimeOut := 0;
ForceTransaction := True; << Here you're asking for starting a transaction
Mode := fmOpenReadWrite;
end; {with}
Regards.
Sorry, you have to add:
CommitOnExit:= True;
and not
CommitOnExit: Boolean;
Sorry for the mistake. Must go to bed ;)
padigon,
thank you very much, I'm all sorted out now (for now at least :)
Thanks again
Regards