#1 2017-08-22 11:30:32

BLADEXP
Member
Registered: 2016-06-30
Posts: 3

SynDBVCL feature missing

{$ifdef ISDELPHIXE3}

function TSynDBSQLDataSet.PSExecuteStatement(const ASQL: string;
  AParams: TParams): Integer;
var DS: TDataSet;
begin
  DS := nil;
  result := PSExecuteStatement(ASQL,AParams,DS);
  DS.Free;
end;

function TSynDBSQLDataSet.PSExecuteStatement(const ASQL: string;
  AParams: TParams; var ResultSet: TDataSet): Integer;
{$else}
function TSynDBSQLDataSet.PSExecuteStatement(const ASQL: string;
  AParams: TParams; ResultSet: Pointer): Integer;
{$endif}
var Stmt: ISQLDBStatement;
    p: integer;
begin // only execute writes in current implementation
  if fConnection=nil then
    raise ESQLQueryException.CreateUTF8('%.PSExecuteStatement with Connection=nil',[self]);
  Stmt := fConnection.NewThreadSafeStatementPrepared(StringToUTF8(ASQL),false);
  if Stmt<>nil then
    try
      if AParams<>nil then
        for p := 0 to AParams.Count-1 do
         if aParams[p].DataType = ftBlob then                                                                               <-------------
           Stmt.BindBlob(p+1,pointer(aParams[p].AsBlob),length(aParams[p].AsBlob))                            <-------------
            else Stmt.BindVariant(p+1,AParams[p].Value,false);
      Stmt.ExecutePrepared;
      result := Stmt.UpdateCount;
      if result=0 then
        result := 1; // optimistic result, even if SynDB returned 0
    except
      result := 0;
    end else
      result := 0;
end;

Offline

#2 2017-08-22 14:49:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,150
Website

Re: SynDBVCL feature missing

As stated by the forum rules, please don't post code directly in here, but use an external pastebin!
smile

Thanks for sharing.
See https://synopse.info/fossil/info/1fe4c5c9c2

Offline

Board footer

Powered by FluxBB