|
@@ -30,7 +30,6 @@ type
|
|
Destructor Destroy; override;
|
|
Destructor Destroy; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { TPQCursor }
|
|
|
|
// TField and TFieldDef only support a limited amount of fields.
|
|
// TField and TFieldDef only support a limited amount of fields.
|
|
// TFieldBinding and TExtendedFieldType can be used to map PQ types
|
|
// TFieldBinding and TExtendedFieldType can be used to map PQ types
|
|
// on standard fields and retain mapping info.
|
|
// on standard fields and retain mapping info.
|
|
@@ -40,12 +39,14 @@ type
|
|
FieldDef : TSQLDBFieldDef; // FieldDef this is associated with
|
|
FieldDef : TSQLDBFieldDef; // FieldDef this is associated with
|
|
Index : Integer; // Tuple index
|
|
Index : Integer; // Tuple index
|
|
TypeOID : oid; // Filled with type OID if it is not standard.
|
|
TypeOID : oid; // Filled with type OID if it is not standard.
|
|
- TypeName : String; // Filled with type name by getextendedfieldInfo
|
|
|
|
|
|
+ TypeName : String; // Filled with type name by GetExtendedFieldInfo
|
|
ExtendedFieldType: TExtendedFieldType; //
|
|
ExtendedFieldType: TExtendedFieldType; //
|
|
end;
|
|
end;
|
|
PFieldBinding = ^TFieldBinding;
|
|
PFieldBinding = ^TFieldBinding;
|
|
TFieldBindings = Array of TFieldBinding;
|
|
TFieldBindings = Array of TFieldBinding;
|
|
|
|
|
|
|
|
+ { TPQCursor }
|
|
|
|
+
|
|
TPQCursor = Class(TSQLCursor)
|
|
TPQCursor = Class(TSQLCursor)
|
|
protected
|
|
protected
|
|
Statement : string;
|
|
Statement : string;
|
|
@@ -328,10 +329,8 @@ Var
|
|
I,J : Integer;
|
|
I,J : Integer;
|
|
Res : PPGResult;
|
|
Res : PPGResult;
|
|
toid : oid;
|
|
toid : oid;
|
|
- O : Array of integer;
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
- SetLength(O,Length(Bindings));
|
|
|
|
For I:=0 to Length(Bindings)-1 do
|
|
For I:=0 to Length(Bindings)-1 do
|
|
if (Bindings[i].TypeOID>0) then
|
|
if (Bindings[i].TypeOID>0) then
|
|
begin
|
|
begin
|
|
@@ -453,7 +452,6 @@ function TPQConnection.Commit(trans : TSQLHandle) : boolean;
|
|
var
|
|
var
|
|
res : PPGresult;
|
|
res : PPGresult;
|
|
tr : TPQTrans;
|
|
tr : TPQTrans;
|
|
- i : Integer;
|
|
|
|
begin
|
|
begin
|
|
result := false;
|
|
result := false;
|
|
tr := trans as TPQTrans;
|
|
tr := trans as TPQTrans;
|
|
@@ -618,7 +616,6 @@ end;
|
|
|
|
|
|
procedure TPQConnection.CheckConnectionStatus(var conn: PPGconn);
|
|
procedure TPQConnection.CheckConnectionStatus(var conn: PPGconn);
|
|
var sErr: string;
|
|
var sErr: string;
|
|
- i: integer;
|
|
|
|
begin
|
|
begin
|
|
if (PQstatus(conn) = CONNECTION_BAD) then
|
|
if (PQstatus(conn) = CONNECTION_BAD) then
|
|
begin
|
|
begin
|
|
@@ -651,7 +648,6 @@ var
|
|
MESSAGE_DETAIL: string;
|
|
MESSAGE_DETAIL: string;
|
|
MESSAGE_HINT: string;
|
|
MESSAGE_HINT: string;
|
|
STATEMENT_POSITION: string;
|
|
STATEMENT_POSITION: string;
|
|
- i:Integer;
|
|
|
|
begin
|
|
begin
|
|
if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
|
|
if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
|
|
begin
|
|
begin
|
|
@@ -944,6 +940,13 @@ var ar : array of pchar;
|
|
ParamValues : array of string;
|
|
ParamValues : array of string;
|
|
cash: int64;
|
|
cash: int64;
|
|
|
|
|
|
|
|
+ function FormatTimeInterval(Time: TDateTime): string; // supports Time >= '24:00:00'
|
|
|
|
+ var hour, minute, second, millisecond: word;
|
|
|
|
+ begin
|
|
|
|
+ DecodeTime(Time, hour, minute, second, millisecond);
|
|
|
|
+ Result := Format('%.2d:%.2d:%.2d.%.3d',[Trunc(Time)*24+hour,minute,second,millisecond]);
|
|
|
|
+ end;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
with cursor as TPQCursor do
|
|
with cursor as TPQCursor do
|
|
begin
|
|
begin
|
|
@@ -964,7 +967,7 @@ begin
|
|
ftDate:
|
|
ftDate:
|
|
s := FormatDateTime('yyyy-mm-dd', AParams[i].AsDateTime);
|
|
s := FormatDateTime('yyyy-mm-dd', AParams[i].AsDateTime);
|
|
ftTime:
|
|
ftTime:
|
|
- s := FormatDateTime('hh:nn:ss.zzz', AParams[i].AsDateTime);
|
|
|
|
|
|
+ s := FormatTimeInterval(AParams[i].AsDateTime);
|
|
ftFloat, ftBCD:
|
|
ftFloat, ftBCD:
|
|
Str(AParams[i].AsFloat, s);
|
|
Str(AParams[i].AsFloat, s);
|
|
ftCurrency:
|
|
ftCurrency:
|
|
@@ -979,7 +982,7 @@ begin
|
|
s := AParams[i].AsString;
|
|
s := AParams[i].AsString;
|
|
end; {case}
|
|
end; {case}
|
|
GetMem(ar[i],length(s)+1);
|
|
GetMem(ar[i],length(s)+1);
|
|
- StrMove(PChar(ar[i]),Pchar(s),Length(S)+1);
|
|
|
|
|
|
+ StrMove(PChar(ar[i]),PChar(s),Length(S)+1);
|
|
lengths[i]:=Length(s);
|
|
lengths[i]:=Length(s);
|
|
if (AParams[i].DataType in [ftBlob,ftMemo,ftGraphic,ftCurrency]) then
|
|
if (AParams[i].DataType in [ftBlob,ftMemo,ftGraphic,ftCurrency]) then
|
|
Formats[i]:=1
|
|
Formats[i]:=1
|
|
@@ -1038,7 +1041,6 @@ procedure TPQConnection.AddFieldDefs(cursor: TSQLCursor; FieldDefs : TfieldDefs)
|
|
var
|
|
var
|
|
i : integer;
|
|
i : integer;
|
|
size : integer;
|
|
size : integer;
|
|
- eft : TExtendedFieldType;
|
|
|
|
aoid : oid;
|
|
aoid : oid;
|
|
fieldtype : tfieldtype;
|
|
fieldtype : tfieldtype;
|
|
nFields : integer;
|
|
nFields : integer;
|
|
@@ -1046,7 +1048,6 @@ var
|
|
Q : TPQCursor;
|
|
Q : TPQCursor;
|
|
FD : TSQLDBFieldDef;
|
|
FD : TSQLDBFieldDef;
|
|
FB : PFieldBinding;
|
|
FB : PFieldBinding;
|
|
- C : TFieldDefClass;
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
B:=False;
|
|
B:=False;
|