Did you ever get an answer to this question? I am having a similar difficulty, and information on ApplyUpdates is infuriatingly hard to find.
Mailing lists / lazarus / 2008-06
Advice about creating database-aware application with Lazarus
36 messages · 8 people · –
- HHoward Lee Harkness 16
- FFelipe Monteiro de Carvalho 10
- JJoost van der Sluis 4
- JJohn 2
- JJesus Reyes 1
- LLuca Olivetti 1
- +2 more
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Op zaterdag 14-06-2008 om 19:16 uur [tijdzone -0500], schreef Howard Lee Harkness:
Did you ever get an answer to this question? I am having a similar difficulty, and information on ApplyUpdates is infuriatingly hard to find.
You can find this problem in the bug-tracker. You can work around it with 'TDataset.DisableControls' and 'TDataset.Enablecontrols' around the applyupdates call. Or try fpc 2.2.2rc1 or any later version.
Joost.
Show quoted text 105 lines
Guess I'll try 2.2.2rc1, but it looks like in order to do that, I have to install Lazarus 0.9.25 beta.
Seems to me that I should have been able to get a program as trivial as the one I am trying to write running with stuff that was available two years ago. Kinda makes me wonder if I'm just trying to use the wrong tools.
Joost van der Sluis wrote 124 lines
2008/6/21 Howard Lee Harkness :
Guess I'll try 2.2.2rc1, but it looks like in order to do that, I have to install Lazarus 0.9.25 beta.
Nothing should prevent you from using Lazarus 0.9.24 with FPC 2.2.2rc1
Guess I'll try 2.2.2rc1, but it looks like in order to do that, I have to install Lazarus…
Lazarus 9.25 beta (with FPC 2.2.2) does not appear to be ready for prime time. The first thing it did on my system was crash when I tried to close a project that partially loaded and quit due to not finding the ZeosLib components. Then, it failed to rebuild the IDE when I tried to install ZeosLib.
Guess I need to wait for the real release.
On Sat, Jun 21, 2008 at 5:05 PM, Howard Lee Harkness <
Show quoted text 144 lines
2008/6/21 Howard Lee Harkness : Nothing should prevent you from using Lazarus 0.9.24 with…
Hmmm... I couldn't seem to find everything for the environmental setups in 9.24, but I guess I can try again.
On Sat, Jun 21, 2008 at 5:15 PM, Felipe Monteiro de Carvalho <
Show quoted text 15 lines
2008/6/21 Howard Lee Harkness : Nothing should prevent you from using Lazarus 0.9.24 with…
I think I have spent about 10 times the effort that I thought it would take to write the trivial application just trying to configure Lazarus.
On Sat, Jun 21, 2008 at 5:15 PM, Felipe Monteiro de Carvalho <
Show quoted text 15 lines
Lazarus 9.25 beta (with FPC 2.2.2) does not appear to be ready for prime time. The first…
2008/6/21 Howard Lee Harkness :
Show quoted text 5 lines
You have had a very bad timing =)
Marc commited today a very large change in the bitmap subsystem which made the Lazarus IDE stop working. I hope this will be fixed in the next days.
From the last months until yesterday Lazarus 0.9.25 was working
perfectly (at least for me and on Windows, Windows CE, Linux-Gtk2 and Mac OS X native Carbon).
Anyway, under development version are like this. That's why I hope to see FPC 2.2.2 release as soon as possible so that we can also release Lazarus 0.9.26 as soon as possible.
Hmmm... I couldn't seem to find everything for the environmental setups in 9.24, but I…
I think I have spent about 10 times the effort that I thought it would take to write the trivial application just trying to configure Lazarus.
2008/6/21 Howard Lee Harkness :
Hmmm... I couldn't seem to find everything for the environmental setups in 9.24, but I guess I can try again.
You should do the following to set Lazarus 0.9.24 with FPC 2.2.2rc1
I will supposed you used the standard windows installer which also installs FPC for Lazarus 0.9.24 and you used a stand alone FPC only installer for FPC 2.2.2rc1
Go to the Environment options dialog and change the compiler and make paths to the 2.2.2rc1 compiler
Go to Tools --> Configure build lazarus
Go to the advanced page
Set everything to None and LCL to Clean+Build.
Click the Build button.
If LCL compiled successfully you are all set.
As you see, you don't need to rebuild the entire IDE, just LCL and this is good, because then you don't risk the stability of your IDE and it is quicker to just build LCL.
I think I have spent about 10 times the effort that I thought it would take to write the…
Looks like all of the 2.2.2rc1 sources are zipped up separately by unit. Any hints about where/how to put them in the directory structure so that Lazarus can find them in the environment settings????
On Sat, Jun 21, 2008 at 5:33 PM, Howard Lee Harkness <
Show quoted text 28 lines
2008/6/21 Howard Lee Harkness :
Looks like all of the 2.2.2rc1 sources are zipped up separately by unit. Any hints about where/how to put them in the directory structure so that Lazarus can find them in the environment settings????
Just download the installer from here and install it:
ftp://ftp.freepascal.org/fpc/beta/2.2.2rc1/i386-win32
You probably won't need to download the source. You can leave Lazarus using the source code from Free Pascal 2.2.0 which is installed with it. I do this and never had problems. The source is only used for some code completion, so the changes in the new version can probably be ignored.
You don't have to install FPC to anywhere special, just use a directory without spaces and inform where the fpc.exe executable is in the Environmental Options.
2008/6/21 Howard Lee Harkness : You should do the following to set Lazarus 0.9.24 with…
At this step: Go to Tools --> Configure build lazarus I get the error: Fatal: Can't find unit system used by AllLCLUnits
On Sat, Jun 21, 2008 at 5:48 PM, Felipe Monteiro de Carvalho <
Show quoted text 41 lines
2008/6/21 Howard Lee Harkness :
At this step: Go to Tools --> Configure build lazarus I get the error: Fatal: Can't find unit system used by AllLCLUnits
Where did you install fpc 2.2.2rc1?
What did you put in the Environment options for the compiler and make?
2008/6/21 Howard Lee Harkness : Just download the installer from here and install it:…
At this step: Go to Tools --> Configure build lazarus I get the error: Fatal: Can't find unit system used by AllLCLUnits
At least I was able to get 2.2.0 to restore. However, I'm back where I was before: A trivial 1-hour project has taken nearly 20 hours over a period of 3 weeks, and I haven't got anything to show for that effort. I'm tired of this.
All I want to do is make a little demo project that accesses a MySQL 5.0 database, and can insert, edit, and delete rows in a table. That's something I have done in less than 30 minutes using Delphi 3.0 over a decade ago (including the time it took to boot the computer). All I'm getting from Lazarus is a feeling that I'm too stupid to write database software anymore.
I see you have written another reply. I installed FPC 2.2.2rc1 in c:\lazarus\fpc\2.2.2rc1
I pointed the compiler environment settings as follows:
compiler: C:\lazarus\fpc\2.2.2rc1\bin\i386-win32\fpc.exe make: C:\lazarus\fpc\2.2.2rc1\bin\i386-win32\make.exe
At this point, it won't do anything useful at all, including the LCL rebuild, so I've gone back to 2.2.0, which at least seems to work for trivial non-database programs. I have also exhausted all of the time I had to work on this for the week, so I think I'll stop by Fry's on the way home from work sometime next week and buy a copy of Visual Basic. Bet it won't take me 20 hours to write a trivial DB app in VB.
On Sat, Jun 21, 2008 at 5:12 PM, Felipe Monteiro de Carvalho <
Show quoted text 30 lines
2008/6/21 Howard Lee Harkness :
At this step: Go to Tools --> Configure build lazarus I get the error: Fatal: Can't find unit system used by AllLCLUnits
I just tested here and it works for me. I don't know what is different. Maybe you unchecked "create default configuration file" in the fpc installer.
Are you using Windows XP too?
At least I was able to get 2.2.0 to restore. However, I'm back where I was before: A trivial 1-hour project has taken nearly 20 hours over a period of 3 weeks, and I haven't got anything to show for that effort. I'm tired of this.
If you focus in the positive side, you learned a lot about how to configure lazarus =)
Also, the original answer by Joost was:
"You can find this problem in the bug-tracker. You can work around it with 'TDataset.DisableControls' and 'TDataset.Enablecontrols' around the applyupdates call. Or try fpc 2.2.2rc1 or any later version."
So instead of trying to configure Lazarus with FPC 2.2.2rc1 you coul just have used TDataset.DisableControls ...
to work on this for the week, so I think I'll stop by Fry's on the way home from work sometime next week and buy a copy of Visual Basic. Bet it won't take me 20 hours to write a trivial DB app in VB.
It surely won't be cross-platform, nor will it support unicode =P Also it's probably a bad choice, as VB will probably wish that you use Access instead of MySQL (unless you don't care about which database to use).
But I do agree that Lazarus needs to improve when it comes to developing database aware applications.
With the money from VB you could pay someone to fix all problems with lazarus database apps connecting to mysql =P
I would go as far as saying that the only case in which I would recommend for someone to use Delphi instead of Lazarus is if he is developing Windows-only data-aware applications and he doesn't need any of the other features of Lazarus (like being open source, supporting unicode, etc).
Yes, I'm using XP Pro SP2.
Knowing how to configure Lazarus is not useful unless I can write a program that works using it.
I went back and checked to see if maybe I did the FPC installation without the default configuration file. Nope. It is checked by default, and I didn't change it. This time, I went through the readme and verified that I could build and run the Hello, World program. I was careful to install it directly to the directory where Lazarus would find it.
This time, I got a different error on the LCL build: Error: Identifier not found "LowerCaseTable".
That's it for tonight. Since my time is worth more than minimum wage, Lazarus is getting too expensive. I don't like admitting to defeat, but this one has defeated me.
I think I might have an old copy of D2, D3 or D4 somewhere... and maybe even a copy of D6. I know that I can make any of those do what I want, even if I have to go back to using the old BDE.
No, I don't care what database is underneath. No, I don't care if it's cross-platform. No, I don't even care what language it's written in (I am familiar with over a dozen), as long as I can make the app work. And if it can't be made to work, it doesn't matter what the database is, or whether it's cross-platform, or even what the language is. The ONLY thing that matters to a working programmer is whether the stuff he writes WORKS.
On Sat, Jun 21, 2008 at 7:26 PM, Felipe Monteiro de Carvalho <
Show quoted text 60 lines
Well, I couldn't just give up, I had to try ONE MORE THING.
So, I put in the following code:
procedure TForm1.DBNavigator1Click(Sender: TObject; Button:
TDBNavButtonType);
begin
case Button of
nbPost: begin
SQLQuery1.DisableControls;
SQLQuery1.ApplyUpdates;
SQLQuery1.EnableControls;
end;
nbRefresh: begin
SQLQuery1.Close;
SQLQuery1.Open;
end;
end;
end;At that point, I could insert a record, but not edit or delete a record. So, I tried the following:
procedure TForm1.DBNavigator1Click(Sender: TObject; Button:
TDBNavButtonType);
begin
case Button of
nbDelete,
nbPost: begin
SQLQuery1.DisableControls;
SQLQuery1.ApplyUpdates;
SQLQuery1.EnableControls;
end;
nbRefresh: begin
SQLQuery1.Close;
SQLQuery1.Open;
end;
end;
end;Lo, and behold! I could now insert a record, and delete a record!!! Elated, I tried the following:
procedure TForm1.DBNavigator1Click(Sender: TObject; Button:
TDBNavButtonType);
begin
case Button of
nbDelete, nbEdit,
nbPost: begin
SQLQuery1.DisableControls;
SQLQuery1.ApplyUpdates;
SQLQuery1.EnableControls;
end;
nbRefresh: begin
SQLQuery1.Close;
SQLQuery1.Open;
end;
end;
end;Alas, no joy. I can insert and delete a record, but I still can't edit a record.
I don't know if I can send attachments to this list, but if I can, the source for the trivial application is attached.
The schema for the table I'm using is:
CREATE TABLE IF NOT EXISTS ZIPCODE
(
ZIPID INT NOT NULL AUTO_INCREMENT,
ZIP VARCHAR(5) NOT NULL,
ZIPEXT VARCHAR(4),
CITY VARCHAR(40),
STATE VARCHAR(2),
PRIMARY KEY(ZIPID)
);
INSERT INTO ZIPCODE (ZIP,ZIPEXT,CITY,STATE) VALUES ('01814',NULL,'Lawrence','MA')
,('13502',NULL,'Utica','NY')
,('22030',NULL,'Fairfax','VA')
,('27030',NULL,'Mt. Airy','NC')
,('27103',NULL,'Winston-Salem','NC')
,('27104',NULL,'Winston-salem','NC')
,('27106',NULL,'Winston-Salem','NC')
,('30084',NULL,'Tucker','GA')
;
On Sat, Jun 21, 2008 at 7:35 PM, Howard Lee Harkness <
Show quoted text 101 lines
Yes, I'm using XP Pro SP2. Knowing how to configure Lazarus is not useful unless I can…
2008/6/21 Howard Lee Harkness :
No, I don't care what database is underneath.
Well .... so I think that you made a bad choice starting with a more complex dataset (MySQL) with a known problem. I had supposed that you needed to use MySQL.
I would recommend that you start with TDBF instead. I'm 100% sure this one works.
http://wiki.lazarus.freepascal.org/Lazarus_Tdbf_Tutorial
And if you use TDBF you don't need to update FPC. You could teorically use FPC 1.9 or even older
And TDBF comes pre-installed by default.
I think this is a question of maturity of the datasets.
TDBF matured a long time ago in FPC 2.0
The MySQL dataset still hasn't matured, so there are still bugs.
Guess I'll try 2.2.2rc1, but it looks like in order to do that, I have to install Lazarus…
Howard Lee Harkness wrote 7 lines
There is also MSEide+MSEgui which is well suited to build Free Pascal database applications on Linux and win32. It is currently on revision 1.8rc1 and used in production. It works with FPC 2.2 and 2.2.2rc1.
http://sourceforge.net/projects/mseide-msegui
Installation guidelines:
http://homepage.bluewin.ch/msegui/
Newsgroup (NNTP):
news://news.grid-sky.com/public.mseide-msegui.talk
Martin
2008/6/21 Howard Lee Harkness : Nothing should prevent you from using Lazarus 0.9.24 with…
Felipe Monteiro de Carvalho wrote 6 lines
I did not test it, but I think you cannot compiler an older Lazarus with a newer fpc version. See the svn logs since Lazarus 0.9.24 for commit messages like 'fixed compilation for fpc 2.3.1'. If those changes in fpc 2.3.1 are merged to fpc 2.2.1, which is not unreasonable, that you will need those fixes made in Lazarus 0.9.25 to compile with fpc 2.2.2rc1.
Vincent
Guess I'll try 2.2.2rc1, but it looks like in order to do that, I have to install Lazarus…
Op zaterdag 21-06-2008 om 17:05 uur [tijdzone -0500], schreef Howard Lee Harkness:
Show quoted text 5 lines
Yes, you are. You are using MySQL for a non-web-based application. ;)
Joost.
Well, I couldn't just give up, I had to try ONE MORE THING. So, I put in the following…
Op zaterdag 21-06-2008 om 20:06 uur [tijdzone -0600], schreef Howard Lee Harkness:
Show quoted text 22 lines
My question is why you did DBNavigator1Click at all? On nbPost, it should call - first of all - SQLQuery1.Post. You forgot that. (I guess that that's your edit-problem) Normally, if you don't implement DBNavigator1Click it will do that automatically.
If you want the changed to be committed to the underlying database immediately (Is that a good design?) then you can add the disable-apply-enable sequence to the SQLQuery1.AfterScroll event. Then you don't need the DBNavigator1Click-hack.
Joost
Joost van der Sluis wrote 6 lines
in the database. When I tried not implementing the DBNavigator1Click, the program appeared to be working, but the database never actually changed.
I also tried putting the ApplyUpdates in the FormClose event, and that didn't do anything, either.
You are the one that mentioned that I needed to call ApplyUpdates (and later, disable and enable controls). Could you please take a look at the code I posted and SHOW ME what I need to do to make this work?
Oh, and I *don't* want to applyupdates on the AfterScroll event unless that is the only choice.
On Sun, Jun 22, 2008 at 2:22 PM, Howard Lee Harkness <
Show quoted text 24 lines
2008/6/21 Howard Lee Harkness : Well .... so I think that you made a bad choice starting…
Hmmm... looks like TDBF doesn't have any way to load my tables without writing yet another program. And dBase tables? I think I will check out SQLite first. I picked on MySQL by recommendation from some folks telling me how it was a mature db with all of the features I was used to from working with Oracle. It was certainly easier to set up than FireBird -- and better documented.
I suppose also that I could write all of the insert/delete/edit code, but I didn't have to do that in Delphi 10 years ago. The DbNavigator just worked with no additional Sat, Jun 21, 2008 at 9:21 PM, Felipe Monteiro de Carvalho <
Show quoted text 21 lines
in the database. When I tried not implementing the DBNavigator1Click, the program…
Ok I added the Post call (for some reason, I thought the DbNavigator did that automatically, but apparently not if you implement the click handler. So now I have:
procedure TForm1.DBNavigator1Click(Sender: TObject; Button:
TDBNavButtonType);
begin
case Button of
nbEdit: begin
SQLQuery1.Edit;
end;
nbPost: begin
SQLQuery1.Post;
SQLQuery1.DisableControls;
SQLQuery1.ApplyUpdates;
SQLQuery1.EnableControls;
end;
nbRefresh: begin
SQLQuery1.Close;
SQLQuery1.Open;
end;
end;
end;Inch by incredible inch. I can now insert and delete, but edit still does nothing, even though it appears to until I stop and restart the program.
On Sun, Jun 22, 2008 at 1:22 PM, Howard Lee Harkness <
Show quoted text 24 lines
in the database. When I tried not implementing the DBNavigator1Click, the program…
Show quoted text 14 lines
Most TDataset components have one OnAfterPost event, if the intent is commit changes as soon as they get posted this might help.
Jesus Reyes A.
____________________________________________________________________________________ Yahoo! Deportes Beta
?No te pierdas lo ?ltimo sobre el torneo clausura 2008! Ent?rate aqu? http://deportes.yahoo.com
Hmmm... looks like TDBF doesn't have any way to load my tables without writing yet…
Howard Lee Harkness wrote 11 lines
If you come from an Oracle background, consider Postgresql. I had an Oracle background too, and felt immediately at home with PG. On the other hand, dBase tables work fine for simple, single user tables, with less fuss than SQL. It depends on what you are trying to do.
I admit I always use an external tool to build the tables. In postresql, pgadmin; for dbase tables an old copy of DBase it self (yes, I have one!) or DBD from Dephi.
Also, since I am writing, in looking through your last example or two, there doesn't seem to be any transaction.commit ? This is needed in PG, I presume in MySQL as well.
My basic test database program had a PQConnection, SQLTranaction, SQLQuery (select * from ...), and the usual set of data-aware controls - grid, navigator, edit fields, etc - connected to the query, all set up at design time as you would in Delphi. The only code was in a 'commit' button:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
SQLQuery1.ApplyUpdates;
SQLTransaction1.CommitRetaining;
end;cheers,
John Sunderland
Interesting... I tried your approach with MySQL, and I still could not get edit to work. It appears to work in the grid, but stopping and re-starting the program showed that nothing actually got edited.
Looks like I need to take your advice and try Postgresql. However, I won't have any significant time to work on this project until next Sunday. Bummer. I still have the vague suspicion that the problem is not with MySQL, but with the TNavigator component. But if MySQL simply won't work with Lazarus, it just won't work, and I don't need to spend the rest of the year running into the same brick wall.
This is not the only project I have in mind, of course. It's just the first step in a much larger project, for which I would like to make some money. So the real solution may still be to actually buy some commercial development tools. I really wanted to make a go of using all open-source stuff, but first I need to find something that is ready for prime time.
Until I can write a trivial program that displays, inserts, deletes, and edits records in a simple database table, I have no hope whatever of getting any farther. So far, I have not seen any evidence that this is even possible using Lazarus and MySQL (without writing 1000 lines of code to do all of the SQL manipulation), so the next step is to evaluate another set of tools.
What I REALLY wanted was to be able to drop some components on a form (connection, query, datasource, dbgrid, and dbnavigator), and link them together with some properties, and have it work without writing a lick of code -- just like I once did with Delphi 3 over a decade ago. So far, Lazarus has not caught up with D3, much less D6.
Hmm... I need to spend some time looking for my old copy of D3 and see if it will even run on XP.
John wrote 44 lines
Howard Lee Harkness wrote 10 lines
I am not saying that MySQL won't work, rather that Postgres has a similar 'feel' to using Oracle. All the concepts are similar. On the other hand, while I have never tried MySql, just from perusing this list, it does seem to have more problems with library versions, etc.
Show quoted text 14 lines
It probably really is worth satisfying yourself that you can do this with a dbase (or other local) table first - it does work.
Show quoted text 6 lines
To be fair, while you could do what you are saying with simple stuff into local (dbase/paradox) tables, I can't ever remember being able to do that in 'Real World' applications using Delphi 4 C/S into Oracle, of which I did quite a bit.
Hmm... I need to spend some time looking for my old copy of D3 and see if it will even run on XP.
It will - I even have Delphi 1 running on XP (don't ask why !) as well as using D4 extensively on it, due to some applications that use paradox dbs.
(snip)
Cheers,
John Sunderland
Interesting... I tried your approach with MySQL, and I still could not get edit to work.…
En/na Howard Lee Harkness ha escrit:
Show quoted text 5 lines
Mmmh, I have it working as you say with sqlite and the zeos components (and IIRC I suggested that to you a while ago).
Bye
Interesting... I tried your approach with MySQL, and I still could not get edit to work.…
Op zondag 22-06-2008 om 19:34 uur [tijdzone -0600], schreef Howard Lee Harkness:
Show quoted text 6 lines
With MySQL 4 or 5? I doubt it.
And with the latest Delphi versions, you'll also fail. They also need an applyupdates call, just like fpc does.
This is not a problem of fpc, but more a problem that you don't know how to use it (yet). Or if you want, a documentation problem.
Joost.
En/na Howard Lee Harkness ha escrit: Mmmh, I have it working as you say with sqlite and…
That is on my list of things to try as soon as I have the time.
