View Issue Details

IDProjectCategoryView StatusLast Update
0031378FPCFCLpublic2017-02-14 20:36
ReporterSonerAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386-win32OSWindowsOS Version7
Product Version3.0.0Product Build2015/12/07 
Target Version3.2.0Fixed in Version3.1.1 
Summary0031378: Put TSQLQuery.RefereshSQL some string, then delete it. You get error after calling TSQLQuery.ApplyUpdates in the Lazarus-IDE
DescriptionLet's assume you have working TSQLQuery with right select, delete, update, insert statements and you don't touched TSQLQuery.RefreshSQL statement.
When you set some string to TSQLQuery.RefreshSQL in Objektinspektor and delete it again, you will get "EDatabaseError: SQL statement not set". When you start the programm from Lazarus-IDE.
In the forms LFM-File the entry for TSQLQuery.RefreshSQL looks like:
    RefreshSQL.Strings = (
      ''
    )
When you delete from LFM-File this empty entry with text-editor then the error disappears.(Don't forget to delete projects-lib folder, there is copy of lfm-file)
Also calling:
 SQLQuery1.RefreshSQL.Text:='';
in OnFormCreate-Event solves the problem.

I don't know if it component-streaming problem or TSQLQuery or Lazarus-Ide problem.

I use it with Firebird 2.5 Database.

My Lazarus: Version 1.6.3, 2016-11-21 SVN-Revision 53387
Steps To Reproduce1.Build TSQLQuery with right select, delete, update, insert statements
You can use the example from this issue:
http://bugs.freepascal.org/view.php?id=31375

2. Set TSQLQuery.RefreshSQL some string in Objektinspektor
3. Now delete TSQLQuery.RefreshSQL with Objektinspektor
4. Start the projekt with Lazarus.
5. Edit some records save it, call TSQLQuery.ApplyUpdates.
6. you will get "EDatabaseError: SQL statement not set"
7. Close the programm open forms Lfm-File with any text editor and delete entry, between "...":
  object SQLQuery1: TSQLQuery
    ....
    RefreshSQL.Strings = (
      ''
    )
    ...
and save it.
Delete in projects folder the sub-folder lib, there is old copy of lfm-file.
8.Now start start the programm from Lazarus, edit and save records. the error is no more error.
9. Instead of editing the lfm-file(7.), you can also set in OnFormCreate:
SQLQuery1.RefreshSQL.Text:='';




Additional InformationYou can use the example from this issue:
http://bugs.freepascal.org/view.php?id=31375
TagsNo tags attached.
Fixed in Revision35421
FPCOldBugId
FPCTarget
Attached Files

Activities

Soner

2017-02-11 13:30

reporter   ~0098097

Now, Ich checked the LFM-file with hex editor when it has the entry:
RefreshSQL.Strings = (
      ''
    )

There is no enter-char between '' but if you put the RefreshSQL.Strings in one memo like this:
Memo1.Lines.Text:=SQLQuMain1.RefreshSQL.Text;
then you get one empty line and the cursor is in second line.
But here should be only one line, and the cursor should be in the first line, checked with Memo1.Lines.Text:='';

Bart Broersma

2017-02-11 13:43

reporter   ~0098099

This seems to be a Lazaus problem.
Can somebody move it to Lazarus?

Marco van de Voort

2017-02-11 15:21

manager   ~0098100

Maybe sqlquery checks for items.count=0 and could simply also check for zero content. Small editor mistakes will happen, so there is room for improvement here too IMHO.

Michael Van Canneyt

2017-02-11 15:44

administrator   ~0098101

Committed a fix. Please test and close if OK. In my own test program all is well.

Soner

2017-02-14 20:36

reporter   ~0098171

The fix works tested with daily build trunk from today:
2017-02-13, Svn revision 1:35433

Issue History

Date Modified Username Field Change
2017-02-11 13:11 Soner New Issue
2017-02-11 13:30 Soner Note Added: 0098097
2017-02-11 13:43 Bart Broersma Note Added: 0098099
2017-02-11 14:57 Michael Van Canneyt Assigned To => Michael Van Canneyt
2017-02-11 14:57 Michael Van Canneyt Status new => assigned
2017-02-11 15:21 Marco van de Voort Note Added: 0098100
2017-02-11 15:44 Michael Van Canneyt Fixed in Revision => 35421
2017-02-11 15:44 Michael Van Canneyt Note Added: 0098101
2017-02-11 15:44 Michael Van Canneyt Status assigned => resolved
2017-02-11 15:44 Michael Van Canneyt Fixed in Version => 3.1.1
2017-02-11 15:44 Michael Van Canneyt Resolution open => fixed
2017-02-11 15:44 Michael Van Canneyt Target Version => 3.2.0
2017-02-14 20:36 Soner Note Added: 0098171
2017-02-14 20:36 Soner Status resolved => closed