ApplyUpdate : SQL Error: SQL logic error or missing database

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
gelinp
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 11.11.2015, 18:49

ApplyUpdate : SQL Error: SQL logic error or missing database

Post by gelinp »

Hi,

I ve got the code below to update a SQLite-3 database :

Code: Select all

procedure TFormMain.EnregistrerClick(Sender: TObject);
begin
  try
      //Update enreg
      DataModule1.SQLEditSeance.ApplyUpdates;
      DataModule1.ZConnection2.Commit;
    except
      On E: EDatabaseError do
      begin
        MessageDlg('Erreur',
             'EnregistrerClick::Erreur de base de donnée : ' + E.Message,
             mtError, [mbOK],0);
      end;
  end;
end;   
But it display the error message when I call ApplyUpdates :

TApplication.HandleException SQL Error: SQL logic error or missing database The problem come from the use of an update object TZUpdate... If I delete the reference of this object then I can ApplyUpdate but I have to look this afternoon if it is working as it does...

My database is a sqlite file, and I'm the owner of the file and the executable of my application. So it looks like an other problem than access file. The SQLEditSeance dataset is alone, simple, not in Master / Detail or other complicated schema.

SQLEditSeance parameters :
CachedUpdate = true
FechRow = 0 (tested also with 1, there is only one row in my dataset, the goal is to edit one row...)
SQL :

Code: Select all

SELECT PEDAGOLesSeances.*
FROM PEDAGOLesSeances
WHERE PEDAGOLesSeances.PKseance = :PKseance 
UpdateMode = umUpdateChanged
Wheremode = wmWhereKeyOnly

Update object
ModifySQL:

Code: Select all

UPDATE `PEDAGOLesSeances` SET 
`nomseance`	=:nomseance,
`maxeleves`= :maxeleves,
`groupe`	= :groupe,
`partenariat` = :partenariat,
`outils` = :outils,
`ressources` = :ressources,
`deroulement` = :deroulement,
`cote` = :cote,
`productions` = :productions,
`evaluation` = :evaluation,
`FKmodele` = :FKmodele,
`FKsequence`	= :FKsequence,
`FKetat`	= :FKetat,
`ordresequence` = :ordresequence,
`resteafaire` = :resteafaire,
`niveaux` = :niveaux,
`objectifsdocumentaire`	= :objectifsdocumentaire,
`objectifsdisciplinaire` = objectifsdisciplinaire,
`prerequisdocumentaire` = :prerequisdocumentaire,
`prerequisdisciplinaire` = :prerequisdisciplinaire,
WHERE pkseance = :pkseance
Do I need to add 'WHERE pkseance = :pkseance' clause in the updateSQL ?
refreshSQL

Code: Select all

SELECT PEDAGOLesSeances.*
FROM PEDAGOLesSeances
WHERE PEDAGOLesSeances.PKseance = :PKseance 
Do you have some idea I could test ?

Thank you for your help.

I'm using LAzarus 1.4.4 with Free PAscal 3.0 and Zeoslib 7.2 (svn from last week)
miab3
Zeos Test Team
Zeos Test Team
Posts: 1309
Joined: 11.05.2012, 12:32
Location: Poland

Re: ApplyUpdate : SQL Error: SQL logic error or missing database

Post by miab3 »

Give full example.
(What do you Commit?)

Michal
Post Reply