Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-01

SQLDB issues.

13 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Matt Shaffer

So I found this helpful wiki page
http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started with the db components. Great! I (believe) I've followed the tutorial exactly, everything's working until I try to drop a tdbgrid with my datasource onto the form. No data is shown. I double check my sql query, "select * from actions", I click the run button and the data shows, so I was confused as to why it wouldn't show in the grid. I compiled the program anyway, thinking maybe the IDE's auto query executor was broken, but no luck. Still completely blank. I've tried the same thing with a dblistbox as well.

Using Vista with Laz .9.28.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100104/64c36ff5/attachment.html>

Reply by email

Serge Girard via Orange
to Matt Shaffer

Matt Shaffer a ?crit :

Show quoted text 10 lines
So I found this helpful wiki page http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started with the db components. Great! I (believe) I've followed the tutorial exactly, everything's working until I try to drop a tdbgrid with my datasource onto the form. No data is shown. I double check my sql query, "select * from actions", I click the run button and the data shows, so I was confused as to why it wouldn't show in the grid. I compiled the program anyway, thinking maybe the IDE's auto query executor was broken, but no luck. Still completely blank. I've tried the same thing with a dblistbox as well.

Uhm , is your DbGrid/dblistbox linked to a datasource , and the datasource to your Query ?

Reply by email

Matt Shaffer
to Serge Girard via Orange

Yes, it is indeed.

On Tue, Jan 5, 2010 at 1:21 AM, Serge Girard (via Orange) <

Show quoted text 26 lines
wrote: Matt Shaffer a ?crit : So I found this helpful wiki page > http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started with > the db components. Great! I (believe) I've followed the tutorial exactly, > everything's working until I try to drop a tdbgrid with my datasource onto > the form. No data is shown. I double check my sql query, "select * from > actions", I click the run button and the data shows, so I was confused as to > why it wouldn't show in the grid. I compiled the program anyway, thinking > maybe the IDE's auto query executor was broken, but no luck. Still > completely blank. I've tried the same thing with a dblistbox as well. > Uhm , is your DbGrid/dblistbox linked to a datasource , and the datasource to your Query ? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100105/30b1d518/attachment.html>

Reply by email

Michael Van Canneyt
to Matt Shaffer

Can you post the files somewhere ? It should work; it sure does here.

BTW. You can set the 'Active' property to true even in the designer, it should show the data in the grid as well.

Michael.

Matt Shaffer wrote 30 lines
Yes, it is indeed. On Tue, Jan 5, 2010 at 1:21 AM, Serge Girard (via Orange) < > wrote: > Matt Shaffer a ?crit : > > So I found this helpful wiki page >> http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started with >> the db components. Great! I (believe) I've followed the tutorial exactly, >> everything's working until I try to drop a tdbgrid with my datasource onto >> the form. No data is shown. I double check my sql query, "select * from >> actions", I click the run button and the data shows, so I was confused as to >> why it wouldn't show in the grid. I compiled the program anyway, thinking >> maybe the IDE's auto query executor was broken, but no luck. Still >> completely blank. I've tried the same thing with a dblistbox as well. >> > Uhm , is your DbGrid/dblistbox linked to a datasource , and the datasource > to your Query ? > > > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >

Reply by email

Matt Shaffer
to Michael Van Canneyt

It turned out that for some reason restarting the IDE fixed the problem. The data now populates happily.

2010/1/5 Michael Van Canneyt

