>>> I'll see if I can install Zeos and complete it's AfterExecSQL()
>>> implementation.
>>>
>> Are you thinking of executing the
>> SELECT LAST_INSERT_ID() as NewID in the AfterExecSQL()?
>
> No, I was only going to implement the requirements that makes AfterExecSQL
> execute - meaning the check for "rows affected".
>
> I want to see if it is possible to execute AfterExecSQL even if a
> persistence layer doesn't support Rows Affected. Then the developer can
> decide for themselves how they want to handle things like AutoInc fields
> as
> PK's etc...
Finally I can make it work temporarily:
procedure TVisAnnouncer_Create.Init;
begin
Query.SQLText:=
'INSERT INTO person (PersonName, Agen) ' +
' VALUES (:PersonName, :Age); '
end;
procedure TVisPerson_Create.AfterExecSQL;
var
personData: TPerson;
begin
inherited;
personData:= Visited as TPerson;
Query.SQL.Text := 'SELECT LAST_INSERT_ID() As NewPersonID';
Query.Open;
personData.PersonID := FieldAsInteger['NewPersonID'];
end;
The thing I need to do is modify Execute method, comment out the
if FQuery.SupportsRowsAffected then
procedure TtiVisitorUpdate.Execute(const AData: TtiVisited);
var
lStart: DWord;
lRowsAffected: integer;
begin
....
SetupParams;
lRowsAffected := Query.ExecSQL;
//if FQuery.SupportsRowsAffected then
AfterExecSQL(lRowsAffected);
LogQueryTiming(ClassName, tiGetTickCount - lStart, 0);
end;
Because FQuery.SupportsRowsAffected is always FALSE.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
tiOPF-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tiopf-talk