|
@@ -48,6 +48,7 @@ Type
|
|
LastInsertID : QWord;
|
|
LastInsertID : QWord;
|
|
ParamBinding : TParamBinding;
|
|
ParamBinding : TParamBinding;
|
|
ParamReplaceString : String;
|
|
ParamReplaceString : String;
|
|
|
|
+ MapDSRowToMSQLRow : array of integer;
|
|
end;
|
|
end;
|
|
|
|
|
|
TConnectionName = class (TSQLConnection)
|
|
TConnectionName = class (TSQLConnection)
|
|
@@ -339,6 +340,7 @@ begin
|
|
Mysql_free_result(C.FRes);
|
|
Mysql_free_result(C.FRes);
|
|
C.FRes:=Nil;
|
|
C.FRes:=Nil;
|
|
end;
|
|
end;
|
|
|
|
+ SetLength(c.MapDSRowToMSQLRow,0);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TConnectionName.Execute(cursor: TSQLCursor;
|
|
procedure TConnectionName.Execute(cursor: TSQLCursor;
|
|
@@ -441,6 +443,8 @@ begin
|
|
end;
|
|
end;
|
|
// Writeln('MySQL: have result');
|
|
// Writeln('MySQL: have result');
|
|
FC:=mysql_num_fields(C.FRes);
|
|
FC:=mysql_num_fields(C.FRes);
|
|
|
|
+ SetLength(c.MapDSRowToMSQLRow,FC);
|
|
|
|
+
|
|
TF := 1;
|
|
TF := 1;
|
|
For I:= 0 to FC-1 do
|
|
For I:= 0 to FC-1 do
|
|
begin
|
|
begin
|
|
@@ -450,6 +454,7 @@ begin
|
|
if MySQLDataType(field^.ftype, field^.length, field^.decimals, DFT, DFS) then
|
|
if MySQLDataType(field^.ftype, field^.length, field^.decimals, DFT, DFS) then
|
|
begin
|
|
begin
|
|
TFieldDef.Create(FieldDefs, field^.name, DFT, DFS, False, TF);
|
|
TFieldDef.Create(FieldDefs, field^.name, DFT, DFS, False, TF);
|
|
|
|
+ c.MapDSRowToMSQLRow[TF-1] := I;
|
|
inc(TF);
|
|
inc(TF);
|
|
end
|
|
end
|
|
end;
|
|
end;
|
|
@@ -471,7 +476,6 @@ function TConnectionName.LoadField(cursor : TSQLCursor;
|
|
FieldDef : TfieldDef;buffer : pointer) : boolean;
|
|
FieldDef : TfieldDef;buffer : pointer) : boolean;
|
|
|
|
|
|
var
|
|
var
|
|
- I, FC: Integer;
|
|
|
|
field: PMYSQL_FIELD;
|
|
field: PMYSQL_FIELD;
|
|
row : MYSQL_ROW;
|
|
row : MYSQL_ROW;
|
|
C : TCursorName;
|
|
C : TCursorName;
|
|
@@ -485,15 +489,10 @@ begin
|
|
MySQLError(c.FQMySQL,SErrFetchingData,Self);
|
|
MySQLError(c.FQMySQL,SErrFetchingData,Self);
|
|
end;
|
|
end;
|
|
Row:=C.Row;
|
|
Row:=C.Row;
|
|
- FC := mysql_num_fields(C.FRES);
|
|
|
|
|
|
+
|
|
|
|
+ inc(Row,c.MapDSRowToMSQLRow[FieldDef.FieldNo-1]);
|
|
|
|
+ field := mysql_fetch_field_direct(C.FRES, c.MapDSRowToMSQLRow[FieldDef.FieldNo-1]);
|
|
|
|
|
|
- for I := 0 to FC-1 do
|
|
|
|
- begin
|
|
|
|
- field := mysql_fetch_field_direct(C.FRES, I);
|
|
|
|
- if field^.name=FieldDef.name then break;
|
|
|
|
- Inc(Row);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
Result := MySQLWriteData(field^.ftype, field^.length, FieldDef.DataType, Row^, Buffer);
|
|
Result := MySQLWriteData(field^.ftype, field^.length, FieldDef.DataType, Row^, Buffer);
|
|
end;
|
|
end;
|
|
|
|
|