Show quoted text 55 lines
Can you post the files somewhere ? It should work; it sure does here. BTW. You can set the 'Active' property to true even in the designer, it should show the data in the grid as well. Michael. On Tue, 5 Jan 2010, Matt Shaffer wrote: Yes, it is indeed. > > On Tue, Jan 5, 2010 at 1:21 AM, Serge Girard (via Orange) < > > wrote: > > Matt Shaffer a ?crit : >> >> So I found this helpful wiki page >> >>> http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started >>> with >>> the db components. Great! I (believe) I've followed the tutorial >>> exactly, >>> everything's working until I try to drop a tdbgrid with my datasource >>> onto >>> the form. No data is shown. I double check my sql query, "select * from >>> actions", I click the run button and the data shows, so I was confused >>> as to >>> why it wouldn't show in the grid. I compiled the program anyway, >>> thinking >>> maybe the IDE's auto query executor was broken, but no luck. Still >>> completely blank. I've tried the same thing with a dblistbox as well. >>> >>> Uhm , is your DbGrid/dblistbox linked to a datasource , and the >> datasource >> to your Query ? >> >> >> >> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> >> -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100105/f294d7e3/attachment.html>

Reply by email

Matt Shaffer
to Matt Shaffer

Different issue: Saving to the database. I can't manage to figure this one out.
If I do: query.ApplyUpdates; the database isn't actually written to. If I do: query.Post; query.ApplyUpdates; it says that it's not set for editing.

So, where I'm having trouble is where to set the state? I've
done query.State := dsEdit; but that understandably yells at me..
Matt Shaffer wrote 61 lines
It turned out that for some reason restarting the IDE fixed the problem. The data now populates happily. 2010/1/5 Michael Van Canneyt > Can you post the files somewhere ? It should work; it sure does here. > > BTW. You can set the 'Active' property to true even in the designer, > it should show the data in the grid as well. > > Michael. > > > On Tue, 5 Jan 2010, Matt Shaffer wrote: > > Yes, it is indeed. >> >> On Tue, Jan 5, 2010 at 1:21 AM, Serge Girard (via Orange) < >> > wrote: >> >> Matt Shaffer a ?crit : >>> >>> So I found this helpful wiki page >>> >>>> http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started >>>> with >>>> the db components. Great! I (believe) I've followed the tutorial >>>> exactly, >>>> everything's working until I try to drop a tdbgrid with my datasource >>>> onto >>>> the form. No data is shown. I double check my sql query, "select * from >>>> actions", I click the run button and the data shows, so I was confused >>>> as to >>>> why it wouldn't show in the grid. I compiled the program anyway, >>>> thinking >>>> maybe the IDE's auto query executor was broken, but no luck. Still >>>> completely blank. I've tried the same thing with a dblistbox as well. >>>> >>>> Uhm , is your DbGrid/dblistbox linked to a datasource , and the >>> datasource >>> to your Query ? >>> >>> >>> >>> >>> -- >>> _______________________________________________ >>> Lazarus mailing list >>> >>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >>> >>> > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100105/a780c374/attachment.html>

Reply by email

Matt Shaffer
to Matt Shaffer

