Where is documentation for tSQLQuery... lazarus / 16-Databases ---------------------------------------------------------------------- keith · 2009-01-17 07:14 ... and other components on the Lazarus SQLdb tab? ---------------------------------------------------------------------- Leledumbo · 2009-01-17 08:25 In the wiki: Working With TSQLQuerySQLdb Package ---------------------------------------------------------------------- keith · 2009-01-17 12:42 Thanks for your reply. Problem is, I have found those pages and they are not really doco - just 'hello world' type of getting you started kind of stuff. Frankly I was well past that level of info 15 minutes after dropping an IBConnection on my form. I apologise if this question is hopelessly 'newbie', but I really am missing something here. I'm looking for documentation on the various properties and methods that are available. I mean its pretty obvious what the tSQLQuery.SQL property it for, but there are 4 different SQL-like properties: SQL; UPDATESQL; INSERTSQL; and DELETESQL. The names sound obvious enough, but what is the point? And are they mutually exclusive? If you fill in say SQL and UPDATESQL, does the update only apply to the result set of the SQL or is it ignored? SQL is fired when you OPEN the query, but when are the others fired? Can you not put an UPDATE, or DELETE, or INSERT statement into SQL? I'm thinking that there must be some 'design concepts' documentation around, the authors couldn't have done this much work with out it, could they? And surely I'm not the only one to have this issue arise? ---------------------------------------------------------------------- Vincent Snijders · 2009-01-17 12:48 These kind of design things you can find in Delphi help. You are not the first one, but so far nobody has become the first to write this all these documentation. ---------------------------------------------------------------------- keith · 2009-01-18 02:29 Quote from: Vincent Snijders on January 17, 2009, 01:48:19 pmThese kind of design things you can find in Delphi help. You are not the first one, but so far nobody has become the first to write this all these documentation. Thanks Vincent. I've actually looked there too, but with no luck. Maybe I'm not checking out the right units? What's the equivalent unit? I have Delphi 2007 with all Help updates (I think). I also have the Delphi 7 books, but don't have it installed any more. If I can get this stuff figured out, I might get myself energized to write it up. EDIT: I think I just found it. I'm cool for now. Thanks again ---------------------------------------------------------------------- Loesje · 2009-01-18 21:33 It could be usefull to tell us where you find it. Sqldb is based on dbexpress. But where dbexpress uses a provider, the TSQLQuery of sqldb has this provides build-in. (In fact it's in it's parent, TBufDataset, which you could compare to the TClientDataset of dbexpress) ---------------------------------------------------------------------- keith · 2009-01-19 11:46 TSQLQuery is documented in Delphi 2007, I must have done something wrong the first time I looked. It does not match TSQLQuery in FPC/Lazarus though. I haven't really found any doco on the UPDATESQL, INSERTSQL, or DELETESQL properties. Though maybe they are coming from the Provider  of which you speak - I haven't taken the time to figure Providers out yet, probably I should. I have examined the the sample code for more hints. Program fEDITTABLE.pp mentions them in a comment. I take it they are for overrideing the SQL statement that gets built when you use the dataset navigation edit, delete, etc. For example, if you  do something like:    myquery.edit;    myquery.fieldbyname('foo').asstring := 'something other than what it used to be';    myquery.post; The query is going to build an SQL UPDATE command to do that. You can apparently override the default SQL for that. I haven't experimented to confirm - I am making wild assumptions. ---------------------------------------------------------------------- Loesje · 2009-01-19 12:24 That's exactly what these properties are for. (Note that changes are cached and only applied to the database when you do TSQLQuery.ApplyUpdates) ---------------------------------------------------------------------- ematutu · 2009-01-19 22:49 Hi, so far I can tel this: TSQLQuery.SQL is used for SELECT   TSQLQuery.SQL.Add('SELECT FROM...');   Activated by:     TSQLQuery.Open;     Results are accessible by TSQLQuery.First, TSQLQuery.Next.... TSQLQuery.InsertSQL is used for INSERT,   TSQLQuery.InsertSQL.Add('INSERT INTO...');   Activated by:     TSQLQuery.Open;     TSQLQuery.Insert; //Execute TSQLQuery.InsertSQL     TSQLQuery.Post;     TSQLQuery.ApplyUpdates; //Post & Apply updates TSQLQuery.UpdateSQL is used for UPDATE,   TSQLQuery.UpdateSQL.Add('UPDATE table...');   Activated by:     TSQLQuery.Open     TSQLQuery.Edit;  // Execute TSQLQuery.UpdateSQL     TSQLQuery.Post;     TSQLQuery.ApplyUpdates; //Post & Apply updates TSQLQuery.DeleteSQL is used for DELETE.   TSQLQuery.DeleteSQL.Add('DELETE FROM...');     Activated by:     TSQLQuery.Open     TSQLQuery.Delete;  // Execute TSQLQuery.DeleteSQL     TSQLQuery.Post;     TSQLQuery.ApplyUpdates; //Post & Apply updates ---------------------------------------------------------------------- DonWhitbeck · 2010-04-01 00:41 Here is my solution to using a dbgrid to edit, insert and delete on a firebird table. The results are about the same as in Delphi //Firebird Table FUNDS has 3 fields, DETAIL_FUND_NO is integer and primary key //DESCRIPTION is a string field and ACCOUNT is an integer field //Upda]"]>Blockedde is upWhereChanged - I did not try any other Upda]"]>Blockedde {SQLQuery is of type TSQLQuery where  SQL =     Select F.* from FUNDS F     order by F.DETAIL_FUND_NO } {DeleteSQL =       DELETE FROM FUNDS       where  DETAIL_FUND_NO =:OLD_DETAIL_FUND_NO} {UpdateSQL =   UPDATE FUNDS       SET DESCRIPTION =:DESCRIPTION,       ACCOUNT = :ACCOUNT       where  DETAIL_FUND_NO =:DETAIL_FUND_NO } const   SQLINSERT = 1;   SQLEDIT = 2;     // Maybe there is a better solution to keeping track of state procedure TForm1.SQLQueryBeforePost(DataSet: TDataSet); begin   if (DataSet.State = dsInsert) then      SQLQuery.Tag := SQLINSERT   else if (DataSet.State = dsEdit) then     SQLQuery.Tag := SQLEDIT;  end; procedure TForm1.SQLQueryAfterDelete(DataSet: TDataSet); begin   With SQLQuery do     begin       applyUpdates;       SQLTran.commit;       close;       open;     end; end; procedure TForm1.SQLQueryAfterPost(DataSet: TDataSet); begin   With SQLQuery do     If (Tag = SQLINSERT) or (Tag = SQLEDIT) then       begin         Tag := 0;         applyUpdates;         SQLTran.commit;         close;         open;       end;  end;