Forum > Databases
SQLdb ParseSQL
valdir.marcos:
How can I see the automatically generated commands for SQLQuery1.InsertSQL, SQLQuery1.UpdateSQL and SQLQuery1.DeleteSQL after setting SQLQuery1.ParseSQL?
I have attached a very small sample project.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);begin SQLQuery1.Close; SQLQuery1.SQL.Text := 'Select ID, Name, Age From People ' + LineEnding + 'Order By ID;'; SQLQuery1.ParseSQL := True; SQLQuery1.Open; Memo1.Text := SQLQuery1.InsertSQL.Text; Memo2.Text := SQLQuery1.UpdateSQL.Text; Memo3.Text := SQLQuery1.DeleteSQL.Text; Memo4.Clear; SQLQuery1.First; while not SQLQuery1.EOF do begin Memo4.Lines.Add(SQLQuery1.FieldByName('ID'). AsString + ', ' + SQLQuery1.FieldByName('Name'). AsString + ', ' + SQLQuery1.FieldByName('Age'). AsString + '.'); SQLQuery1.Next; end; SQLQuery1.Close; SQLTransaction1.Commit;end;
mangakissa:
Isn't there a Firebird monitoring component is SQLdb tab?
valdir.marcos:
--- Quote from: mangakissa on September 04, 2018, 05:08:50 pm ---Isn't there a Firebird monitoring component is SQLdb tab?
--- End quote ---
Yes, there is and I can see that information through monitoring tables on Firebird.
The question here is if the component generates and uses that information, why can't I see it?
rvk:
As far as I can see from the sources is that those updatesql statements are generated, used and freed only internally. There is no access to the statements themselves. You can use a monitor component to see them but only at the moment you issue an insert, update or delete on the table. The internal statements are not created during parsesql but dyring the actual .insert/.edit/.delete.
What do you need it for? You could generate those statements yourself (you can even look at the sources how it's done).
valdir.marcos:
--- Quote from: rvk on September 04, 2018, 11:02:23 pm ---What do you need it for?
--- End quote ---
I don't need the commands per se, I am just investiganting a bigger problem.
I am trying to understand why those commands work correctly on an isolated test application, but on an actual application sometimes the same form leads to the error message below:
--------------
Project xxx raised exception class 'EDatabaseError' with message:
IBConnection1 : No update query specified and failed to generate one. (No fields for inclusion in where statement found)
--------------
Navigation
[0] Message Index
[#] Next page