I thought I would just do a little update. I've been successfully able to write now, BUT, I don't believe the SQLdb components were really keeping SQLite in mind (the db I'm using). You see, Lazarus opens a connection to the SQLite database, preventing my app that's running (for debugging purposes) from writing. So I have to build the app, close Lazarus, then run my app... Should I file a bug report for this?

Matt Shaffer wrote 74 lines
Different issue: Saving to the database. I can't manage to figure this one out. If I do: query.ApplyUpdates; the database isn't actually written to. If I do: query.Post; query.ApplyUpdates; it says that it's not set for editing. So, where I'm having trouble is where to set the state? I've done query.State := dsEdit; but that understandably yells at me.. On Tue, Jan 5, 2010 at 3:49 PM, Matt Shaffer wrote: > It turned out that for some reason restarting the IDE fixed the problem. > The data now populates happily. > > 2010/1/5 Michael Van Canneyt > > >> Can you post the files somewhere ? It should work; it sure does here. >> >> BTW. You can set the 'Active' property to true even in the designer, >> it should show the data in the grid as well. >> >> Michael. >> >> >> On Tue, 5 Jan 2010, Matt Shaffer wrote: >> >> Yes, it is indeed. >>> >>> On Tue, Jan 5, 2010 at 1:21 AM, Serge Girard (via Orange) < >>> > wrote: >>> >>> Matt Shaffer a ?crit : >>>> >>>> So I found this helpful wiki page >>>> >>>>> http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started >>>>> with >>>>> the db components. Great! I (believe) I've followed the tutorial >>>>> exactly, >>>>> everything's working until I try to drop a tdbgrid with my datasource >>>>> onto >>>>> the form. No data is shown. I double check my sql query, "select * >>>>> from >>>>> actions", I click the run button and the data shows, so I was confused >>>>> as to >>>>> why it wouldn't show in the grid. I compiled the program anyway, >>>>> thinking >>>>> maybe the IDE's auto query executor was broken, but no luck. Still >>>>> completely blank. I've tried the same thing with a dblistbox as well. >>>>> >>>>> Uhm , is your DbGrid/dblistbox linked to a datasource , and the >>>> datasource >>>> to your Query ? >>>> >>>> >>>> >>>> >>>> -- >>>> _______________________________________________ >>>> Lazarus mailing list >>>> >>>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >>>> >>>> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> >> >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100105/29fe09b3/attachment.html>

Reply by email

Vincent Snijders
to Matt Shaffer
Matt Shaffer wrote 7 lines
I thought I would just do a little update. I've been successfully able to write now, BUT, I don't believe the SQLdb components were really keeping SQLite in mind (the db I'm using). You see, Lazarus opens a connection to the SQLite database, preventing my app that's running (for debugging purposes) from writing. So I have to build the app, close Lazarus, then run my app... Should I file a bug report for this?

Maybe you have to close the designer form with the grid, because that is keeping a open transaction?

Vincent

Reply by email

Michael Van Canneyt
to Matt Shaffer: I thought I would just do a little update. I've been successfully able to write now, BUT,…
Matt Shaffer wrote
I thought I would just do a little update. I've been successfully able to write now, BUT, I don't believe the SQLdb components were really keeping SQLite in mind (the db I'm using). You see, Lazarus opens a connection to the SQLite database, preventing my app that's running (for debugging purposes) from writing. So I have to build the app, close Lazarus, then run my app... Should I file a bug report for this?

No.

It is a limitation of sqlite. Make sure that the sqlite connection in the IDE is closed prior to running the app, and set it to connected in the application code. (you'll have to do this anyway for production systems).

Michael.

Show quoted text 64 lines
On Tue, Jan 5, 2010 at 8:02 PM, Matt Shaffer wrote: Different issue: Saving to the database. I can't manage to figure this one out.If I do:?query.ApplyUpdates; the database isn't actually written to. If I do: query.Post; query.ApplyUpdates; it says that it's not set for editing. So, where I'm having trouble is where to set the state? I've done?query.State := dsEdit; but that understandably yells at me.. On Tue, Jan 5, 2010 at 3:49 PM, Matt Shaffer wrote: It turned out that for some reason restarting the IDE fixed the problem. The data now populates happily. 2010/1/5 Michael Van Canneyt Can you post the files somewhere ? It should work; it sure does here. BTW. You can set the 'Active' property to true even in the designer, it should show the data in the grid as well. Michael. On Tue, 5 Jan 2010, Matt Shaffer wrote: Yes, it is indeed. On Tue, Jan 5, 2010 at 1:21 AM, Serge Girard (via Orange) < > wrote: Matt Shaffer a ?crit : ?So I found this helpful wiki page http://wiki.lazarus.freepascal.org/SQLdb_Package for getting started with the db components. Great! I (believe) I've followed the tutorial exactly, everything's working until I try to drop a tdbgrid with my datasource onto the form. No data is shown. I double check my sql query, "select * from actions", I click the run button and the data shows, so I was confused as to why it wouldn't show in the grid. I compiled the program anyway, thinking maybe the IDE's auto query executor was broken, but no luck. Still completely blank. I've tried the same thing with a dblistbox as well. Uhm , is your DbGrid/dblistbox linked to a datasource , and the datasource to your Query ? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Luca Olivetti
to Michael Van Canneyt

En/na Michael Van Canneyt ha escrit:

Show quoted text 16 lines
On Tue, 5 Jan 2010, Matt Shaffer wrote: > I thought I would just do a little update. I've been successfully able > to write now, BUT, I don't believe the SQLdb components were really > keeping SQLite in mind (the > db I'm using). You see, Lazarus opens a connection to the SQLite > database, preventing my app that's running (for debugging purposes) > from writing. So I have to build > the app, close Lazarus, then run my app... Should I file a bug report > for this? No. It is a limitation of sqlite.

Then why zeosdbo has no such issue?

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 (Ext.133) Fax +34 93 5883007

Reply by email

Martin Schreiber
to Luca Olivetti
Luca Olivetti wrote 5 lines
> > It is a limitation of sqlite. Then why zeosdbo has no such issue?

Sqlite3 uses filelocks for transactions and ZEOS works without transactions by default AFAIK.
MSEgui tsqlite3connection has the options property members slo_transactions and slo_designtransactions which are false by default. So normally there will be no transaction opened at design time.
Another problem with Sqlite3 is that a not finished fetch operation holds an implicit lock so reading recorddata in chunks by TSQLQuery.PacketRecords -1 can be problematic.

Martin

Reply by email

Luiz Americo Pereira Camara
to Luca Olivetti: En/na Michael Van Canneyt ha escrit: Then why zeosdbo has no such issue? Bye Luca Olivetti
Luca Olivetti wrote 19 lines
En/na Michael Van Canneyt ha escrit: > > > On Tue, 5 Jan 2010, Matt Shaffer wrote: > >> I thought I would just do a little update. I've been successfully >> able to write now, BUT, I don't believe the SQLdb components were >> really keeping SQLite in mind (the >> db I'm using). You see, Lazarus opens a connection to the SQLite >> database, preventing my app that's running (for debugging purposes) >> from writing. So I have to build >> the app, close Lazarus, then run my app... Should I file a bug >> report for this? > > No. > > It is a limitation of sqlite. Then why zeosdbo has no such issue?

It seems that Sqldb is keeping an transaction open even for reading (Select) the data. I don't know in other DB, but in sqlite is not necessary the transaction to read data.

It's possible to have multiple connections reading the data at the same time. Write blocks other connections from accessing the db.

Luiz

Reply by email

Matt Shaffer
to Luiz Americo Pereira Camara

I noticed the same thing as Luiz. If I am not currently editing the database through the IDE, it should not be keeping a lock on the DB (which is why I wanted to submit a bug report). It's perfectly fine for it to keep it open for reading 24/7, though.

On Fri, Jan 8, 2010 at 5:24 AM, Luiz Americo Pereira Camara <

Show quoted text 44 lines
wrote: Luca Olivetti escreveu: En/na Michael Van Canneyt ha escrit: > >> >> >> On Tue, 5 Jan 2010, Matt Shaffer wrote: >> >> I thought I would just do a little update. I've been successfully able >>> to write now, BUT, I don't believe the SQLdb components were really keeping >>> SQLite in mind (the >>> db I'm using). You see, Lazarus opens a connection to the SQLite >>> database, preventing my app that's running (for debugging purposes) from >>> writing. So I have to build >>> the app, close Lazarus, then run my app... Should I file a bug report >>> for this? >>> >> >> No. >> >> It is a limitation of sqlite. >> > > Then why zeosdbo has no such issue? > It seems that Sqldb is keeping an transaction open even for reading (Select) the data. I don't know in other DB, but in sqlite is not necessary the transaction to read data. It's possible to have multiple connections reading the data at the same time. Write blocks other connections from accessing the db. Luiz -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100108/2ac525ef/attachment.html>

Reply by email