Change variables from PChar to PAnsiChar

Change FileName to UTF8String

git-svn-id: trunk@29374 -
This commit is contained in:
blikblum 2015-01-03 10:58:48 +00:00
parent cc537a2e76
commit d0c8c121ab
3 changed files with 69 additions and 72 deletions

View File

@ -45,15 +45,12 @@ const
DefaultStringSize = 255;
type
{$if defined(ver2_6_0) or defined(ver2_4)}
TRecordBuffer = PAnsiChar;
{$endif}
TCustomSqliteDataset = class;
PDataRecord = ^DataRecord;
PPDataRecord = ^PDataRecord;
DataRecord = record
Row: PPChar;
Row: PPAnsiChar;
BookmarkFlag: TBookmarkFlag;
Next: PDataRecord;
Previous: PDataRecord;
@ -65,7 +62,7 @@ type
private
FEditItem: PDataRecord;
FDataset: TCustomSqliteDataset;
FFieldRow: PChar;
FFieldRow: PAnsiChar;
FField: TField;
FFieldOffset: Integer;
FRowSize: Int64;
@ -84,8 +81,8 @@ type
end;
//callback types
TSqliteCdeclCallback = function(UserData: Pointer; Count: LongInt; Values: PPChar; Names: PPChar): LongInt; cdecl;
TSqliteCallback = function(UserData: Pointer; Count: LongInt; Values: PPChar; Names: PPChar): LongInt of object;
TSqliteCdeclCallback = function(UserData: Pointer; Count: LongInt; Values: PPAnsiChar; Names: PPAnsiChar): LongInt; cdecl;
TSqliteCallback = function(UserData: Pointer; Count: LongInt; Values: PPAnsiChar; Names: PPAnsiChar): LongInt of object;
TCallbackInfo = record
Proc: TSqliteCallback;
Data: Pointer;
@ -94,9 +91,9 @@ type
TRecordState = (rsAdded, rsDeleted, rsUpdated);
TRecordStateSet = set of TRecordState;
TQueryUpdatesCallback = procedure(UserData: Pointer; Values: PPChar; ABookmark: TBookmark; RecordState: TRecordState) of object;
TQueryUpdatesCallback = procedure(UserData: Pointer; Values: PPAnsiChar; ABookmark: TBookmark; RecordState: TRecordState) of object;
TGetSqlStrFunction = function(APChar: PChar): String;
TGetSqlStrFunction = function(APChar: PAnsiChar): String;
TSqliteOption = (soWildcardKey);
TSqliteOptions = set of TSqliteOption;
@ -132,7 +129,7 @@ type
protected
FPrimaryKey: String;
FPrimaryKeyNo: Integer;
FFileName: String;
FFileName: UTF8String;
FSQL: String;
FEffectiveSQL: String;
FTableName: String;
@ -156,7 +153,7 @@ type
FSaveOnRefetch: Boolean;
FAutoIncrementKey: Boolean;
FDataAllocated: Boolean;
function SqliteExec(Sql: PChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer; virtual; abstract;
function SqliteExec(Sql: PAnsiChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer; virtual; abstract;
procedure InternalCloseHandle; virtual; abstract;
function InternalGetHandle: Pointer; virtual; abstract;
function FieldDefsStored: Boolean;
@ -171,7 +168,7 @@ type
function GetMasterFields: String;
procedure SetMasterSource(Value: TDataSource);
function GetMasterSource: TDataSource;
procedure SetFileName(const Value: String);
procedure SetFileName(const Value: UTF8String);
function GetRowsAffected: Integer; virtual; abstract;
procedure RetrieveFieldDefs; virtual; abstract;
//TDataSet overrides
@ -231,7 +228,7 @@ type
procedure ExecSQL(ASqlList: TStrings);
procedure ExecSQLList;
procedure ExecuteDirect(const ASql: String); virtual; abstract;
function GetSQLValue(Values: PPChar; FieldIndex: Integer): String;
function GetSQLValue(Values: PPAnsiChar; FieldIndex: Integer): String;
procedure QueryUpdates(RecordStates: TRecordStateSet; Callback: TQueryUpdatesCallback; UserData: Pointer = nil);
function QuickQuery(const ASql: String):String;overload;
function QuickQuery(const ASql: String; const AStrList: TStrings): String; overload;
@ -258,7 +255,7 @@ type
published
property AutoIncrementKey: Boolean read FAutoIncrementKey write FAutoIncrementKey default False;
property IndexFieldNames: string read FIndexFieldNames write FIndexFieldNames;
property FileName: String read FFileName write SetFileName;
property FileName: UTF8String read FFileName write SetFileName;
property OnCallback: TSqliteCallback read FOnCallback write FOnCallback;
property OnGetHandle: TDataSetNotifyEvent read FOnGetHandle write FOnGetHandle;
property Options: TSqliteOptions read FOptions write SetOptions default [];
@ -299,8 +296,8 @@ type
property OnPostError;
end;
function Num2SQLStr(APChar: PChar): String;
function Char2SQLStr(APChar: PChar): String;
function Num2SQLStr(APChar: PAnsiChar): String;
function Char2SQLStr(APChar: PAnsiChar): String;
implementation
@ -316,13 +313,13 @@ const
NullString = 'NULL';
function CallbackDispatcher(UserData: Pointer; Count: LongInt; Values: PPchar; Names: PPchar): LongInt; cdecl;
function CallbackDispatcher(UserData: Pointer; Count: LongInt; Values: PPAnsiChar; Names: PPAnsiChar): LongInt; cdecl;
begin
with PCallbackInfo(UserData)^ do
Result:= Proc(Data, Count, Values, Names);
end;
function Num2SQLStr(APChar: PChar): String;
function Num2SQLStr(APChar: PAnsiChar): String;
begin
if APChar = nil then
begin
@ -332,14 +329,14 @@ begin
Result := String(APChar);
end;
function Char2SQLStr(APChar: PChar): String;
function Char2SQLStr(APChar: PAnsiChar): String;
begin
if APChar = nil then
begin
Result := NullString;
Exit;
end;
//todo: create custom routine to directly transform PChar -> SQL str
//todo: create custom routine to directly transform PAnsiChar -> SQL str
Result := String(APChar);
if Pos('''', Result) > 0 then
Result := AnsiReplaceStr(Result, '''', '''''');
@ -394,7 +391,7 @@ end;
function TDSStream.Write(const Buffer; Count: LongInt): LongInt;
var
NewRow: PChar;
NewRow: PAnsiChar;
begin
Result := Count;
if Count > 0 then
@ -703,7 +700,7 @@ function TCustomSqliteDataset.GetFieldData(Field: TField; Buffer: Pointer;
NativeFormat: Boolean): Boolean;
var
ValError: Word;
FieldRow: PChar;
FieldRow: PAnsiChar;
FieldOffset: Integer;
begin
if Field.FieldNo >= 0 then
@ -722,7 +719,7 @@ begin
case Field.Datatype of
ftString:
begin
Move(FieldRow^, PChar(Buffer)^, StrLen(FieldRow) + 1);
Move(FieldRow^, PAnsiChar(Buffer)^, StrLen(FieldRow) + 1);
end;
ftInteger, ftAutoInc:
begin
@ -1023,7 +1020,7 @@ begin
end;
type
TLocateCompareFunction = function (Value: PChar; const Key: String): Boolean;
TLocateCompareFunction = function (Value: PAnsiChar; const Key: String): Boolean;
TLocateFieldInfo = record
Index: Integer;
@ -1031,7 +1028,7 @@ type
CompFunction: TLocateCompareFunction;
end;
function CompInsensitivePartial(UTF8Value: PChar; const AnsiKey: String): Boolean;
function CompInsensitivePartial(UTF8Value: PAnsiChar; const AnsiKey: String): Boolean;
var
AnsiValue: AnsiString;
begin
@ -1039,21 +1036,21 @@ begin
if UTF8Value <> nil then
begin
AnsiValue := UTF8Decode(UTF8Value);
Result := AnsiStrLIComp(PChar(AnsiValue), PChar(AnsiKey), Length(AnsiKey)) = 0;
Result := AnsiStrLIComp(PAnsiChar(AnsiValue), PAnsiChar(AnsiKey), Length(AnsiKey)) = 0;
end
else
Result := False;
end;
function CompSensitivePartial(UTF8Value: PChar; const UTF8Key: String): Boolean;
function CompSensitivePartial(UTF8Value: PAnsiChar; const UTF8Key: String): Boolean;
begin
if UTF8Value <> nil then
Result := StrLComp(UTF8Value, PChar(UTF8Key), Length(UTF8Key)) = 0
Result := StrLComp(UTF8Value, PAnsiChar(UTF8Key), Length(UTF8Key)) = 0
else
Result := False;
end;
function CompInsensitive(UTF8Value: PChar; const AnsiKey: String): Boolean;
function CompInsensitive(UTF8Value: PAnsiChar; const AnsiKey: String): Boolean;
begin
//fpc does not provide a function to compare UTF8 directly, so convert the
//UTF8Value string to ansi through a temporary widestring and compare with the
@ -1067,15 +1064,15 @@ begin
Result := False;
end;
function CompSensitive(UTF8Value: PChar; const UTF8Key: String): Boolean;
function CompSensitive(UTF8Value: PAnsiChar; const UTF8Key: String): Boolean;
begin
if UTF8Value <> nil then
Result := StrComp(UTF8Value, PChar(UTF8Key)) = 0
Result := StrComp(UTF8Value, PAnsiChar(UTF8Key)) = 0
else
Result := False;
end;
function CompSensitiveWild(UTF8Value: PChar; const UTF8Key: String): Boolean;
function CompSensitiveWild(UTF8Value: PAnsiChar; const UTF8Key: String): Boolean;
begin
if UTF8Value <> nil then
Result := IsWild(String(UTF8Value), UTF8Key, False)
@ -1083,7 +1080,7 @@ begin
Result := False;
end;
function CompDouble(UTF8Value: PChar; const UTF8Key: String): Boolean;
function CompDouble(UTF8Value: PAnsiChar; const UTF8Key: String): Boolean;
var e1,e2:double;
begin
if UTF8Value <> nil then
@ -1096,7 +1093,7 @@ begin
Result := False;
end;
function CompInsensitiveWild(UTF8Value: PChar; const AnsiKey: String): Boolean;
function CompInsensitiveWild(UTF8Value: PAnsiChar; const AnsiKey: String): Boolean;
begin
//IsWild does not work with UTF8 encoded strings for case insensitive searches,
//so convert UTF8Value to the system ansi encoding before passing to IsWild.
@ -1363,13 +1360,13 @@ begin
case Field.Datatype of
ftString:
begin
EditItem^.Row[FieldOffset] := StrNew(PChar(Buffer));
EditItem^.Row[FieldOffset] := StrNew(PAnsiChar(Buffer));
end;
ftInteger:
begin
Str(LongInt(Buffer^), TempStr);
EditItem^.Row[FieldOffset] := StrAlloc(Length(TempStr) + 1);
Move(PChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
Move(PAnsiChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
end;
ftBoolean, ftWord:
begin
@ -1379,19 +1376,19 @@ begin
else
Str(Word(Buffer^), TempStr);
EditItem^.Row[FieldOffset] := StrAlloc(Length(TempStr) + 1);
Move(PChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
Move(PAnsiChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
end;
ftFloat, ftDateTime, ftDate, ftTime, ftCurrency:
begin
Str(Double(Buffer^), TempStr);
EditItem^.Row[FieldOffset] := StrAlloc(Length(TempStr) + 1);
Move(PChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
Move(PAnsiChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
end;
ftLargeInt:
begin
Str(Int64(Buffer^), TempStr);
EditItem^.Row[FieldOffset] := StrAlloc(Length(TempStr) + 1);
Move(PChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
Move(PAnsiChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
end;
end;// case
end//if
@ -1517,7 +1514,7 @@ begin
Result := FMasterLink.DataSource;
end;
procedure TCustomSqliteDataset.SetFileName(const Value: String);
procedure TCustomSqliteDataset.SetFileName(const Value: UTF8String);
begin
if Value <> FFileName then
begin
@ -1545,7 +1542,7 @@ procedure TCustomSqliteDataset.ExecSQL(ASqlList: TStrings);
begin
if FSqliteHandle = nil then
GetSqliteHandle;
FReturnCode := SqliteExec(PChar(ASQLList.Text), nil, nil);
FReturnCode := SqliteExec(PAnsiChar(ASQLList.Text), nil, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);
end;
@ -1555,7 +1552,7 @@ begin
ExecSQL(SQLList);
end;
function TCustomSqliteDataset.GetSQLValue(Values: PPChar; FieldIndex: Integer): String;
function TCustomSqliteDataset.GetSQLValue(Values: PPAnsiChar; FieldIndex: Integer): String;
begin
if (State = dsInactive) or (FieldIndex < 0) or (FieldIndex >= FieldDefs.Count) then
DatabaseError('Error retrieving SQL value: dataset inactive or field out of range', Self);
@ -1615,7 +1612,7 @@ begin
if StatementsCounter = 400 then
begin
SQLTemp := SQLTemp + 'COMMIT;';
FReturnCode := SqliteExec(PChar(SQLTemp), nil, nil);
FReturnCode := SqliteExec(PAnsiChar(SQLTemp), nil, nil);
StatementsCounter := 0;
SQLTemp := 'BEGIN;';
if FReturnCode <> SQLITE_OK then
@ -1649,7 +1646,7 @@ begin
if StatementsCounter = 400 then
begin
SQLTemp := SQLTemp + 'COMMIT;';
FReturnCode := SqliteExec(PChar(SQLTemp), nil, nil);
FReturnCode := SqliteExec(PAnsiChar(SQLTemp), nil, nil);
StatementsCounter := 0;
SQLTemp := 'BEGIN;';
if FReturnCode <> SQLITE_OK then
@ -1681,7 +1678,7 @@ begin
if StatementsCounter = 400 then
begin
SQLTemp := SQLTemp + 'COMMIT;';
FReturnCode := SqliteExec(PChar(SQLTemp), nil, nil);
FReturnCode := SqliteExec(PAnsiChar(SQLTemp), nil, nil);
StatementsCounter := 0;
SQLTemp := 'BEGIN;';
if FReturnCode <> SQLITE_OK then
@ -1698,7 +1695,7 @@ begin
if FReturnCode = SQLITE_OK then
begin
SQLTemp := SQLTemp + 'COMMIT;';
FReturnCode := SqliteExec(PChar(SQLTemp), nil, nil);
FReturnCode := SqliteExec(PAnsiChar(SQLTemp), nil, nil);
if FReturnCode <> SQLITE_OK then
SqliteExec('ROLLBACK;', nil, nil);
end;
@ -1802,7 +1799,7 @@ begin
GetSqliteHandle;
CallbackInfo.Data := UserData;
CallbackInfo.Proc := FOnCallback;
SqliteExec(PChar(ASQL), @CallbackDispatcher, @CallbackInfo);
SqliteExec(PAnsiChar(ASQL), @CallbackDispatcher, @CallbackInfo);
end;

View File

@ -51,7 +51,7 @@ type
procedure InternalCloseHandle; override;
function InternalGetHandle: Pointer; override;
procedure RetrieveFieldDefs; override;
function SqliteExec(ASQL: PChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer; override;
function SqliteExec(ASQL: PAnsiChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer; override;
public
procedure ExecuteDirect(const ASQL: String); override;
function QuickQuery(const ASQL: String; const AStrList: TStrings; FillObjects: Boolean): String; override;
@ -101,7 +101,7 @@ begin
end;
end;
function GetAutoIncValue(NextValue: Pointer; Columns: Integer; ColumnValues: PPChar; ColumnNames: PPChar): Integer; cdecl;
function GetAutoIncValue(NextValue: Pointer; Columns: Integer; ColumnValues: PPAnsiChar; ColumnNames: PPAnsiChar): Integer; cdecl;
var
CodeError, TempInt: Integer;
begin
@ -118,7 +118,7 @@ end;
{ TSqlite3Dataset }
function TSqlite3Dataset.SqliteExec(ASQL: PChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer;
function TSqlite3Dataset.SqliteExec(ASQL: PAnsiChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer;
begin
Result := sqlite3_exec(FSqliteHandle, ASQL, ACallback, Data, nil);
end;
@ -138,7 +138,7 @@ var
vm: Pointer;
ErrorStr: String;
begin
sqlite3_open(PChar(FFileName), @Result);
sqlite3_open(PAnsiChar(FFileName), @Result);
//sqlite3_open returns SQLITE_OK even for invalid files
//do additional check here
FReturnCode := sqlite3_prepare(Result, CheckFileSql, -1, @vm, nil);
@ -163,7 +163,7 @@ begin
{$endif}
FAutoIncFieldNo := -1;
FieldDefs.Clear;
FReturnCode := sqlite3_prepare(FSqliteHandle, PChar(FEffectiveSQL), -1, @vm, nil);
FReturnCode := sqlite3_prepare(FSqliteHandle, PAnsiChar(FEffectiveSQL), -1, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);
sqlite3_step(vm);
@ -263,7 +263,7 @@ procedure TSqlite3Dataset.ExecuteDirect(const ASQL: String);
var
vm: Pointer;
begin
FReturnCode := sqlite3_prepare(FSqliteHandle, Pchar(ASQL), -1, @vm, nil);
FReturnCode := sqlite3_prepare(FSqliteHandle, PAnsiChar(ASQL), -1, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);
FReturnCode := sqlite3_step(vm);
@ -278,10 +278,10 @@ var
begin
//Get AutoInc Field initial value
if FAutoIncFieldNo <> -1 then
sqlite3_exec(FSqliteHandle, PChar('Select Max(' + FieldDefs[FAutoIncFieldNo].Name +
sqlite3_exec(FSqliteHandle, PAnsiChar('Select Max(' + FieldDefs[FAutoIncFieldNo].Name +
') from ' + FTableName), @GetAutoIncValue, @FNextAutoInc, nil);
FReturnCode := sqlite3_prepare(FSqliteHandle, PChar(FEffectiveSQL), -1, @vm, nil);
FReturnCode := sqlite3_prepare(FSqliteHandle, PAnsiChar(FEffectiveSQL), -1, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);
@ -294,7 +294,7 @@ begin
//add extra rows for calculated fields
if FCalcFieldList <> nil then
Inc(FRowCount, FCalcFieldList.Count);
FRowBufferSize := (SizeOf(PPChar) * FRowCount);
FRowBufferSize := (SizeOf(PPAnsiChar) * FRowCount);
FReturnCode := sqlite3_step(vm);
while FReturnCode = SQLITE_ROW do
begin
@ -367,7 +367,7 @@ begin
if FSqliteHandle = nil then
GetSqliteHandle;
Result := '';
FReturnCode := sqlite3_prepare(FSqliteHandle,Pchar(ASQL), -1, @vm, nil);
FReturnCode := sqlite3_prepare(FSqliteHandle,PAnsiChar(ASQL), -1, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);

View File

@ -53,7 +53,7 @@ type
function InternalGetHandle: Pointer; override;
procedure InternalCloseHandle; override;
procedure RetrieveFieldDefs; override;
function SqliteExec(ASQL: PChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer; override;
function SqliteExec(ASQL: PAnsiChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer; override;
public
procedure ExecuteDirect(const ASQL: String); override;
function QuickQuery(const ASQL: String; const AStrList: TStrings; FillObjects: Boolean): String; override;
@ -69,7 +69,7 @@ uses
//function sqlite_last_statement_changes(dbhandle:Pointer):longint;cdecl;external 'sqlite' name 'sqlite_last_statement_changes';
function GetAutoIncValue(NextValue: Pointer; Columns: Integer; ColumnValues: PPChar; ColumnNames: PPChar): Integer; cdecl;
function GetAutoIncValue(NextValue: Pointer; Columns: Integer; ColumnValues: PPAnsiChar; ColumnNames: PPAnsiChar): Integer; cdecl;
var
CodeError, TempInt: Integer;
begin
@ -86,7 +86,7 @@ end;
{ TSqliteDataset }
function TSqliteDataset.SqliteExec(ASQL: PChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer;
function TSqliteDataset.SqliteExec(ASQL: PAnsiChar; ACallback: TSqliteCdeclCallback; Data: Pointer): Integer;
begin
Result := sqlite_exec(FSqliteHandle, ASQL, ACallback, Data, nil);
end;
@ -99,9 +99,9 @@ end;
function TSqliteDataset.InternalGetHandle: Pointer;
var
ErrorStr: PChar;
ErrorStr: PAnsiChar;
begin
Result := sqlite_open(PChar(FFileName), 0, @ErrorStr);
Result := sqlite_open(PAnsiChar(FFileName), 0, @ErrorStr);
if Result = nil then
begin
DatabaseError('Error opening "' + FFileName + '": ' + String(ErrorStr));
@ -114,12 +114,12 @@ var
ColumnCount, i, DataSize:Integer;
AType: TFieldType;
vm: Pointer;
ColumnNames, ColumnValues:PPChar;
ColumnNames, ColumnValues:PPAnsiChar;
ColumnStr: String;
begin
FieldDefs.Clear;
FAutoIncFieldNo := -1;
FReturnCode := sqlite_compile(FSqliteHandle, PChar(FEffectiveSQL), nil, @vm, nil);
FReturnCode := sqlite_compile(FSqliteHandle, PAnsiChar(FEffectiveSQL), nil, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);
sqlite_step(vm, @ColumnCount, @ColumnValues, @ColumnNames);
@ -207,10 +207,10 @@ end;
procedure TSqliteDataset.ExecuteDirect(const ASQL: String);
var
vm: Pointer;
ColumnNames, ColumnValues: PPChar;
ColumnNames, ColumnValues: PPAnsiChar;
ColCount: Integer;
begin
FReturnCode := sqlite_compile(FSqliteHandle, Pchar(ASQL), nil, @vm, nil);
FReturnCode := sqlite_compile(FSqliteHandle, PAnsiChar(ASQL), nil, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString,Self);
@ -223,15 +223,15 @@ procedure TSqliteDataset.BuildLinkedList;
var
TempItem: PDataRecord;
vm: Pointer;
ColumnNames, ColumnValues: PPChar;
ColumnNames, ColumnValues: PPAnsiChar;
Counter, ColumnCount: Integer;
begin
//Get AutoInc Field initial value
if FAutoIncFieldNo <> -1 then
sqlite_exec(FSqliteHandle, PChar('Select Max(' + FieldDefs[FAutoIncFieldNo].Name + ') from ' + FTableName),
sqlite_exec(FSqliteHandle, PAnsiChar('Select Max(' + FieldDefs[FAutoIncFieldNo].Name + ') from ' + FTableName),
@GetAutoIncValue, @FNextAutoInc, nil);
FReturnCode := sqlite_compile(FSqliteHandle, PChar(FEffectiveSQL), nil, @vm, nil);
FReturnCode := sqlite_compile(FSqliteHandle, PAnsiChar(FEffectiveSQL), nil, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString, Self);
@ -244,7 +244,7 @@ begin
//add extra rows for calculated fields
if FCalcFieldList <> nil then
Inc(FRowCount, FCalcFieldList.Count);
FRowBufferSize := (SizeOf(PPChar) * FRowCount);
FRowBufferSize := (SizeOf(PPAnsiChar) * FRowCount);
while FReturnCode = SQLITE_ROW do
begin
@ -339,7 +339,7 @@ end;
function TSqliteDataset.QuickQuery(const ASQL: String; const AStrList: TStrings; FillObjects: Boolean): String;
var
vm: Pointer;
ColumnNames, ColumnValues: PPChar;
ColumnNames, ColumnValues: PPAnsiChar;
ColCount: Integer;
procedure FillStrings;
@ -364,7 +364,7 @@ begin
if FSqliteHandle = nil then
GetSqliteHandle;
Result := '';
FReturnCode := sqlite_compile(FSqliteHandle, PChar(ASQL), nil, @vm, nil);
FReturnCode := sqlite_compile(FSqliteHandle, PAnsiChar(ASQL), nil, @vm, nil);
if FReturnCode <> SQLITE_OK then
DatabaseError(ReturnString,Self);