 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Brian Wheatley Guest
|
Posted: Mon Jul 12, 2004 12:36 pm Post subject: Implementing IProviderSupport functions |
|
|
Hello,
When I tried using FlashFiler 2.13 with DataSnap I discovered that the
client application could display the data but could not apply the changes
back to the FF2 table. Originally I thought that this was because FF2 would
not return a live data set, but I've since found that this is actually
because the IProviderSupport functions were not implemented. Therefore, I am
implementing the IProviderSupport functions using the BDE components as a
base model.
I've implemented the following functions in the TffDataSet base class:
{ --------- IProviderSupport --------- }
procedure PSEndTransaction(Commit: Boolean); override;
function PSExecuteStatement(const ASQL: string; AParams: TParams;
ResultSet: Pointer = nil): Integer; override;
procedure PSGetAttributes(List: TList); override;
function PSGetQuoteChar: string; override;
function PSInTransaction: Boolean; override;
function PSIsSQLBased: Boolean; override;
procedure PSStartTransaction; override;
function PSUpdateRecord(UpdateKind: TUpdateKind; Delta: TDataSet):
Boolean; override;
{ --------- IProviderSupport --------- }
And the following functions in the TffQuery class:
{ --------- IProviderSupport --------- }
procedure PSExecute; override;
function PSGetDefaultOrder: TIndexDef; override;
function PSGetParams: TParams; override;
function PSGetTableName: string; override;
procedure PSSetCommandText(const CommandText: string); override;
procedure PSSetParams(AParams: TParams); override;
{ --------- IProviderSupport --------- }
With these methods implemented the DataSnap client is now able to update the
FF2 table.
The questions that I have are in regard to the ResultSet parameter of the
PSExecuteStatement method. According to the Delphi help file this is to
allow the PSExecuteStatement method to return the results of a SELECT
statement.
1. Under what conditions will DataSnap send a SELECT statement to the
PSExecuteStatement method?
2. Assuming that I'm dynamically creating a TffQuery (filling in the
SessionName, DatabaseName, SQL, and Params properties), how would I return
this query using the ResultSet pointer?
3. The Delphi help file states that the caller is responsible for freeing
the data set. Am I correct in that I do not have to keep track of the
dynamically created TffQuery since it will be freed by the caller when it is
no longer needed?
I would appreciate any insight that you can offer!
Sincerely,
Brian Wheatley
|
|
| Back to top |
|
 |
Mark Edington (Borland) Guest
|
Posted: Tue Jul 13, 2004 6:23 pm Post subject: Re: Implementing IProviderSupport functions |
|
|
| Quote: | 1. Under what conditions will DataSnap send a SELECT statement to the
PSExecuteStatement method?
|
If there is an error during the update, the resolver will generate a select
query to try and get the current/conflicting values for that row. There may
be other cases too, but that's one I know of for sure.
| Quote: | 2. Assuming that I'm dynamically creating a TffQuery (filling in the
SessionName, DatabaseName, SQL, and Params properties), how would I return
this query using the ResultSet pointer?
|
Just return a pointer too it. Take a look at the implementation in
DBTables.pas it uses code like this to create and assign it:
TDataSet(ResultSet^) := TDBDataSet.Create(nil);
Yours should be similar.
| Quote: | 3. The Delphi help file states that the caller is responsible for freeing
the data set. Am I correct in that I do not have to keep track of the
dynamically created TffQuery since it will be freed by the caller when it
is
no longer needed?
|
Yes.
Mark
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|