|
@@ -158,6 +158,7 @@ Var
|
|
cu1: currency;
|
|
cu1: currency;
|
|
do1: double;
|
|
do1: double;
|
|
parms : array of Integer;
|
|
parms : array of Integer;
|
|
|
|
+ wstr1: widestring;
|
|
|
|
|
|
begin
|
|
begin
|
|
for I:=1 to high(fparambinding)+1 do
|
|
for I:=1 to high(fparambinding)+1 do
|
|
@@ -183,6 +184,7 @@ begin
|
|
end;
|
|
end;
|
|
ftFMTBcd,
|
|
ftFMTBcd,
|
|
ftstring,
|
|
ftstring,
|
|
|
|
+ ftFixedChar,
|
|
ftmemo: begin // According to SQLite documentation, CLOB's (ftMemo) have the Text affinity
|
|
ftmemo: begin // According to SQLite documentation, CLOB's (ftMemo) have the Text affinity
|
|
str1:= p.asstring;
|
|
str1:= p.asstring;
|
|
checkerror(sqlite3_bind_text(fstatement,I,pcharstr(str1), length(str1),@freebindstring));
|
|
checkerror(sqlite3_bind_text(fstatement,I,pcharstr(str1), length(str1),@freebindstring));
|
|
@@ -191,6 +193,11 @@ begin
|
|
str1:= P.asstring;
|
|
str1:= P.asstring;
|
|
checkerror(sqlite3_bind_blob(fstatement,I,pcharstr(str1), length(str1),@freebindstring));
|
|
checkerror(sqlite3_bind_blob(fstatement,I,pcharstr(str1), length(str1),@freebindstring));
|
|
end;
|
|
end;
|
|
|
|
+ ftWideString, ftFixedWideChar, ftWideMemo:
|
|
|
|
+ begin
|
|
|
|
+ wstr1:=P.AsWideString;
|
|
|
|
+ checkerror(sqlite3_bind_text16(fstatement,I, PWideChar(wstr1), length(wstr1)*sizeof(WideChar), sqlite3_destructor_type(SQLITE_TRANSIENT)));
|
|
|
|
+ end
|
|
else
|
|
else
|
|
DatabaseErrorFmt(SUnsupportedParameter, [Fieldtypenames[P.DataType], Self]);
|
|
DatabaseErrorFmt(SUnsupportedParameter, [Fieldtypenames[P.DataType], Self]);
|
|
end; { Case }
|
|
end; { Case }
|
|
@@ -259,16 +266,33 @@ var
|
|
int1: integer;
|
|
int1: integer;
|
|
st: psqlite3_stmt;
|
|
st: psqlite3_stmt;
|
|
fnum: integer;
|
|
fnum: integer;
|
|
|
|
+ p1: Pointer;
|
|
|
|
|
|
begin
|
|
begin
|
|
st:=TSQLite3Cursor(cursor).fstatement;
|
|
st:=TSQLite3Cursor(cursor).fstatement;
|
|
fnum:= FieldDef.fieldno - 1;
|
|
fnum:= FieldDef.fieldno - 1;
|
|
|
|
|
|
- int1:= sqlite3_column_bytes(st,fnum);
|
|
|
|
|
|
+ case FieldDef.DataType of
|
|
|
|
+ ftWideMemo:
|
|
|
|
+ begin
|
|
|
|
+ p1 := sqlite3_column_text16(st,fnum);
|
|
|
|
+ int1 := sqlite3_column_bytes16(st,fnum);
|
|
|
|
+ end;
|
|
|
|
+ ftMemo:
|
|
|
|
+ begin
|
|
|
|
+ p1 := sqlite3_column_text(st,fnum);
|
|
|
|
+ int1 := sqlite3_column_bytes(st,fnum);
|
|
|
|
+ end;
|
|
|
|
+ else //ftBlob
|
|
|
|
+ begin
|
|
|
|
+ p1 := sqlite3_column_blob(st,fnum);
|
|
|
|
+ int1 := sqlite3_column_bytes(st,fnum);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
|
|
- ReAllocMem(ABlobBuf^.BlobBuffer^.Buffer,int1);
|
|
|
|
|
|
+ ReAllocMem(ABlobBuf^.BlobBuffer^.Buffer, int1);
|
|
if int1 > 0 then
|
|
if int1 > 0 then
|
|
- move(sqlite3_column_text(st,fnum)^,ABlobBuf^.BlobBuffer^.Buffer^,int1);
|
|
|
|
|
|
+ move(p1^, ABlobBuf^.BlobBuffer^.Buffer^, int1);
|
|
ABlobBuf^.BlobBuffer^.Size := int1;
|
|
ABlobBuf^.BlobBuffer^.Size := int1;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -314,7 +338,7 @@ Type
|
|
end;
|
|
end;
|
|
|
|
|
|
Const
|
|
Const
|
|
- FieldMapCount = 20;
|
|
|
|
|
|
+ FieldMapCount = 23;
|
|
FieldMap : Array [1..FieldMapCount] of TFieldMap = (
|
|
FieldMap : Array [1..FieldMapCount] of TFieldMap = (
|
|
(n:'INT'; t: ftInteger),
|
|
(n:'INT'; t: ftInteger),
|
|
(n:'LARGEINT'; t:ftlargeInt),
|
|
(n:'LARGEINT'; t:ftlargeInt),
|
|
@@ -335,7 +359,10 @@ Const
|
|
(n:'DECIMAL'; t: ftBCD),
|
|
(n:'DECIMAL'; t: ftBCD),
|
|
(n:'TEXT'; t: ftmemo),
|
|
(n:'TEXT'; t: ftmemo),
|
|
(n:'CLOB'; t: ftmemo),
|
|
(n:'CLOB'; t: ftmemo),
|
|
- (n:'BLOB'; t: ftBlob)
|
|
|
|
|
|
+ (n:'BLOB'; t: ftBlob),
|
|
|
|
+ (n:'NCHAR'; t: ftFixedWideChar),
|
|
|
|
+ (n:'NVARCHAR'; t: ftWideString),
|
|
|
|
+ (n:'NCLOB'; t: ftWideMemo)
|
|
{ Template:
|
|
{ Template:
|
|
(n:''; t: ft)
|
|
(n:''; t: ft)
|
|
}
|
|
}
|
|
@@ -378,7 +405,11 @@ begin
|
|
// handle some specials.
|
|
// handle some specials.
|
|
size1:=0;
|
|
size1:=0;
|
|
case ft1 of
|
|
case ft1 of
|
|
- ftString: begin
|
|
|
|
|
|
+ ftString,
|
|
|
|
+ ftFixedChar,
|
|
|
|
+ ftFixedWideChar,
|
|
|
|
+ ftWideString:
|
|
|
|
+ begin
|
|
fi:=pos('(',FD);
|
|
fi:=pos('(',FD);
|
|
if (fi>0) then
|
|
if (fi>0) then
|
|
begin
|
|
begin
|
|
@@ -494,13 +525,10 @@ function TSQLite3Connection.LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;b
|
|
var
|
|
var
|
|
st1: TStorageType;
|
|
st1: TStorageType;
|
|
fnum: integer;
|
|
fnum: integer;
|
|
- i: integer;
|
|
|
|
- i64: int64;
|
|
|
|
- int1,int2: integer;
|
|
|
|
str1: string;
|
|
str1: string;
|
|
|
|
+ int1 : integer;
|
|
bcd: tBCD;
|
|
bcd: tBCD;
|
|
bcdstr: FmtBCDStringtype;
|
|
bcdstr: FmtBCDStringtype;
|
|
- ar1,ar2: TStringArray;
|
|
|
|
st : psqlite3_stmt;
|
|
st : psqlite3_stmt;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -534,6 +562,7 @@ begin
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Pdatetime(buffer)^:= sqlite3_column_double(st,fnum);
|
|
Pdatetime(buffer)^:= sqlite3_column_double(st,fnum);
|
|
|
|
+ ftFixedChar,
|
|
ftString: begin
|
|
ftString: begin
|
|
int1:= sqlite3_column_bytes(st,fnum);
|
|
int1:= sqlite3_column_bytes(st,fnum);
|
|
if int1>FieldDef.Size then
|
|
if int1>FieldDef.Size then
|
|
@@ -557,6 +586,16 @@ begin
|
|
bcd := 0;
|
|
bcd := 0;
|
|
pBCD(buffer)^:= bcd;
|
|
pBCD(buffer)^:= bcd;
|
|
end;
|
|
end;
|
|
|
|
+ ftFixedWideChar,
|
|
|
|
+ ftWideString:
|
|
|
|
+ begin
|
|
|
|
+ int1 := sqlite3_column_bytes16(st,fnum)+2; //The value returned does not include the zero terminator at the end of the string
|
|
|
|
+ if int1>(FieldDef.Size+1)*2 then
|
|
|
|
+ int1:=(FieldDef.Size+1)*2;
|
|
|
|
+ if int1 > 0 then
|
|
|
|
+ move(sqlite3_column_text16(st,fnum)^, buffer^, int1); //Strings returned by sqlite3_column_text() and sqlite3_column_text16(), even empty strings, are always zero terminated.
|
|
|
|
+ end;
|
|
|
|
+ ftWideMemo,
|
|
ftMemo,
|
|
ftMemo,
|
|
ftBlob: CreateBlob:=True;
|
|
ftBlob: CreateBlob:=True;
|
|
else { Case }
|
|
else { Case }
|