I made some changes
First, here's a fix for Delphi Unicode, you have to cast string to ansistring explicitly, we need to replace:
ftString, ftFixedChar, ftMemo, FtFmtMemo:
begin
StrSize := Length(StrValue)+1;
GetMem(Buffer, StrSize);
StrCopy(Buffer, PAnsiChar(StrValue));
end;
with
ftString, ftFixedChar, ftMemo, FtFmtMemo:
begin
StrSize := Length(StrValue)+1;
GetMem(Buffer, StrSize);
StrCopy(Buffer, PAnsiChar(AnsiString(StrValue)));
end;
And about params, I don't really understand why binding is made on Recordset data for strings as it's not the case for others types like integer or date and time. So I replaced all "Recordset.GetFieldAs"
in BindAnsiStringFieldValueBufferToSqliteValueAsUTF8
UTF8StrValue := SqlitePassUtils.AnsiToUTF8(PAnsiChar(FieldValueBuffer));
in BindUTF8AnsiStringFieldValueBufferToSqliteValueAsUTF8
UTF8StrValue := SqlitePassUtils.AnsiToUTF8(PAnsiChar(FieldValueBuffer));
in BindUTF8AnsiStringFieldValueBufferToSqliteValueAsUTF16
UTF16StrValue := SqlitePassUtils.UTF8Decode(PAnsiChar(FieldValueBuffer));
in BindWideStringFieldValueBufferToSqliteValueAsUTF16
UTF16StrValue := PWideChar(FieldValueBuffer);
What do you think about this ? It is the correct way ?