Index: src/component/ZDatasetUtils.pas
===================================================================
--- src/component/ZDatasetUtils.pas (revision 564)
+++ src/component/ZDatasetUtils.pas (working copy)
@@ -301,7 +301,7 @@
stFloat, stDouble, stBigDecimal:
Result := ftFloat;
stString:
- Result := {$IFDEF DELPHI12_UP}ftWideString{$ELSE}ftString{$ENDIF};
+ Result := ftString;
stBytes:
Result := ftBytes;
stDate:
@@ -443,9 +443,7 @@
ftCurrency:
RowAccessor.SetBigDecimal(FieldIndex, ResultSet.GetBigDecimal(ColumnIndex));
ftString:
- // gto: do we need PChar here?
- //RowAccessor.SetPChar(FieldIndex, ResultSet.GetPChar(ColumnIndex));
- RowAccessor.SetString(FieldIndex, ResultSet.GetString(ColumnIndex));
+ RowAccessor.SetPChar(FieldIndex, ResultSet.GetPChar(ColumnIndex));
ftWidestring:
RowAccessor.SetUnicodeString(FieldIndex, ResultSet.GetUnicodeString(ColumnIndex));
ftBytes:
@@ -514,9 +512,7 @@
ResultSet.UpdateBigDecimal(ColumnIndex,
RowAccessor.GetBigDecimal(FieldIndex, WasNull));
ftString:
- // gto: do we need PChar here?
- //ResultSet.UpdatePChar(ColumnIndex, RowAccessor.GetPChar(FieldIndex, WasNull));
- ResultSet.UpdateString(ColumnIndex, RowAccessor.GetString(FieldIndex, WasNull));
+ ResultSet.UpdatePChar(ColumnIndex, RowAccessor.GetPChar(FieldIndex, WasNull));
ftWidestring:
ResultSet.UpdateUnicodeString(ColumnIndex,
RowAccessor.GetUnicodeString(FieldIndex, WasNull));
@@ -650,11 +646,9 @@
Current := DataSet.FindField(Expression.DefaultVariables.Names[I]);
if Current <> nil then
Result[I] := Current
- else
- Result[I] := nil;
+ else Result[I] := nil;
end;
- end
- else
+ end else
SetLength(Result, 0);
end;
@@ -775,8 +769,7 @@
begin
for I := 0 to Length(Fields) - 1 do
begin
- if Fields[I] = nil then
- Continue;
+ if Fields[I] = nil then Continue;
ColumnIndex := TField(Fields[I]).FieldNo;
if not ResultSet.IsNull(ColumnIndex) then
@@ -839,8 +832,7 @@
if PartialKey then
begin
Result := AnsiStrLComp(PChar(Value2), PChar(Value1), Length(Value1)) = 0;
- end
- else
+ end else
Result := Value1 = Value2;
end
else
@@ -850,8 +842,7 @@
Value1 := SoftVarManager.GetAsString(KeyValues[I]);
Value2 := SoftVarManager.GetAsString(RowValues[I]);
Result := AnsiStrLComp(PChar(Value2), PChar(Value1), Length(Value1)) = 0;
- end
- else
+ end else
Result := SoftVarManager.Compare(KeyValues[I], RowValues[I]) = 0;
end;
@@ -997,8 +988,7 @@
if KeyValues[I].VType = vtNull then
begin
Result := ResultSet.IsNull(ColumnIndex);
- if not Result then
- Break;
+ if not Result then Break;
Continue;
end;
@@ -1078,7 +1068,7 @@
end;
end;
- Result := Result and not ResultSet.WasNull;
+// Result := Result and not ResultSet.WasNull;
if not Result then
Break;
end;
@@ -1363,33 +1353,27 @@
Item: string;
begin
Result := 0;
- if (Content = nil) or (Content^ = #0) or (Strings = nil) then
- Exit;
+ if (Content = nil) or (Content^=#0) or (Strings = nil) then Exit;
Tail := Content;
InQuote := False;
QuoteChar := #0;
Strings.BeginUpdate;
try
repeat
- while Tail^ in WhiteSpace + [#13, #10] do
- Inc(Tail);
+ while Tail^ in WhiteSpace + [#13, #10] do Inc(Tail);
Head := Tail;
while True do
begin
while (InQuote and not (Tail^ in [QuoteChar, #0])) or
- not (Tail^ in Separators + [#0, #13, #10, '''', '"']) do
- Inc(Tail);
+ not (Tail^ in Separators + [#0, #13, #10, '''', '"']) do Inc(Tail);
if Tail^ in ['''', '"'] then
begin
if (QuoteChar <> #0) and (QuoteChar = Tail^) then
QuoteChar := #0
- else
- QuoteChar := Tail^;
+ else QuoteChar := Tail^;
InQuote := QuoteChar <> #0;
Inc(Tail);
- end
- else
- Break;
+ end else Break;
end;
EOS := Tail^ = #0;
if (Head <> Tail) and (Head^ <> #0) then
Index: src/core/ZSysUtils.pas
===================================================================
--- src/core/ZSysUtils.pas (revision 564)
+++ src/core/ZSysUtils.pas (working copy)
@@ -89,26 +89,15 @@
}
function LastDelimiter(const Delimiters, Str: string): Integer;
-
-{$IFDEF DELPHI12_UP}
{**
- Compares two PWideChars without stopping at #0 (Unicode Version)
- @param P1 first PWideChars
- @param P2 seconds PWideChars
- @return True if the memory at P1 and P2 are equal
+ Compares two PChars without stopping at #0
+ @param P1 first PChar
+ @param P2 seconds PChar
+ @return True if the memory at P1 and P2 are equal
}
-function MemLCompUnicode(P1, P2: PChar; Len: Integer): Boolean;
-{$ENDIF}
+function MemLComp(P1, P2: PChar; Len: Integer): Boolean;
{**
- Compares two PAnsiChars without stopping at #0
- @param P1 first PAnsiChar
- @param P2 seconds PAnsiChar
- @return True if the memory at P1 and P2 are equal
-}
-function MemLCompAnsi(P1, P2: PAnsiChar; Len: Integer): Boolean;
-
-{**
Checks is the string starts with substring.
@param Str a string to be checked.
@param SubStr a string to test at the start of the Str.
@@ -145,8 +134,7 @@
@param Length a buffer length.
@return a string retrived from the buffer.
}
-function BufferToStr(Buffer: PWideChar; Length: LongInt): string; overload;
-function BufferToStr(Buffer: PAnsiChar; Length: LongInt): string; overload;
+function BufferToStr(Buffer: PChar; Length: LongInt): string;
{**
Converts a string into boolean value.
@@ -237,18 +225,18 @@
procedure AppendSplitStringEx(List: TStrings; const Str, Delimiter: string);
{**
- Converts bytes into a AnsiString representation.
+ Converts bytes into a string representation.
@param Value an array of bytes to be converted.
- @return a converted AnsiString.
+ @return a converted string.
}
-function BytesToStr(const Value: TByteDynArray): AnsiString;
+function BytesToStr(const Value: TByteDynArray): string;
{**
- Converts AnsiString into an array of bytes.
- @param Value a AnsiString to be converted.
+ Converts string into an array of bytes.
+ @param Value a string to be converted.
@return a converted array of bytes.
}
-function StrToBytes(const Value: AnsiString): TByteDynArray;
+function StrToBytes(const Value: string): TByteDynArray;
{**
Converts bytes into a variant representation.
@@ -351,9 +339,25 @@
}
function FormatSQLVersion( const SQLVersion: Integer ): String;
+{$IFOPT D+}
+{$IFNDEF FPC}
+{**
+ Calculates the amount of allocated/deallocated memory since last call of this function
+ @return Amount of allocated/deallocated memory since last call of this function
+}
+function debug_get_memorydiff: Integer;
+{$ENDIF}
+{$ENDIF}
+
implementation
uses ZMatchPattern;
+{$IFOPT D+}
+{$IFNDEF FPC}
+var
+ debug_last_used_memory : integer;
+{$ENDIF}
+{$ENDIF}
{**
Determines a position of a first delimiter.
@@ -396,15 +400,13 @@
end;
end;
-
-{$IFDEF DELPHI12_UP}
{**
- Compares two PWideChars without stopping at #0 (Unicode Version)
- @param P1 first PWideChar
- @param P2 seconds PWideChar
+ Compares two PChars without stopping at #0
+ @param P1 first PChar
+ @param P2 seconds PChar
@return True if the memory at P1 and P2 are equal
}
-function MemLCompUnicode(P1, P2: PWideChar; Len: Integer): Boolean;
+function MemLComp(P1, P2: PChar; Len: Integer): Boolean;
begin
while (Len > 0) and (P1^ = P2^) do
begin
@@ -414,26 +416,8 @@
end;
Result := Len = 0;
end;
-{$ENDIF}
{**
- Compares two PAnsiChars without stopping at #0
- @param P1 first PAnsiChar
- @param P2 seconds PAnsiChar
- @return True if the memory at P1 and P2 are equal
-}
-function MemLCompAnsi(P1, P2: PAnsiChar; Len: Integer): Boolean;
-begin
- while (Len > 0) and (P1^ = P2^) do
- begin
- Inc(P1);
- Inc(P2);
- Dec(Len);
- end;
- Result := Len = 0;
-end;
-
-{**
Checks is the string starts with substring.
@param Str a string to be checked.
@param SubStr a string to test at the start of the Str.
@@ -446,13 +430,10 @@
LenSubStr := Length(SubStr);
if SubStr = '' then
Result := True
- else if LenSubStr <= Length(Str) then
+ else
+ if LenSubStr <= Length(Str) then
//Result := Copy(Str, 1, Length(SubStr)) = SubStr;
- {$IFDEF DELPHI12_UP}
- Result := MemLCompUnicode(PChar(Str), PChar(SubStr), LenSubStr)
- {$ELSE}
- Result := MemLCompAnsi(PChar(Str), PChar(SubStr), LenSubStr)
- {$ENDIF}
+ Result := MemLComp(PChar(Str), PChar(SubStr), LenSubStr)
else
Result := False;
end;
@@ -476,13 +457,7 @@
LenStr := Length(Str);
if LenSubStr <= LenStr then
//Result := Copy(Str, LenStr - LenSubStr + 1, LenSubStr) = SubStr
- {$IFDEF DELPHI12_UP}
- Result := MemLCompUnicode(PChar(Pointer(Str)) + LenStr - LenSubStr,
- Pointer(SubStr), LenSubStr)
- {$ELSE}
- Result := MemLCompAnsi(PChar(Pointer(Str)) + LenStr - LenSubStr,
- Pointer(SubStr), LenSubStr)
- {$ENDIF}
+ Result := MemLComp(PChar(Pointer(Str)) + LenStr - LenSubStr, Pointer(SubStr), LenSubStr)
else
Result := False;
end;
@@ -496,39 +471,29 @@
}
function SQLStrToFloatDef(Str: string; Def: Extended): Extended;
var
- {$IFDEF DELPHI12_UP}
- OldDecimalSeparator: WideChar;
- {$ELSE}
OldDecimalSeparator: Char;
- {$ENDIF}
begin
OldDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.';
if Pos('$', Str) = 1 then
Str := Copy(Str, 2, Pred(Length(Str)));
- If Str = '' then
- Result := Def
- else
- begin
- {$IFDEF FPC}
- if OldDecimalSeparator = ',' then
- try
- DecimalSeparator := OldDecimalSeparator;
- Result := StrToFloat(Str);
- except
+{$IFDEF FPC}
+ if OldDecimalSeparator = ',' then
+ begin
+ DecimalSeparator := OldDecimalSeparator;
+ if not TryStrToFloat(Str,Result) then
Result := 0;
- end
- else
+ end
+ else
begin
Result := StrToFloatDef(Str, Def);
+ DecimalSeparator := OldDecimalSeparator;
end;
- {$ELSE}
- Result := StrToFloatDef(Str, Def);
- {$ENDIF}
- end;
+{$ELSE}
+ Result := StrToFloatDef(Str, Def);
DecimalSeparator := OldDecimalSeparator;
+{$ENDIF}
end;
-
{**
Converts SQL string into float value.
@param Str an SQL string with comma delimiter.
@@ -536,11 +501,7 @@
}
function SQLStrToFloat(const Str: string): Extended;
var
- {$IFDEF DELPHI12_UP}
- OldDecimalSeparator: WideChar;
- {$ELSE}
OldDecimalSeparator: Char;
- {$ENDIF}
begin
OldDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.';
@@ -552,22 +513,8 @@
end;
{ Convert string buffer into pascal string }
-
-function BufferToStr(Buffer: PWideChar; Length: LongInt): string;
-var s : Widestring;
+function BufferToStr(Buffer: PChar; Length: LongInt): string;
begin
- Result := '';
- if Assigned(Buffer) then
- begin
- SetString(s, Buffer, Length div SizeOf(Char));
- Result := s;
- end;
-end;
-
-{ Convert string buffer into pascal string }
-
-function BufferToStr(Buffer: PAnsiChar; Length: LongInt): string;
-begin
Result := '';
if Assigned(Buffer) then
SetString(Result, Buffer, Length);
@@ -617,25 +564,16 @@
begin
if I - Pos > 3 then
Break;
- if Str[I] = '.' then
- begin
+ if Str[I] = '.' then begin
if StrToInt(Copy(Str, Pos, I - Pos)) > 255 then
Break;
Inc(N);
Pos := I + 1;
end;
-{$IFDEF DELPHI12_UP}
- if CharInSet(Str[I], ['0'..'9']) then
- Inc(M);
-{$ELSE}
- if Str[I] in ['0'..'9'] then
- Inc(M);
-{$ENDIF}
-
+ if Str[I] in ['0'..'9'] then Inc(M);
end;
Result := (M + N = Length(Str)) and (N = 3);
- end
- else
+ end else
Result := False;
end;
@@ -650,8 +588,7 @@
if DelimPos > 1 then
List.Add(Copy(Str, 1, DelimPos - 1));
Str := Copy(Str, DelimPos + 1, Length(Str) - DelimPos);
- end
- else
+ end else
Break;
until DelimPos <= 0;
if Str <> '' then
@@ -746,11 +683,7 @@
}
function FloatToSQLStr(Value: Extended): string;
var
- {$IFDEF DELPHI12_UP}
- OldDecimalSeparator: WideChar;
- {$ELSE}
OldDecimalSeparator: Char;
- {$ENDIF}
begin
OldDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.';
@@ -761,25 +694,19 @@
end;
end;
-{**
- Split a single string using the delimiter, appending the resulting strings
- to the List. (gto: New version, now unicode safe and without the bug which
- adds a blank line before the last found string)
- @param List a list to append the result.
- @param Str the source string
- @param Delimiters the delimiter string
-}
procedure SplitToStringListEx(List: TStrings; const Str, Delimiter: string);
var
- temp: string;
- i: integer;
+ Pos: integer;
+ Temp: string;
begin
- temp := Str + Delimiter;
- repeat
- i := List.Add(Copy(temp, 0, AnsiPos(Delimiter, temp) - 1));
- Delete(temp, 1, Length(List[i] + Delimiter));
- until
- temp = '';
+ Temp := Str;
+ repeat
+ Pos := AnsiPos(Delimiter, Temp);
+ List.Add(Copy(Temp, 1, Pos - 1));
+ Delete(Temp, 1, Pos + Length(Delimiter) - 1);
+ until Pos = 0;
+ if Temp <> '' then
+ List.Add(Temp);
end;
{**
@@ -824,21 +751,21 @@
end;
{**
- Converts bytes into a AnsiString representation.
+ Converts bytes into a string representation.
@param Value an array of bytes to be converted.
- @return a converted AnsiString.
+ @return a converted string.
}
-function BytesToStr(const Value: TByteDynArray): AnsiString;
+function BytesToStr(const Value: TByteDynArray): string;
begin
- SetString(Result, PAnsiChar(@Value[0]), Length(Value))
+ SetString(Result, PChar(@Value[0]), Length(Value))
end;
{**
- Converts AnsiString into an array of bytes.
- @param Value a AnsiString to be converted.
+ Converts string into an array of bytes.
+ @param Value a string to be converted.
@return a converted array of bytes.
}
-function StrToBytes(const Value: AnsiString): TByteDynArray;
+function StrToBytes(const Value: string): TByteDynArray;
begin
SetLength(Result, Length(Value));
if Value <> '' then
@@ -878,7 +805,7 @@
end;
{**
- Converts Ansi SQL Date/Time (yyyy-mm-dd hh:nn:ss) to TDateTime
+ Converts Ansi SQL Date/Time to TDateTime
@param Value a date and time string.
@return a decoded TDateTime value.
}
@@ -912,8 +839,7 @@
try
if Result >= 0 then
Result := Result + EncodeTime(Hour, Min, Sec, 0)
- else
- Result := Result - EncodeTime(Hour, Min, Sec, 0)
+ else Result := Result - EncodeTime(Hour, Min, Sec, 0)
except
end;
end;
@@ -935,51 +861,35 @@
StrPosPrev:= StrPos;
Result:= false;
while StrPos<=StrLength do
- if pos(Value[StrPos], matchchars) > 0 then
- begin
- inc(StrPos);
- Result := true;
- end
- else
- break;
+ if pos(Value[StrPos],matchchars)>0 then begin inc(StrPos); Result:= true; end
+ else break;
end;
begin
Result := 0;
StrPos:= 1;
StrLength := Length(Value);
- if not CharMatch('1234567890') then
- exit; // year
+ if not CharMatch('1234567890') then exit; // year
Year := StrToIntDef(Copy(Value, StrPosPrev, StrPos-StrPosPrev), 0);
- if not CharMatch('-/\') then
- exit;
- if not CharMatch('1234567890') then
- exit; // month
+ if not CharMatch('-/\') then exit;
+ if not CharMatch('1234567890') then exit; // month
Month:= StrToIntDef(Copy(Value, StrPosPrev, StrPos-StrPosPrev), 0);
- if not CharMatch('-/\') then
- exit;
- if not CharMatch('1234567890') then
- exit; // day
+ if not CharMatch('-/\') then exit;
+ if not CharMatch('1234567890') then exit; // day
Day:= StrToIntDef(Copy(Value, StrPosPrev, StrPos-StrPosPrev), 0);
try
Result := EncodeDate(Year, Month, Day);
except
end;
//
- if not CharMatch(' ') then
- exit;
- if not CharMatch('1234567890') then
- exit; // hour
+ if not CharMatch(' ') then exit;
+ if not CharMatch('1234567890') then exit; // hour
Hour := StrToIntDef(Copy(Value, StrPosPrev, StrPos-StrPosPrev), 0);
- if not CharMatch('-/\') then
- exit;
- if not CharMatch('1234567890') then
- exit; // minute
+ if not CharMatch('-/\') then exit;
+ if not CharMatch('1234567890') then exit; // minute
Min:= StrToIntDef(Copy(Value, StrPosPrev, StrPos-StrPosPrev), 0);
- if not CharMatch('-/\') then
- exit;
- if not CharMatch('1234567890') then
- exit; // second
+ if not CharMatch('-/\') then exit;
+ if not CharMatch('1234567890') then exit; // second
Sec:= StrToIntDef(Copy(Value, StrPosPrev, StrPos-StrPosPrev), 0);
try
Result := REsult + EncodeTime(Hour, Min, Sec,0);
@@ -1060,19 +970,11 @@
DestLength := 0;
for I := 1 to SrcLength do
begin
-{$IFDEF DELPHI12_UP}
- if CharInSet(SrcBuffer^, [#0]) then
- Inc(DestLength, 4)
- else if CharInSet(SrcBuffer^, ['"', '''', '\']) then
- Inc(DestLength, 2)
-{$ELSE}
if SrcBuffer^ in [#0] then
Inc(DestLength, 4)
else if SrcBuffer^ in ['"', '''', '\'] then
Inc(DestLength, 2)
-{$ENDIF}
- else
- Inc(DestLength);
+ else Inc(DestLength);
Inc(SrcBuffer);
end;
@@ -1082,11 +984,7 @@
for I := 1 to SrcLength do
begin
-{$IFDEF DELPHI12_UP}
- if CharInSet(SrcBuffer^, [#0]) then
-{$ELSE}
if SrcBuffer^ in [#0] then
-{$ENDIF}
begin
DestBuffer[0] := '\';
DestBuffer[1] := Chr(Ord('0') + (Byte(SrcBuffer^) shr 6));
@@ -1094,11 +992,7 @@
DestBuffer[3] := Chr(Ord('0') + (Byte(SrcBuffer^) and $07));
Inc(DestBuffer, 4);
end
-{$IFDEF DELPHI12_UP}
- else if CharInSet(SrcBuffer^, ['"', '''', '\']) then
-{$ELSE}
else if SrcBuffer^ in ['"', '''', '\'] then
-{$ENDIF}
begin
DestBuffer[0] := '\';
DestBuffer[1] := SrcBuffer^;
@@ -1134,11 +1028,7 @@
if SrcBuffer^ = '\' then
begin
Inc(SrcBuffer);
-{$IFDEF DELPHI12_UP}
- if CharInSet(SrcBuffer^, ['0'..'9']) then
-{$ELSE}
if SrcBuffer^ in ['0'..'9'] then
-{$ENDIF}
begin
DestBuffer^ := Chr(((Byte(SrcBuffer[0]) - Ord('0')) shl 6)
or ((Byte(SrcBuffer[1]) - Ord('0')) shl 3)
@@ -1152,8 +1042,7 @@
'r': DestBuffer^ := #13;
'n': DestBuffer^ := #10;
't': DestBuffer^ := #9;
- else
- DestBuffer^ := SrcBuffer^;
+ else DestBuffer^ := SrcBuffer^;
end;
Inc(SrcBuffer);
Dec(SrcLength, 2);
@@ -1221,8 +1110,8 @@
out MajorVersion: Integer; out MinorVersion: Integer;
out SubVersion: Integer);
begin
- MajorVersion := FullVersion div 1000000;
- MinorVersion := (FullVersion - (MajorVersion * 1000000)) div 1000;
+ MajorVersion := FullVersion DIV 1000000;
+ MinorVersion := (FullVersion-(MajorVersion*1000000)) DIV 1000;
SubVersion := FullVersion-(MajorVersion*1000000)-(MinorVersion*1000);
end;
@@ -1249,13 +1138,25 @@
@param SQLVersion an integer
@return Formated Zeos SQL Version Value.
}
-
-function FormatSQLVersion(const SQLVersion: Integer): string;
-var
- MajorVersion, MinorVersion, SubVersion: Integer;
+function FormatSQLVersion( const SQLVersion: Integer ): String;
+var MajorVersion, MinorVersion, SubVersion: Integer;
begin
DecodeSQLVersioning(SQLVersion, MajorVersion, MinorVersion, SubVersion);
Result := IntToStr(MajorVersion)+'.'+IntToStr(MinorVersion)+'.'+IntToStr(SubVersion);
end;
+{$IFOPT D+}
+{$IFNDEF FPC}
+{**
+ Calculates the amount of allocated/deallocated memory since last call of this function
+ @return Amount of allocated/deallocated memory since last call of this function
+}
+function debug_get_memorydiff: Integer;
+begin
+ result := AllocMemsize - debug_last_used_memory;
+ debug_last_used_memory := AllocMemsize;
+end;
+{$ENDIF}
+{$ENDIF}
+
end.
Index: src/plain/ZPlainSqLite3.pas
===================================================================
--- src/plain/ZPlainSqLite3.pas (revision 564)
+++ src/plain/ZPlainSqLite3.pas (working copy)
@@ -1,376 +1,376 @@
-{@********************************************************}
-{ Copyright (c) 1999-2006 Zeos Development Group }
-{ }
-{ License Agreement: }
-{ }
-{ This library is distributed in the hope that it will be }
-{ useful, but WITHOUT ANY WARRANTY; without even the }
-{ implied warranty of MERCHANTABILITY or FITNESS FOR }
-{ A PARTICULAR PURPOSE. See the GNU Lesser General }
-{ Public License for more details. }
-{ }
-{ The source code of the ZEOS Libraries and packages are }
-{ distributed under the Library GNU General Public }
-{ License (see the file COPYING / COPYING.ZEOS) }
-{ with the following modification: }
-{ As a special exception, the copyright holders of this }
-{ library give you permission to link this library with }
-{ independent modules to produce an executable, }
-{ regardless of the license terms of these independent }
-{ modules, and to copy and distribute the resulting }
-{ executable under terms of your choice, provided that }
-{ you also meet, for each linked independent module, }
-{ the terms and conditions of the license of that module. }
-{ An independent module is a module which is not derived }
-{ from or based on this library. If you modify this }
-{ library, you may extend this exception to your version }
-{ of the library, but you are not obligated to do so. }
-{ If you do not wish to do so, delete this exception }
-{ statement from your version. }
-{ }
-{ }
-{ The project web site is located on: }
-{ http://zeos.firmos.at (FORUM) }
-{ http://zeosbugs.firmos.at (BUGTRACKER) }
-{ svn://zeos.firmos.at/zeos/trunk (SVN Repository) }
-{ }
-{ http://www.sourceforge.net/projects/zeoslib. }
-{ http://www.zeoslib.sourceforge.net }
-{ }
-{ }
-{ }
-{ Zeos Development Group. }
-{********************************************************@}
-
-unit ZPlainSqLite3;
-
-interface
-
-{$I ZPlain.inc}
-
-{$J+}
-{$Z4}
-
-uses Classes, ZPlainLoader, ZCompatibility;
-
-{ ***************** Plain API Constants definition **************** }
-
-const
- WINDOWS_DLL_LOCATION = 'sqlite3.dll';
- LINUX_DLL_LOCATION = 'libsqlite.so';
-
- SQLITE_ISO8859 = 1;
- MASTER_NAME = 'sqlite_master';
- TEMP_MASTER_NAME = 'sqlite_temp_master';
- SQLITE_VERSION = '3.5.4';
-
- { Return values for sqlite_exec() and sqlite_step() }
- SQLITE_OK = 0; // Successful result
- SQLITE_ERROR = 1; // SQL error or missing database
- SQLITE_INTERNAL = 2; // An internal logic error in SQLite
- SQLITE_PERM = 3; // Access permission denied
- SQLITE_ABORT = 4; // Callback routine requested an abort
- SQLITE_BUSY = 5; // The database file is locked
- SQLITE_LOCKED = 6; // A table in the database is locked
- SQLITE_NOMEM = 7; // A malloc() failed
- SQLITE_READONLY = 8; // Attempt to write a readonly database
- _SQLITE_INTERRUPT = 9; // Operation terminated by sqlite_interrupt()
- SQLITE_IOERR = 10; // Some kind of disk I/O error occurred
- SQLITE_CORRUPT = 11; // The database disk image is malformed
- SQLITE_NOTFOUND = 12; // (Internal Only) Table or record not found
- SQLITE_FULL = 13; // Insertion failed because database is full
- SQLITE_CANTOPEN = 14; // Unable to open the database file
- SQLITE_PROTOCOL = 15; // Database lock protocol error
- SQLITE_EMPTY = 16; // (Internal Only) Database table is empty
- SQLITE_SCHEMA = 17; // The database schema changed
- SQLITE_TOOBIG = 18; // Too much data for one row of a table
- SQLITE_CONSTRAINT = 19; // Abort due to contraint violation
- SQLITE_MISMATCH = 20; // Data type mismatch
- SQLITE_MISUSE = 21; // Library used incorrectly
- SQLITE_NOLFS = 22; // Uses OS features not supported on host
- SQLITE_AUTH = 23; // Authorization denied
- SQLITE_FORMAT = 24; // Auxiliary database format error
- SQLITE_RANGE = 25; // 2nd parameter to sqlite_bind out of range
- SQLITE_NOTADB = 26; // File opened that is not a database file
- SQLITE_ROW = 100; // sqlite_step() has another row ready
- SQLITE_DONE = 101; // sqlite_step() has finished executing
-
- SQLITE_NUMERIC = -1;
- SQLITE_TEXT = -2;
- SQLITE_ARGS = -3;
-
- {
- The second parameter to the access authorization function above will
- be one of the values below. These values signify what kind of operation
- is to be authorized. The 3rd and 4th parameters to the authorization
- function will be parameters or NULL depending on which of the following
- codes is used as the second parameter. The 5th parameter is the name
- of the database ("main", "temp", etc.) if applicable. The 6th parameter
- is the name of the inner-most trigger or view that is responsible for
- the access attempt or NULL if this access attempt is directly from
- input SQL code.
-
- Arg-3 Arg-4
- }
- SQLITE_COPY = 0; // Table Name File Name
- SQLITE_CREATE_INDEX = 1; // Index Name Table Name
- SQLITE_CREATE_TABLE = 2; // Table Name NULL
- SQLITE_CREATE_TEMP_INDEX = 3; // Index Name Table Name
- SQLITE_CREATE_TEMP_TABLE = 4; // Table Name NULL
- SQLITE_CREATE_TEMP_TRIGGER = 5; // Trigger Name Table Name
- SQLITE_CREATE_TEMP_VIEW = 6; // View Name NULL
- SQLITE_CREATE_TRIGGER = 7; // Trigger Name Table Name
- SQLITE_CREATE_VIEW = 8; // View Name NULL
- SQLITE_DELETE = 9; // Table Name NULL
- SQLITE_DROP_INDEX = 10; // Index Name Table Name
- SQLITE_DROP_TABLE = 11; // Table Name NULL
- SQLITE_DROP_TEMP_INDEX = 12; // Index Name Table Name
- SQLITE_DROP_TEMP_TABLE = 13; // Table Name NULL
- SQLITE_DROP_TEMP_TRIGGER = 14; // Trigger Name Table Name
- SQLITE_DROP_TEMP_VIEW = 15; // View Name NULL
- SQLITE_DROP_TRIGGER = 16; // Trigger Name Table Name
- SQLITE_DROP_VIEW = 17; // View Name NULL
- SQLITE_INSERT = 18; // Table Name NULL
- SQLITE_PRAGMA = 19; // Pragma Name 1st arg or NULL
- SQLITE_READ = 20; // Table Name Column Name
- SQLITE_SELECT = 21; // NULL NULL
- SQLITE_TRANSACTION = 22; // NULL NULL
- SQLITE_UPDATE = 23; // Table Name Column Name
-
- { The return value of the authorization function should be one of the
- following constants: }
- SQLITE_DENY = 1; // Abort the SQL statement with an error
- SQLITE_IGNORE = 2; // Don't allow access, but don't generate an error
-
-type
- Psqlite = Pointer;
- Psqlite_func = Pointer;
- Psqlite_vm = Pointer;
-
-{ ************** Plain API Function types definition ************* }
-
- Tsqlite_callback = function(p1: Pointer; p2: Integer; var p3: PAnsiChar;
- var p4: PAnsiChar): Integer; cdecl;
- Tsqlite_simple_callback = function(p1: Pointer): Integer; cdecl;
- Tsqlite_simple_callback0 = function(p1: Pointer): Pointer; cdecl;
- Tsqlite_busy_callback = function(p1: Pointer; const p2: PAnsiChar;
- p3: Integer): Integer; cdecl;
-
- Tsqlite_function_callback = procedure(p1: Psqlite_func; p2: Integer;
- const p3: PPAnsiChar); cdecl;
- Tsqlite_finalize_callback = procedure(p1: Psqlite_func); cdecl;
- Tsqlite_auth_callback = function(p1: Pointer; p2: Integer; const p3: PAnsiChar;
- const p4: PAnsiChar; const p5: PAnsiChar; const p6: PAnsiChar): Integer; cdecl;
- Tsqlite_trace_callback = procedure(p1: Pointer; const p2: PAnsiChar); cdecl;
-
- Tsqlite_open = function(const filename: PAnsiChar;var Qsqlite: Psqlite):
- Integer; cdecl;
- Tsqlite_close = procedure(db: Psqlite); cdecl;
- Tsqlite_column_count = function(db: Psqlite): Integer; cdecl;
- Tsqlite_column_bytes = function(db: Psqlite; iCol: Integer): PAnsiChar; cdecl;
- Tsqlite_column_name = function(db: Psqlite; iCol: Integer): PAnsiChar; cdecl;
- Tsqlite_column_decltype = function(db: Psqlite; iCol: Integer): PAnsiChar; cdecl;
- Tsqlite_exec = function(db: Psqlite; const sql: PAnsiChar;
- sqlite_callback: Tsqlite_callback; arg: Pointer;
- var errmsg: PAnsiChar): Integer; cdecl;
- Tsqlite_errmsg = function(db: Psqlite): PAnsiChar; cdecl;
- Tsqlite_last_insert_rowid = function(db: Psqlite): Integer; cdecl;
- Tsqlite_changes = function(db: Psqlite): Integer; cdecl;
- Tsqlite_last_statement_changes = function(db: Psqlite): Integer; cdecl;
- Tsqlite_error_string = function(code: Integer): PAnsiChar; cdecl;
- Tsqlite_interrupt = procedure(db: Psqlite); cdecl;
- Tsqlite_complete = function(const sql: PAnsiChar): Integer; cdecl;
- Tsqlite_busy_handler = procedure(db: Psqlite;
- callback: Tsqlite_busy_callback; ptr: Pointer); cdecl;
- Tsqlite_busy_timeout = procedure(db: Psqlite; ms: Integer); cdecl;
- Tsqlite_get_table = function(db: Psqlite; const sql: PAnsiChar;
- var resultp: PPAnsiChar; var nrow: Integer; var ncolumn: Integer;
- var errmsg: PAnsiChar): Integer; cdecl;
- Tsqlite_free_table = procedure(var result: PAnsiChar); cdecl;
- Tsqlite_freemem = procedure(ptr: Pointer); cdecl;
- Tsqlite_libversion = function: PAnsiChar; cdecl;
- Tsqlite_libencoding = function: PAnsiChar; cdecl;
-
- Tsqlite_create_function = function(db: Psqlite; const zName: PAnsiChar;
- nArg: Integer; callback: Tsqlite_function_callback;
- pUserData: Pointer): Integer; cdecl;
- Tsqlite_create_aggregate = function(db: Psqlite; const zName: PAnsiChar;
- nArg: Integer; callback: Tsqlite_function_callback;
- finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer; cdecl;
- Tsqlite_function_type = function(db: Psqlite; const zName: PAnsiChar;
- datatype: Integer): Integer; cdecl;
- Tsqlite_set_result_string = function(func: Psqlite_func; const arg: PAnsiChar;
- len: Integer; UN: Tsqlite_simple_callback): PAnsiChar; cdecl;
- Tsqlite_set_result_int = procedure(func: Psqlite_func; arg: Integer); cdecl;
- Tsqlite_set_result_double = procedure(func: Psqlite_func; arg: Double); cdecl;
- Tsqlite_set_result_error = procedure(func: Psqlite_func; const arg: PAnsiChar;
- len: Integer); cdecl;
- Tsqlite_user_data = function(func: Psqlite_func): Pointer; cdecl;
- Tsqlite_aggregate_context = function(func: Psqlite_func;
- nBytes: Integer): Pointer; cdecl;
- Tsqlite_aggregate_count = function(func: Psqlite_func): Integer; cdecl;
-
- Tsqlite_set_authorizer = function(db: Psqlite;
- callback: Tsqlite_auth_callback; pUserData: Pointer): Integer; cdecl;
- Tsqlite_trace = function(db: Psqlite; callback: Tsqlite_trace_callback;
- ptr: Pointer): Pointer; cdecl;
-
- Tsqlite_compile = function(db: Psqlite; const zSql: PAnsiChar; nBytes: Integer;
- var ppVm: Psqlite_vm; pzTail: PAnsiChar): Integer; cdecl;
- Tsqlite_step = function(pVm: Psqlite_vm): Integer; cdecl;
- Tsqlite_finalize = function(vm: Psqlite_vm): Integer; cdecl;
- Tsqlite_reset = function(vm: Psqlite_vm): Integer; cdecl;
- Tsqlite_bind = function(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
- len: Integer; copy: Integer): Integer; cdecl;
-{ Tsqlite_bind_double = function(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
- len: Integer; copy: Integer): Integer; cdecl;
- Tsqlite_bind_int = function(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
- len: Integer; copy: Integer): Integer; cdecl;
- Tsqlite_bind_int64 = function(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
- len: Integer; copy: Integer): Integer; cdecl;
- Tsqlite_bind_null = function(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
- len: Integer; copy: Integer): Integer; cdecl;
- Tsqlite_bind_text = function(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
- len: Integer; copy: Integer): Integer; cdecl;}
-
- Tsqlite_progress_handler = procedure(db: Psqlite; p1: Integer;
- callback: Tsqlite_simple_callback; ptr: Pointer); cdecl;
- Tsqlite_commit_hook = function(db: Psqlite; callback: Tsqlite_simple_callback;
- ptr: Pointer): Pointer; cdecl;
-
- Tsqlite_open_encrypted = function(const zFilename: PAnsiChar;
- const pKey: PAnsiChar; nKey: Integer; var pErrcode: Integer;
- var pzErrmsg: PAnsiChar): Psqlite; cdecl;
- Tsqlite_rekey = function(db: Psqlite; const pKey: Pointer;
- nKey: Integer): Integer; cdecl;
- Tsqlite_key = function(db: Psqlite; const pKey: Pointer;
- nKey: Integer): Integer; cdecl;
-
-var
-
-{ ************* Plain API Function variables definition ************ }
-
- sqlite_open: Tsqlite_open;
- sqlite_close: Tsqlite_close;
- sqlite_column_count: Tsqlite_column_count;
- sqlite_column_bytes: Tsqlite_column_bytes;
- sqlite_column_name: Tsqlite_column_name;
- sqlite_column_decltype: Tsqlite_column_decltype;
- sqlite_exec: Tsqlite_exec;
- sqlite_errmsg: Tsqlite_errmsg;
- sqlite_last_insert_rowid: Tsqlite_last_insert_rowid;
- sqlite_changes: Tsqlite_changes;
- sqlite_last_statement_changes: Tsqlite_last_statement_changes;
- sqlite_error_string: Tsqlite_error_string;
- sqlite_interrupt: Tsqlite_interrupt;
- sqlite_complete: Tsqlite_complete;
- sqlite_busy_handler: Tsqlite_busy_handler;
- sqlite_busy_timeout: Tsqlite_busy_timeout;
- sqlite_get_table: Tsqlite_get_table;
- sqlite_free_table: Tsqlite_free_table;
- sqlite_freemem: Tsqlite_freemem;
- sqlite_libversion: Tsqlite_libversion;
- sqlite_libencoding: Tsqlite_libencoding;
- sqlite_create_function: Tsqlite_create_function;
- sqlite_create_aggregate: Tsqlite_create_aggregate;
- sqlite_function_type: Tsqlite_function_type;
- sqlite_set_result_string: Tsqlite_set_result_string;
- sqlite_set_result_int: Tsqlite_set_result_int;
- sqlite_set_result_double: Tsqlite_set_result_double;
- sqlite_set_result_error: Tsqlite_set_result_error;
- sqlite_user_data: Tsqlite_user_data;
- sqlite_aggregate_context: Tsqlite_aggregate_context;
- sqlite_aggregate_count: Tsqlite_aggregate_count;
- sqlite_set_authorizer: Tsqlite_set_authorizer;
- sqlite_trace: Tsqlite_trace;
- sqlite_compile: Tsqlite_compile;
- sqlite_step: Tsqlite_step;
- sqlite_finalize: Tsqlite_finalize;
- sqlite_reset: Tsqlite_reset;
- sqlite_bind: Tsqlite_bind;
- sqlite_progress_handler: Tsqlite_progress_handler;
- sqlite_commit_hook: Tsqlite_commit_hook;
- sqlite_open_encrypted: Tsqlite_open_encrypted;
- sqlite_rekey: Tsqlite_rekey;
- sqlite_key: Tsqlite_key;
-
-var
- LibraryLoader: TZNativeLibraryLoader;
-
-implementation
-
-type
- {** Implements a loader for SQLite native library. }
- TZSQLiteNativeLibraryLoader = class (TZNativeLibraryLoader)
- public
- function Load: Boolean; override;
- end;
-
-{ TZSQLiteNativeLibraryLoader }
-
-{**
- Loads a library module.
- @return True if library was successfully loaded.
-}
-function TZSQLiteNativeLibraryLoader.Load: Boolean;
-begin
- Result := inherited Load;
-
-{!} @sqlite_open := GetAddress('sqlite3_open');
-{!} @sqlite_close := GetAddress('sqlite3_close');
-{!} @sqlite_column_count := GetAddress('sqlite3_column_count');
-{!} @sqlite_column_bytes := GetAddress('sqlite3_column_text');
-{!} @sqlite_column_name := GetAddress('sqlite3_column_name');
-{!} @sqlite_column_decltype := GetAddress('sqlite3_column_decltype');
-{!} @sqlite_exec := GetAddress('sqlite3_exec');
-{!} @sqlite_last_insert_rowid := GetAddress('sqlite3_last_insert_rowid');
-{!} @sqlite_changes := GetAddress('sqlite3_changes');
-{!} @sqlite_errmsg := GetAddress('sqlite3_errmsg');
-{ ?- @sqlite_last_statement_changes := GetAddress('sqlite3_last_statement_changes');}
-{!} @sqlite_interrupt := GetAddress('sqlite3_interrupt');
-{!} @sqlite_complete := GetAddress('sqlite3_complete');
-{!} @sqlite_busy_handler := GetAddress('sqlite3_busy_handler');
-{!} @sqlite_busy_timeout := GetAddress('sqlite3_busy_timeout');
-{!} @sqlite_get_table := GetAddress('sqlite3_get_table');
-{!} @sqlite_free_table := GetAddress('sqlite3_free_table');
-{!} @sqlite_freemem := GetAddress('sqlite3_free');
-{!} @sqlite_libversion := GetAddress('sqlite3_libversion');
-{ ?- @sqlite_libencoding := GetAddress('sqlite3_libencoding');
-{ ?- @sqlite_create_function := GetAddress('sqlite3_create_function');}
-{ ?- @sqlite_create_aggregate := GetAddress('sqlite3_create_collation');}
-{ ?- @sqlite_function_type := GetAddress('sqlite3_function_type');
-{!} @sqlite_set_result_string := GetAddress('sqlite3_result_string');
-{!} @sqlite_set_result_int := GetAddress('sqlite3_result_int');
-{!} @sqlite_set_result_double := GetAddress('sqlite3_result_double');
-{!} @sqlite_set_result_error := GetAddress('sqlite3_result_error');
-{!} @sqlite_user_data := GetAddress('sqlite3_user_data');
-{!} @sqlite_aggregate_context := GetAddress('sqlite3_aggregate_context');
-{!} @sqlite_aggregate_count := GetAddress('sqlite3_aggregate_count');
-{!} @sqlite_set_authorizer := GetAddress('sqlite3_set_authorizer');
-{!} @sqlite_trace := GetAddress('sqlite3_trace');
-{!} @sqlite_compile := GetAddress('sqlite3_prepare');
-{!} @sqlite_step := GetAddress('sqlite3_step');
-{!} @sqlite_finalize := GetAddress('sqlite3_finalize');
-{!} @sqlite_reset := GetAddress('sqlite3_reset');
-{ ?- @sqlite_bind := GetAddress('sqlite3_bind');}
-{!} @sqlite_progress_handler := GetAddress('sqlite3_progress_handler');
-{!} @sqlite_commit_hook := GetAddress('sqlite3_commit_hook');
-{ ?- @sqlite_open_encrypted := GetAddress('sqlite3_open_encrypted');}
-{!} @sqlite_rekey := GetAddress('sqlite3_rekey');
-{!} @sqlite_key := GetAddress('sqlite3_key');
-
-end;
-
-initialization
-{$IFNDEF UNIX}
- LibraryLoader := TZSQLiteNativeLibraryLoader.Create(
- [WINDOWS_DLL_LOCATION]);
-{$ELSE}
- LibraryLoader := TZSQLiteNativeLibraryLoader.Create(
- [LINUX_DLL_LOCATION]);
-{$ENDIF}
-finalization
- if Assigned(LibraryLoader) then
- LibraryLoader.Free;
-end.
-
+{@********************************************************}
+{ Copyright (c) 1999-2006 Zeos Development Group }
+{ }
+{ License Agreement: }
+{ }
+{ This library is distributed in the hope that it will be }
+{ useful, but WITHOUT ANY WARRANTY; without even the }
+{ implied warranty of MERCHANTABILITY or FITNESS FOR }
+{ A PARTICULAR PURPOSE. See the GNU Lesser General }
+{ Public License for more details. }
+{ }
+{ The source code of the ZEOS Libraries and packages are }
+{ distributed under the Library GNU General Public }
+{ License (see the file COPYING / COPYING.ZEOS) }
+{ with the following modification: }
+{ As a special exception, the copyright holders of this }
+{ library give you permission to link this library with }
+{ independent modules to produce an executable, }
+{ regardless of the license terms of these independent }
+{ modules, and to copy and distribute the resulting }
+{ executable under terms of your choice, provided that }
+{ you also meet, for each linked independent module, }
+{ the terms and conditions of the license of that module. }
+{ An independent module is a module which is not derived }
+{ from or based on this library. If you modify this }
+{ library, you may extend this exception to your version }
+{ of the library, but you are not obligated to do so. }
+{ If you do not wish to do so, delete this exception }
+{ statement from your version. }
+{ }
+{ }
+{ The project web site is located on: }
+{ http://zeos.firmos.at (FORUM) }
+{ http://zeosbugs.firmos.at (BUGTRACKER) }
+{ svn://zeos.firmos.at/zeos/trunk (SVN Repository) }
+{ }
+{ http://www.sourceforge.net/projects/zeoslib. }
+{ http://www.zeoslib.sourceforge.net }
+{ }
+{ }
+{ }
+{ Zeos Development Group. }
+{********************************************************@}
+
+unit ZPlainSqLite3;
+
+interface
+
+{$I ZPlain.inc}
+
+{$J+}
+{$Z4}
+
+uses Classes, ZPlainLoader, ZCompatibility;
+
+{ ***************** Plain API Constants definition **************** }
+
+const
+ WINDOWS_DLL_LOCATION = 'sqlite3.dll';
+ LINUX_DLL_LOCATION = 'libsqlite3.so.0';
+
+ SQLITE_ISO8859 = 1;
+ MASTER_NAME = 'sqlite_master';
+ TEMP_MASTER_NAME = 'sqlite_temp_master';
+ SQLITE_VERSION = '3.5.4';
+
+ { Return values for sqlite_exec() and sqlite_step() }
+ SQLITE_OK = 0; // Successful result
+ SQLITE_ERROR = 1; // SQL error or missing database
+ SQLITE_INTERNAL = 2; // An internal logic error in SQLite
+ SQLITE_PERM = 3; // Access permission denied
+ SQLITE_ABORT = 4; // Callback routine requested an abort
+ SQLITE_BUSY = 5; // The database file is locked
+ SQLITE_LOCKED = 6; // A table in the database is locked
+ SQLITE_NOMEM = 7; // A malloc() failed
+ SQLITE_READONLY = 8; // Attempt to write a readonly database
+ _SQLITE_INTERRUPT = 9; // Operation terminated by sqlite_interrupt()
+ SQLITE_IOERR = 10; // Some kind of disk I/O error occurred
+ SQLITE_CORRUPT = 11; // The database disk image is malformed
+ SQLITE_NOTFOUND = 12; // (Internal Only) Table or record not found
+ SQLITE_FULL = 13; // Insertion failed because database is full
+ SQLITE_CANTOPEN = 14; // Unable to open the database file
+ SQLITE_PROTOCOL = 15; // Database lock protocol error
+ SQLITE_EMPTY = 16; // (Internal Only) Database table is empty
+ SQLITE_SCHEMA = 17; // The database schema changed
+ SQLITE_TOOBIG = 18; // Too much data for one row of a table
+ SQLITE_CONSTRAINT = 19; // Abort due to contraint violation
+ SQLITE_MISMATCH = 20; // Data type mismatch
+ SQLITE_MISUSE = 21; // Library used incorrectly
+ SQLITE_NOLFS = 22; // Uses OS features not supported on host
+ SQLITE_AUTH = 23; // Authorization denied
+ SQLITE_FORMAT = 24; // Auxiliary database format error
+ SQLITE_RANGE = 25; // 2nd parameter to sqlite_bind out of range
+ SQLITE_NOTADB = 26; // File opened that is not a database file
+ SQLITE_ROW = 100; // sqlite_step() has another row ready
+ SQLITE_DONE = 101; // sqlite_step() has finished executing
+
+ SQLITE_NUMERIC = -1;
+ SQLITE_TEXT = -2;
+ SQLITE_ARGS = -3;
+
+ {
+ The second parameter to the access authorization function above will
+ be one of the values below. These values signify what kind of operation
+ is to be authorized. The 3rd and 4th parameters to the authorization
+ function will be parameters or NULL depending on which of the following
+ codes is used as the second parameter. The 5th parameter is the name
+ of the database ("main", "temp", etc.) if applicable. The 6th parameter
+ is the name of the inner-most trigger or view that is responsible for
+ the access attempt or NULL if this access attempt is directly from
+ input SQL code.
+
+ Arg-3 Arg-4
+ }
+ SQLITE_COPY = 0; // Table Name File Name
+ SQLITE_CREATE_INDEX = 1; // Index Name Table Name
+ SQLITE_CREATE_TABLE = 2; // Table Name NULL
+ SQLITE_CREATE_TEMP_INDEX = 3; // Index Name Table Name
+ SQLITE_CREATE_TEMP_TABLE = 4; // Table Name NULL
+ SQLITE_CREATE_TEMP_TRIGGER = 5; // Trigger Name Table Name
+ SQLITE_CREATE_TEMP_VIEW = 6; // View Name NULL
+ SQLITE_CREATE_TRIGGER = 7; // Trigger Name Table Name
+ SQLITE_CREATE_VIEW = 8; // View Name NULL
+ SQLITE_DELETE = 9; // Table Name NULL
+ SQLITE_DROP_INDEX = 10; // Index Name Table Name
+ SQLITE_DROP_TABLE = 11; // Table Name NULL
+ SQLITE_DROP_TEMP_INDEX = 12; // Index Name Table Name
+ SQLITE_DROP_TEMP_TABLE = 13; // Table Name NULL
+ SQLITE_DROP_TEMP_TRIGGER = 14; // Trigger Name Table Name
+ SQLITE_DROP_TEMP_VIEW = 15; // View Name NULL
+ SQLITE_DROP_TRIGGER = 16; // Trigger Name Table Name
+ SQLITE_DROP_VIEW = 17; // View Name NULL
+ SQLITE_INSERT = 18; // Table Name NULL
+ SQLITE_PRAGMA = 19; // Pragma Name 1st arg or NULL
+ SQLITE_READ = 20; // Table Name Column Name
+ SQLITE_SELECT = 21; // NULL NULL
+ SQLITE_TRANSACTION = 22; // NULL NULL
+ SQLITE_UPDATE = 23; // Table Name Column Name
+
+ { The return value of the authorization function should be one of the
+ following constants: }
+ SQLITE_DENY = 1; // Abort the SQL statement with an error
+ SQLITE_IGNORE = 2; // Don't allow access, but don't generate an error
+
+type
+ Psqlite = Pointer;
+ Psqlite_func = Pointer;
+ Psqlite_vm = Pointer;
+
+{ ************** Plain API Function types definition ************* }
+
+ Tsqlite_callback = function(p1: Pointer; p2: Integer; var p3: PChar;
+ var p4: PChar): Integer; cdecl;
+ Tsqlite_simple_callback = function(p1: Pointer): Integer; cdecl;
+ Tsqlite_simple_callback0 = function(p1: Pointer): Pointer; cdecl;
+ Tsqlite_busy_callback = function(p1: Pointer; const p2: PChar;
+ p3: Integer): Integer; cdecl;
+
+ Tsqlite_function_callback = procedure(p1: Psqlite_func; p2: Integer;
+ const p3: PPChar); cdecl;
+ Tsqlite_finalize_callback = procedure(p1: Psqlite_func); cdecl;
+ Tsqlite_auth_callback = function(p1: Pointer; p2: Integer; const p3: PChar;
+ const p4: PChar; const p5: PChar; const p6: PChar): Integer; cdecl;
+ Tsqlite_trace_callback = procedure(p1: Pointer; const p2: PChar); cdecl;
+
+ Tsqlite_open = function(const filename: PChar;var Qsqlite: Psqlite):
+ Integer; cdecl;
+ Tsqlite_close = procedure(db: Psqlite); cdecl;
+ Tsqlite_column_count = function(db: Psqlite): Integer; cdecl;
+ Tsqlite_column_bytes = function(db: Psqlite; iCol: Integer): Pchar; cdecl;
+ Tsqlite_column_name = function(db: Psqlite; iCol: Integer): Pchar; cdecl;
+ Tsqlite_column_decltype = function(db: Psqlite; iCol: Integer): Pchar; cdecl;
+ Tsqlite_exec = function(db: Psqlite; const sql: PChar;
+ sqlite_callback: Tsqlite_callback; arg: Pointer;
+ var errmsg: PChar): Integer; cdecl;
+ Tsqlite_errmsg = function(db: Psqlite): PChar; cdecl;
+ Tsqlite_last_insert_rowid = function(db: Psqlite): Integer; cdecl;
+ Tsqlite_changes = function(db: Psqlite): Integer; cdecl;
+ Tsqlite_last_statement_changes = function(db: Psqlite): Integer; cdecl;
+ Tsqlite_error_string = function(code: Integer): PChar; cdecl;
+ Tsqlite_interrupt = procedure(db: Psqlite); cdecl;
+ Tsqlite_complete = function(const sql: PChar): Integer; cdecl;
+ Tsqlite_busy_handler = procedure(db: Psqlite;
+ callback: Tsqlite_busy_callback; ptr: Pointer); cdecl;
+ Tsqlite_busy_timeout = procedure(db: Psqlite; ms: Integer); cdecl;
+ Tsqlite_get_table = function(db: Psqlite; const sql: PChar;
+ var resultp: PPChar; var nrow: Integer; var ncolumn: Integer;
+ var errmsg: PChar): Integer; cdecl;
+ Tsqlite_free_table = procedure(var result: PChar); cdecl;
+ Tsqlite_freemem = procedure(ptr: Pointer); cdecl;
+ Tsqlite_libversion = function: PChar; cdecl;
+ Tsqlite_libencoding = function: PChar; cdecl;
+
+ Tsqlite_create_function = function(db: Psqlite; const zName: PChar;
+ nArg: Integer; callback: Tsqlite_function_callback;
+ pUserData: Pointer): Integer; cdecl;
+ Tsqlite_create_aggregate = function(db: Psqlite; const zName: PChar;
+ nArg: Integer; callback: Tsqlite_function_callback;
+ finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer; cdecl;
+ Tsqlite_function_type = function(db: Psqlite; const zName: PChar;
+ datatype: Integer): Integer; cdecl;
+ Tsqlite_set_result_string = function(func: Psqlite_func; const arg: PChar;
+ len: Integer; UN: Tsqlite_simple_callback): PChar; cdecl;
+ Tsqlite_set_result_int = procedure(func: Psqlite_func; arg: Integer); cdecl;
+ Tsqlite_set_result_double = procedure(func: Psqlite_func; arg: Double); cdecl;
+ Tsqlite_set_result_error = procedure(func: Psqlite_func; const arg: PChar;
+ len: Integer); cdecl;
+ Tsqlite_user_data = function(func: Psqlite_func): Pointer; cdecl;
+ Tsqlite_aggregate_context = function(func: Psqlite_func;
+ nBytes: Integer): Pointer; cdecl;
+ Tsqlite_aggregate_count = function(func: Psqlite_func): Integer; cdecl;
+
+ Tsqlite_set_authorizer = function(db: Psqlite;
+ callback: Tsqlite_auth_callback; pUserData: Pointer): Integer; cdecl;
+ Tsqlite_trace = function(db: Psqlite; callback: Tsqlite_trace_callback;
+ ptr: Pointer): Pointer; cdecl;
+
+ Tsqlite_compile = function(db: Psqlite; const zSql: PChar; nBytes: Integer;
+ var ppVm: Psqlite_vm; pzTail: PChar): Integer; cdecl;
+ Tsqlite_step = function(pVm: Psqlite_vm): Integer; cdecl;
+ Tsqlite_finalize = function(vm: Psqlite_vm): Integer; cdecl;
+ Tsqlite_reset = function(vm: Psqlite_vm): Integer; cdecl;
+ Tsqlite_bind = function(vm: Psqlite_vm; idx: Integer; const value: PChar;
+ len: Integer; copy: Integer): Integer; cdecl;
+{ Tsqlite_bind_double = function(vm: Psqlite_vm; idx: Integer; const value: PChar;
+ len: Integer; copy: Integer): Integer; cdecl;
+ Tsqlite_bind_int = function(vm: Psqlite_vm; idx: Integer; const value: PChar;
+ len: Integer; copy: Integer): Integer; cdecl;
+ Tsqlite_bind_int64 = function(vm: Psqlite_vm; idx: Integer; const value: PChar;
+ len: Integer; copy: Integer): Integer; cdecl;
+ Tsqlite_bind_null = function(vm: Psqlite_vm; idx: Integer; const value: PChar;
+ len: Integer; copy: Integer): Integer; cdecl;
+ Tsqlite_bind_text = function(vm: Psqlite_vm; idx: Integer; const value: PChar;
+ len: Integer; copy: Integer): Integer; cdecl;}
+
+ Tsqlite_progress_handler = procedure(db: Psqlite; p1: Integer;
+ callback: Tsqlite_simple_callback; ptr: Pointer); cdecl;
+ Tsqlite_commit_hook = function(db: Psqlite; callback: Tsqlite_simple_callback;
+ ptr: Pointer): Pointer; cdecl;
+
+ Tsqlite_open_encrypted = function(const zFilename: PChar;
+ const pKey: PChar; nKey: Integer; var pErrcode: Integer;
+ var pzErrmsg: PChar): Psqlite; cdecl;
+ Tsqlite_rekey = function(db: Psqlite; const pKey: Pointer;
+ nKey: Integer): Integer; cdecl;
+ Tsqlite_key = function(db: Psqlite; const pKey: Pointer;
+ nKey: Integer): Integer; cdecl;
+
+var
+
+{ ************* Plain API Function variables definition ************ }
+
+ sqlite_open: Tsqlite_open;
+ sqlite_close: Tsqlite_close;
+ sqlite_column_count: Tsqlite_column_count;
+ sqlite_column_bytes: Tsqlite_column_bytes;
+ sqlite_column_name: Tsqlite_column_name;
+ sqlite_column_decltype: Tsqlite_column_decltype;
+ sqlite_exec: Tsqlite_exec;
+ sqlite_errmsg: Tsqlite_errmsg;
+ sqlite_last_insert_rowid: Tsqlite_last_insert_rowid;
+ sqlite_changes: Tsqlite_changes;
+ sqlite_last_statement_changes: Tsqlite_last_statement_changes;
+ sqlite_error_string: Tsqlite_error_string;
+ sqlite_interrupt: Tsqlite_interrupt;
+ sqlite_complete: Tsqlite_complete;
+ sqlite_busy_handler: Tsqlite_busy_handler;
+ sqlite_busy_timeout: Tsqlite_busy_timeout;
+ sqlite_get_table: Tsqlite_get_table;
+ sqlite_free_table: Tsqlite_free_table;
+ sqlite_freemem: Tsqlite_freemem;
+ sqlite_libversion: Tsqlite_libversion;
+ sqlite_libencoding: Tsqlite_libencoding;
+ sqlite_create_function: Tsqlite_create_function;
+ sqlite_create_aggregate: Tsqlite_create_aggregate;
+ sqlite_function_type: Tsqlite_function_type;
+ sqlite_set_result_string: Tsqlite_set_result_string;
+ sqlite_set_result_int: Tsqlite_set_result_int;
+ sqlite_set_result_double: Tsqlite_set_result_double;
+ sqlite_set_result_error: Tsqlite_set_result_error;
+ sqlite_user_data: Tsqlite_user_data;
+ sqlite_aggregate_context: Tsqlite_aggregate_context;
+ sqlite_aggregate_count: Tsqlite_aggregate_count;
+ sqlite_set_authorizer: Tsqlite_set_authorizer;
+ sqlite_trace: Tsqlite_trace;
+ sqlite_compile: Tsqlite_compile;
+ sqlite_step: Tsqlite_step;
+ sqlite_finalize: Tsqlite_finalize;
+ sqlite_reset: Tsqlite_reset;
+ sqlite_bind: Tsqlite_bind;
+ sqlite_progress_handler: Tsqlite_progress_handler;
+ sqlite_commit_hook: Tsqlite_commit_hook;
+ sqlite_open_encrypted: Tsqlite_open_encrypted;
+ sqlite_rekey: Tsqlite_rekey;
+ sqlite_key: Tsqlite_key;
+
+var
+ LibraryLoader: TZNativeLibraryLoader;
+
+implementation
+
+type
+ {** Implements a loader for SQLite native library. }
+ TZSQLiteNativeLibraryLoader = class (TZNativeLibraryLoader)
+ public
+ function Load: Boolean; override;
+ end;
+
+{ TZSQLiteNativeLibraryLoader }
+
+{**
+ Loads a library module.
+ @return True if library was successfully loaded.
+}
+function TZSQLiteNativeLibraryLoader.Load: Boolean;
+begin
+ Result := inherited Load;
+
+{!} @sqlite_open := GetAddress('sqlite3_open');
+{!} @sqlite_close := GetAddress('sqlite3_close');
+{!} @sqlite_column_count := GetAddress('sqlite3_column_count');
+{!} @sqlite_column_bytes := GetAddress('sqlite3_column_text');
+{!} @sqlite_column_name := GetAddress('sqlite3_column_name');
+{!} @sqlite_column_decltype := GetAddress('sqlite3_column_decltype');
+{!} @sqlite_exec := GetAddress('sqlite3_exec');
+{!} @sqlite_last_insert_rowid := GetAddress('sqlite3_last_insert_rowid');
+{!} @sqlite_changes := GetAddress('sqlite3_changes');
+{!} @sqlite_errmsg := GetAddress('sqlite3_errmsg');
+{ ?- @sqlite_last_statement_changes := GetAddress('sqlite3_last_statement_changes');}
+{!} @sqlite_interrupt := GetAddress('sqlite3_interrupt');
+{!} @sqlite_complete := GetAddress('sqlite3_complete');
+{!} @sqlite_busy_handler := GetAddress('sqlite3_busy_handler');
+{!} @sqlite_busy_timeout := GetAddress('sqlite3_busy_timeout');
+{!} @sqlite_get_table := GetAddress('sqlite3_get_table');
+{!} @sqlite_free_table := GetAddress('sqlite3_free_table');
+{!} @sqlite_freemem := GetAddress('sqlite3_free');
+{!} @sqlite_libversion := GetAddress('sqlite3_libversion');
+{ ?- @sqlite_libencoding := GetAddress('sqlite3_libencoding');
+{ ?- @sqlite_create_function := GetAddress('sqlite3_create_function');}
+{ ?- @sqlite_create_aggregate := GetAddress('sqlite3_create_collation');}
+{ ?- @sqlite_function_type := GetAddress('sqlite3_function_type');
+{!} @sqlite_set_result_string := GetAddress('sqlite3_result_string');
+{!} @sqlite_set_result_int := GetAddress('sqlite3_result_int');
+{!} @sqlite_set_result_double := GetAddress('sqlite3_result_double');
+{!} @sqlite_set_result_error := GetAddress('sqlite3_result_error');
+{!} @sqlite_user_data := GetAddress('sqlite3_user_data');
+{!} @sqlite_aggregate_context := GetAddress('sqlite3_aggregate_context');
+{!} @sqlite_aggregate_count := GetAddress('sqlite3_aggregate_count');
+{!} @sqlite_set_authorizer := GetAddress('sqlite3_set_authorizer');
+{!} @sqlite_trace := GetAddress('sqlite3_trace');
+{!} @sqlite_compile := GetAddress('sqlite3_prepare');
+{!} @sqlite_step := GetAddress('sqlite3_step');
+{!} @sqlite_finalize := GetAddress('sqlite3_finalize');
+{!} @sqlite_reset := GetAddress('sqlite3_reset');
+{ ?- @sqlite_bind := GetAddress('sqlite3_bind');}
+{!} @sqlite_progress_handler := GetAddress('sqlite3_progress_handler');
+{!} @sqlite_commit_hook := GetAddress('sqlite3_commit_hook');
+{ ?- @sqlite_open_encrypted := GetAddress('sqlite3_open_encrypted');}
+{!} @sqlite_rekey := GetAddress('sqlite3_rekey');
+{!} @sqlite_key := GetAddress('sqlite3_key');
+
+end;
+
+initialization
+{$IFNDEF UNIX}
+ LibraryLoader := TZSQLiteNativeLibraryLoader.Create(
+ [WINDOWS_DLL_LOCATION]);
+{$ELSE}
+ LibraryLoader := TZSQLiteNativeLibraryLoader.Create(
+ [LINUX_DLL_LOCATION]);
+{$ENDIF}
+finalization
+ if Assigned(LibraryLoader) then
+ LibraryLoader.Free;
+end.
+
Index: src/plain/ZPlainSqLiteDriver.pas
===================================================================
--- src/plain/ZPlainSqLiteDriver.pas (revision 564)
+++ src/plain/ZPlainSqLiteDriver.pas (working copy)
@@ -155,43 +155,43 @@
IZSQLitePlainDriver = interface (IZPlainDriver)
['{B931C952-3076-4ECB-9630-D900E8DB9869}']
- function Open(const filename: PAnsiChar; mode: Integer;
- var errmsg: PAnsiChar): Psqlite;
+ function Open(const filename: PChar; mode: Integer;
+ var errmsg: PChar): Psqlite;
procedure Close(db: Psqlite);
- function Execute(db: Psqlite; const sql: PAnsiChar;
+ function Execute(db: Psqlite; const sql: PChar;
sqlite_callback: Tsqlite_callback; arg: Pointer;
- var errmsg: PAnsiChar): Integer;
+ var errmsg: PChar): Integer;
function LastInsertRowId(db: Psqlite): Integer;
function Changes(db: Psqlite): Integer;
function LastStatementChanges(db: Psqlite): Integer;
- function ErrorString(code: Integer): PAnsiChar;
+ function ErrorString(code: Integer): PChar;
procedure Interrupt(db: Psqlite);
- function Complete(const sql: PAnsiChar): Integer;
+ function Complete(const sql: PChar): Integer;
procedure BusyHandler(db: Psqlite; callback: Tsqlite_busy_callback;
ptr: Pointer);
procedure BusyTimeout(db: Psqlite; ms: Integer);
- function GetTable(db: Psqlite; const sql: PAnsiChar; var resultp: PPAnsiChar;
- var nrow: Integer; var ncolumn: Integer; var errmsg: PAnsiChar): Integer;
- procedure FreeTable(var result: PAnsiChar);
+ function GetTable(db: Psqlite; const sql: PChar; var resultp: PPChar;
+ var nrow: Integer; var ncolumn: Integer; var errmsg: PChar): Integer;
+ procedure FreeTable(var result: PChar);
procedure FreeMem(ptr: Pointer);
- function LibVersion: PAnsiChar;
- function LibEncoding: PAnsiChar;
+ function LibVersion: PChar;
+ function LibEncoding: PChar;
- function CreateFunction(db: Psqlite; const zName: PAnsiChar;
+ function CreateFunction(db: Psqlite; const zName: PChar;
nArg: Integer; callback: Tsqlite_function_callback;
pUserData: Pointer): Integer;
- function CreateAggregate(db: Psqlite; const zName: PAnsiChar;
+ function CreateAggregate(db: Psqlite; const zName: PChar;
nArg: Integer; callback: Tsqlite_function_callback;
finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer;
- function FunctionType(db: Psqlite; const zName: PAnsiChar;
+ function FunctionType(db: Psqlite; const zName: PChar;
datatype: Integer): Integer;
- function SetResultString(func: Psqlite_func; const arg: PAnsiChar;
- len: Integer): PAnsiChar;
+ function SetResultString(func: Psqlite_func; const arg: PChar;
+ len: Integer): PChar;
procedure SetResultInt(func: Psqlite_func; arg: Integer);
procedure SetResultDouble(func: Psqlite_func; arg: Double);
- procedure SetResultError(func: Psqlite_func; const arg: PAnsiChar; len: Integer);
+ procedure SetResultError(func: Psqlite_func; const arg: PChar; len: Integer);
function UserData(func: Psqlite_func): Pointer;
function AggregateContext(func: Psqlite_func; nBytes: Integer): Pointer;
function AggregateCount(func: Psqlite_func): Integer;
@@ -201,13 +201,13 @@
function Trace(db: Psqlite; callback: Tsqlite_trace_callback;
ptr: Pointer): Pointer;
- function Compile(db: Psqlite; const zSql: PAnsiChar;nBytes: Integer;
- var pzTail: PAnsiChar; var ppVm: Psqlite_vm; var pzErrmsg: PAnsiChar): Integer;
- function Step(pVm: Psqlite_vm; var pN: Integer; var pazValue: PPAnsiChar;
- var pazColName: PPAnsiChar): Integer;
- function Finalize(vm: Psqlite_vm; var pzErrMsg: PAnsiChar): Integer;
- function Reset(vm: Psqlite_vm; var pzErrMsg: PAnsiChar): Integer;
- function Bind(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
+ function Compile(db: Psqlite; const zSql: PChar;nBytes: Integer;
+ var pzTail: PChar; var ppVm: Psqlite_vm; var pzErrmsg: PChar): Integer;
+ function Step(pVm: Psqlite_vm; var pN: Integer; var pazValue: PPChar;
+ var pazColName: PPChar): Integer;
+ function Finalize(vm: Psqlite_vm; var pzErrMsg: PChar): Integer;
+ function Reset(vm: Psqlite_vm; var pzErrMsg: PChar): Integer;
+ function Bind(vm: Psqlite_vm; idx: Integer; const value: PChar;
len: Integer; copy: Integer): Integer;
procedure ProgressHandler(db: Psqlite; p1: Integer;
@@ -215,8 +215,8 @@
function CommitHook(db: Psqlite; callback: Tsqlite_simple_callback;
ptr: Pointer): Pointer;
- function OpenEncrypted(const zFilename: PAnsiChar; const pKey: PAnsiChar;
- nKey: Integer; var pErrcode: Integer; var pzErrmsg: PAnsiChar): Psqlite;
+ function OpenEncrypted(const zFilename: PChar; const pKey: PChar;
+ nKey: Integer; var pErrcode: Integer; var pzErrmsg: PChar): Psqlite;
function ReKey(db: Psqlite; const pKey: Pointer; nKey: Integer): Integer;
function Key(db: Psqlite; const pKey: Pointer; nKey: Integer): Integer;
end;
@@ -231,43 +231,43 @@
function GetDescription: string;
procedure Initialize;
- function Open(const filename: PAnsiChar; mode: Integer;
- var errmsg: PAnsiChar): Psqlite;
+ function Open(const filename: PChar; mode: Integer;
+ var errmsg: PChar): Psqlite;
procedure Close(db: Psqlite);
- function Execute(db: Psqlite; const sql: PAnsiChar;
+ function Execute(db: Psqlite; const sql: PChar;
sqlite_callback: Tsqlite_callback; arg: Pointer;
- var errmsg: PAnsiChar): Integer;
+ var errmsg: PChar): Integer;
function LastInsertRowId(db: Psqlite): Integer;
function Changes(db: Psqlite): Integer;
function LastStatementChanges(db: Psqlite): Integer;
- function ErrorString(code: Integer): PAnsiChar;
+ function ErrorString(code: Integer): PChar;
procedure Interrupt(db: Psqlite);
- function Complete(const sql: PAnsiChar): Integer;
+ function Complete(const sql: PChar): Integer;
procedure BusyHandler(db: Psqlite; callback: Tsqlite_busy_callback;
ptr: Pointer);
procedure BusyTimeout(db: Psqlite; ms: Integer);
- function GetTable(db: Psqlite; const sql: PAnsiChar; var resultp: PPAnsiChar;
- var nrow: Integer; var ncolumn: Integer; var errmsg: PAnsiChar): Integer;
- procedure FreeTable(var result: PAnsiChar);
+ function GetTable(db: Psqlite; const sql: PChar; var resultp: PPChar;
+ var nrow: Integer; var ncolumn: Integer; var errmsg: PChar): Integer;
+ procedure FreeTable(var result: PChar);
procedure FreeMem(ptr: Pointer);
- function LibVersion: PAnsiChar;
- function LibEncoding: PAnsiChar;
+ function LibVersion: PChar;
+ function LibEncoding: PChar;
- function CreateFunction(db: Psqlite; const zName: PAnsiChar;
+ function CreateFunction(db: Psqlite; const zName: PChar;
nArg: Integer; callback: Tsqlite_function_callback;
pUserData: Pointer): Integer;
- function CreateAggregate(db: Psqlite; const zName: PAnsiChar;
+ function CreateAggregate(db: Psqlite; const zName: PChar;
nArg: Integer; callback: Tsqlite_function_callback;
finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer;
- function FunctionType(db: Psqlite; const zName: PAnsiChar;
+ function FunctionType(db: Psqlite; const zName: PChar;
datatype: Integer): Integer;
- function SetResultString(func: Psqlite_func; const arg: PAnsiChar;
- len: Integer): PAnsiChar;
+ function SetResultString(func: Psqlite_func; const arg: PChar;
+ len: Integer): PChar;
procedure SetResultInt(func: Psqlite_func; arg: Integer);
procedure SetResultDouble(func: Psqlite_func; arg: Double);
- procedure SetResultError(func: Psqlite_func; const arg: PAnsiChar; len: Integer);
+ procedure SetResultError(func: Psqlite_func; const arg: PChar; len: Integer);
function UserData(func: Psqlite_func): Pointer;
function AggregateContext(func: Psqlite_func; nBytes: Integer): Pointer;
function AggregateCount(func: Psqlite_func): Integer;
@@ -277,14 +277,14 @@
function Trace(db: Psqlite; callback: Tsqlite_trace_callback;
ptr: Pointer): Pointer;
- function Compile(db: Psqlite; const zSql: PAnsiChar;
- nBytes: Integer;var pzTail: PAnsiChar;
- var ppVm: Psqlite_vm; var pzErrmsg: PAnsiChar): Integer;
- function Step(pVm: Psqlite_vm; var pN: Integer; var pazValue: PPAnsiChar;
- var pazColName: PPAnsiChar): Integer;
- function Finalize(vm: Psqlite_vm; var pzErrMsg: PAnsiChar): Integer;
- function Reset(vm: Psqlite_vm; var pzErrMsg: PAnsiChar): Integer;
- function Bind(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
+ function Compile(db: Psqlite; const zSql: PChar;
+ nBytes: Integer;var pzTail: PChar;
+ var ppVm: Psqlite_vm; var pzErrmsg: PChar): Integer;
+ function Step(pVm: Psqlite_vm; var pN: Integer; var pazValue: PPChar;
+ var pazColName: PPChar): Integer;
+ function Finalize(vm: Psqlite_vm; var pzErrMsg: PChar): Integer;
+ function Reset(vm: Psqlite_vm; var pzErrMsg: PChar): Integer;
+ function Bind(vm: Psqlite_vm; idx: Integer; const value: PChar;
len: Integer; copy: Integer): Integer;
procedure ProgressHandler(db: Psqlite; p1: Integer;
@@ -292,8 +292,8 @@
function CommitHook(db: Psqlite; callback: Tsqlite_simple_callback;
ptr: Pointer): Pointer;
- function OpenEncrypted(const zFilename: PAnsiChar; const pKey: PAnsiChar;
- nKey: Integer; var pErrcode: Integer; var pzErrmsg: PAnsiChar): Psqlite;
+ function OpenEncrypted(const zFilename: PChar; const pKey: PChar;
+ nKey: Integer; var pErrcode: Integer; var pzErrmsg: PChar): Psqlite;
function ReKey(db: Psqlite; const pKey: Pointer; nKey: Integer): Integer;
function Key(db: Psqlite; const pKey: Pointer; nKey: Integer): Integer;
end;
@@ -308,43 +308,43 @@
function GetDescription: string;
procedure Initialize;
- function Open(const filename: PAnsiChar; mode: Integer;
- var errmsg: PAnsiChar): Psqlite;
+ function Open(const filename: PChar; mode: Integer;
+ var errmsg: PChar): Psqlite;
procedure Close(db: Psqlite);
- function Execute(db: Psqlite; const sql: PAnsiChar;
+ function Execute(db: Psqlite; const sql: PChar;
sqlite_callback: Tsqlite_callback; arg: Pointer;
- var errmsg: PAnsiChar): Integer;
+ var errmsg: PChar): Integer;
function LastInsertRowId(db: Psqlite): Integer;
function Changes(db: Psqlite): Integer;
function LastStatementChanges(db: Psqlite): Integer;
- function ErrorString(code: Integer): PAnsiChar;
+ function ErrorString(code: Integer): PChar;
procedure Interrupt(db: Psqlite);
- function Complete(const sql: PAnsiChar): Integer;
+ function Complete(const sql: PChar): Integer;
procedure BusyHandler(db: Psqlite; callback: Tsqlite_busy_callback;
ptr: Pointer);
procedure BusyTimeout(db: Psqlite; ms: Integer);
- function GetTable(db: Psqlite; const sql: PAnsiChar; var resultp: PPAnsiChar;
- var nrow: Integer; var ncolumn: Integer; var errmsg: PAnsiChar): Integer;
- procedure FreeTable(var result: PAnsiChar);
+ function GetTable(db: Psqlite; const sql: PChar; var resultp: PPChar;
+ var nrow: Integer; var ncolumn: Integer; var errmsg: PChar): Integer;
+ procedure FreeTable(var result: PChar);
procedure FreeMem(ptr: Pointer);
- function LibVersion: PAnsiChar;
- function LibEncoding: PAnsiChar;
+ function LibVersion: PChar;
+ function LibEncoding: PChar;
- function CreateFunction(db: Psqlite; const zName: PAnsiChar;
+ function CreateFunction(db: Psqlite; const zName: PChar;
nArg: Integer; callback: Tsqlite_function_callback;
pUserData: Pointer): Integer;
- function CreateAggregate(db: Psqlite; const zName: PAnsiChar;
+ function CreateAggregate(db: Psqlite; const zName: PChar;
nArg: Integer; callback: Tsqlite_function_callback;
finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer;
- function FunctionType(db: Psqlite; const zName: PAnsiChar;
+ function FunctionType(db: Psqlite; const zName: PChar;
datatype: Integer): Integer;
- function SetResultString(func: Psqlite_func; const arg: PAnsiChar;
- len: Integer): PAnsiChar;
+ function SetResultString(func: Psqlite_func; const arg: PChar;
+ len: Integer): PChar;
procedure SetResultInt(func: Psqlite_func; arg: Integer);
procedure SetResultDouble(func: Psqlite_func; arg: Double);
- procedure SetResultError(func: Psqlite_func; const arg: PAnsiChar; len: Integer);
+ procedure SetResultError(func: Psqlite_func; const arg: PChar; len: Integer);
function UserData(func: Psqlite_func): Pointer;
function AggregateContext(func: Psqlite_func; nBytes: Integer): Pointer;
function AggregateCount(func: Psqlite_func): Integer;
@@ -354,14 +354,14 @@
function Trace(db: Psqlite; callback: Tsqlite_trace_callback;
ptr: Pointer): Pointer;
- function Compile(db: Psqlite; const zSql: PAnsiChar;
- nBytes: Integer;var pzTail: PAnsiChar; var ppVm: Psqlite_vm;
- var pzErrmsg: PAnsiChar): Integer;
- function Step(pVm: Psqlite_vm; var pN: Integer; var pazValue: PPAnsiChar;
- var pazColName: PPAnsiChar): Integer;
- function Finalize(vm: Psqlite_vm; var pzErrMsg: PAnsiChar): Integer;
- function Reset(vm: Psqlite_vm; var pzErrMsg: PAnsiChar): Integer;
- function Bind(vm: Psqlite_vm; idx: Integer; const value: PAnsiChar;
+ function Compile(db: Psqlite; const zSql: PChar;
+ nBytes: Integer;var pzTail: PChar; var ppVm: Psqlite_vm;
+ var pzErrmsg: PChar): Integer;
+ function Step(pVm: Psqlite_vm; var pN: Integer; var pazValue: PPChar;
+ var pazColName: PPChar): Integer;
+ function Finalize(vm: Psqlite_vm; var pzErrMsg: PChar): Integer;
+ function Reset(vm: Psqlite_vm; var pzErrMsg: PChar): Integer;
+ function Bind(vm: Psqlite_vm; idx: Integer; const value: PChar;
len: Integer; copy: Integer): Integer;
procedure ProgressHandler(db: Psqlite; p1: Integer;
@@ -369,8 +369,8 @@
function CommitHook(db: Psqlite; callback: Tsqlite_simple_callback;
ptr: Pointer): Pointer;
- function OpenEncrypted(const zFilename: PAnsiChar; const pKey: PAnsiChar;
- nKey: Integer; var pErrcode: Integer; var pzErrmsg: PAnsiChar): Psqlite;
+ function OpenEncrypted(const zFilename: PChar; const pKey: PChar;
+ nKey: Integer; var pErrcode: Integer; var pzErrmsg: PChar): Psqlite;
function ReKey(db: Psqlite; const pKey: Pointer; nKey: Integer): Integer;
function Key(db: Psqlite; const pKey: Pointer; nKey: Integer): Integer;
end;
@@ -410,7 +410,7 @@
end;
function TZSQLite28PlainDriver.Bind(vm: Psqlite_vm; idx: Integer;
- const value: PAnsiChar; len, copy: Integer): Integer;
+ const value: PChar; len, copy: Integer): Integer;
begin
Result := ZPlainSqLite28.sqlite_bind(vm, idx, value, len, copy);
end;
@@ -437,20 +437,20 @@
Result := ZPlainSqLite28.sqlite_commit_hook(db, callback, ptr);
end;
-function TZSQLite28PlainDriver.Compile(db: Psqlite; const zSql: PAnsiChar;
- nBytes: Integer;var pzTail: PAnsiChar;
- var ppVm: Psqlite_vm; var pzErrmsg: PAnsiChar): Integer;
+function TZSQLite28PlainDriver.Compile(db: Psqlite; const zSql: PChar;
+ nBytes: Integer;var pzTail: PChar;
+ var ppVm: Psqlite_vm; var pzErrmsg: PChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_compile(db, zSql, pzTail, ppVm, pzErrmsg);
end;
-function TZSQLite28PlainDriver.Complete(const sql: PAnsiChar): Integer;
+function TZSQLite28PlainDriver.Complete(const sql: PChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_complete(sql);
end;
function TZSQLite28PlainDriver.CreateAggregate(db: Psqlite;
- const zName: PAnsiChar; nArg: Integer; callback: Tsqlite_function_callback;
+ const zName: PChar; nArg: Integer; callback: Tsqlite_function_callback;
finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer;
begin
Result := ZPlainSqLite28.sqlite_create_aggregate(db, zName, nArg, callback,
@@ -458,27 +458,27 @@
end;
function TZSQLite28PlainDriver.CreateFunction(db: Psqlite;
- const zName: PAnsiChar; nArg: Integer; callback: Tsqlite_function_callback;
+ const zName: PChar; nArg: Integer; callback: Tsqlite_function_callback;
pUserData: Pointer): Integer;
begin
Result := ZPlainSqLite28.sqlite_create_function(db, zName, nArg, callback,
pUserData);
end;
-function TZSQLite28PlainDriver.ErrorString(code: Integer): PAnsiChar;
+function TZSQLite28PlainDriver.ErrorString(code: Integer): PChar;
begin
Result := ZPlainSqLite28.sqlite_error_string(code);
end;
-function TZSQLite28PlainDriver.Execute(db: Psqlite; const sql: PAnsiChar;
+function TZSQLite28PlainDriver.Execute(db: Psqlite; const sql: PChar;
sqlite_callback: Tsqlite_callback; arg: Pointer;
- var errmsg: PAnsiChar): Integer;
+ var errmsg: PChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_exec(db, sql, sqlite_callback, arg, errmsg);
end;
function TZSQLite28PlainDriver.Finalize(vm: Psqlite_vm;
- var pzErrMsg: PAnsiChar): Integer;
+ var pzErrMsg: PChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_finalize(vm, pzErrMsg);
end;
@@ -488,20 +488,20 @@
ZPlainSqLite28.sqlite_freemem(ptr);
end;
-procedure TZSQLite28PlainDriver.FreeTable(var result: PAnsiChar);
+procedure TZSQLite28PlainDriver.FreeTable(var result: PChar);
begin
ZPlainSqLite28.sqlite_free_table(result);
end;
function TZSQLite28PlainDriver.FunctionType(db: Psqlite;
- const zName: PAnsiChar; datatype: Integer): Integer;
+ const zName: PChar; datatype: Integer): Integer;
begin
Result := ZPlainSqLite28.sqlite_function_type(db, zName, datatype);
end;
-function TZSQLite28PlainDriver.GetTable(db: Psqlite; const sql: PAnsiChar;
- var resultp: PPAnsiChar; var nrow, ncolumn: Integer;
- var errmsg: PAnsiChar): Integer;
+function TZSQLite28PlainDriver.GetTable(db: Psqlite; const sql: PChar;
+ var resultp: PPChar; var nrow, ncolumn: Integer;
+ var errmsg: PChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_get_table(db, sql, resultp, nrow, ncolumn,
errmsg);
@@ -522,31 +522,30 @@
Result := ZPlainSqLite28.sqlite_last_statement_changes(db);
end;
-function TZSQLite28PlainDriver.LibEncoding: PAnsiChar;
+function TZSQLite28PlainDriver.LibEncoding: PChar;
begin
Result := ZPlainSqLite28.sqlite_libencoding;
end;
-function TZSQLite28PlainDriver.LibVersion: PAnsiChar;
+function TZSQLite28PlainDriver.LibVersion: PChar;
begin
Result := ZPlainSqLite28.sqlite_libversion;
end;
-function TZSQLite28PlainDriver.Open(const filename: PAnsiChar; mode: Integer;
- var errmsg: PAnsiChar): Psqlite;
+function TZSQLite28PlainDriver.Open(const filename: PChar; mode: Integer;
+ var errmsg: PChar): Psqlite;
begin
Result := ZPlainSqLite28.sqlite_open(filename, mode, errmsg);
end;
-function TZSQLite28PlainDriver.OpenEncrypted(const zFilename, pKey: PAnsiChar;
- nKey: Integer; var pErrcode: Integer; var pzErrmsg: PAnsiChar): Psqlite;
+function TZSQLite28PlainDriver.OpenEncrypted(const zFilename, pKey: PChar;
+ nKey: Integer; var pErrcode: Integer; var pzErrmsg: PChar): Psqlite;
begin
if @ZPlainSqLite28.sqlite_open_encrypted = nil then
begin
Result := nil;
end
- else
- begin
+ else begin
Result := ZPlainSqLite28.sqlite_open_encrypted(zFilename, pKey, nKey,
pErrcode, pzErrmsg);
end;
@@ -565,8 +564,7 @@
begin
Result := SQLITE_OK;
end
- else
- begin
+ else begin
Result := ZPlainSqLite28.sqlite_rekey(db, pKey, nKey);
end;
end;
@@ -578,14 +576,13 @@
begin
Result := SQLITE_OK;
end
- else
- begin
+ else begin
Result := ZPlainSqLite28.sqlite_key(db, pKey, nKey);
end;
end;
function TZSQLite28PlainDriver.Reset(vm: Psqlite_vm;
- var pzErrMsg: PAnsiChar): Integer;
+ var pzErrMsg: PChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_reset(vm, pzErrMsg);
end;
@@ -603,7 +600,7 @@
end;
procedure TZSQLite28PlainDriver.SetResultError(func: Psqlite_func;
- const arg: PAnsiChar; len: Integer);
+ const arg: PChar; len: Integer);
begin
ZPlainSqLite28.sqlite_set_result_error(func, arg, len);
end;
@@ -615,13 +612,13 @@
end;
function TZSQLite28PlainDriver.SetResultString(func: Psqlite_func;
- const arg: PAnsiChar; len: Integer): PAnsiChar;
+ const arg: PChar; len: Integer): PChar;
begin
Result := ZPlainSqLite28.sqlite_set_result_string(func, arg, len);
end;
function TZSQLite28PlainDriver.Step(pVm: Psqlite_vm; var pN: Integer;
- var pazValue, pazColName: PPAnsiChar): Integer;
+ var pazValue, pazColName: PPChar): Integer;
begin
Result := ZPlainSqLite28.sqlite_step(pVm, pN, pazValue, pazColName);
end;
@@ -675,7 +672,7 @@
end;
function TZSQLite3PlainDriver.Bind(vm: Psqlite_vm; idx: Integer;
- const value: PAnsiChar; len, copy: Integer): Integer;
+ const value: PChar; len, copy: Integer): Integer;
begin
Result := ZPlainSqLite3.sqlite_bind(vm, idx, value, len, copy);
end;
@@ -702,37 +699,37 @@
Result := ZPlainSqLite3.sqlite_commit_hook(db, callback, ptr);
end;
-function TZSQLite3PlainDriver.Compile(db: Psqlite; const zSql: PAnsiChar;
- nBytes: Integer;var pzTail: PAnsiChar;
- var ppVm: Psqlite_vm; var pzErrmsg: PAnsiChar): Integer;
+function TZSQLite3PlainDriver.Compile(db: Psqlite; const zSql: PChar;
+ nBytes: Integer;var pzTail: PChar;
+ var ppVm: Psqlite_vm; var pzErrmsg: PChar): Integer;
begin
Result := ZPlainSqLite3.sqlite_compile(db, zSql, -1, ppVm, nil);
pzErrmsg := nil;
end;
-function TZSQLite3PlainDriver.Complete(const sql: PAnsiChar): Integer;
+function TZSQLite3PlainDriver.Complete(const sql: PChar): Integer;
begin
Result := ZPlainSqLite3.sqlite_complete(sql);
end;
function TZSQLite3PlainDriver.CreateAggregate(db: Psqlite;
- const zName: PAnsiChar; nArg: Integer; callback: Tsqlite_function_callback;
+ const zName: PChar; nArg: Integer; callback: Tsqlite_function_callback;
finalize: Tsqlite_finalize_callback; pUserData: Pointer): Integer;
begin
Result := SQLITE_MISUSE;
end;
function TZSQLite3PlainDriver.CreateFunction(db: Psqlite;
- const zName: PAnsiChar; nArg: Integer; callback: Tsqlite_function_callback;
+ const zName: PChar; nArg: Integer; callback: Tsqlite_function_callback;
pUserData: Pointer): Integer;
begin
Result := SQLITE_MISUSE;
end;
-function TZSQLite3PlainDriver.ErrorString(code: Integer): PAnsiChar;
+function TZSQLite3PlainDriver.ErrorString(code: Integer): PChar;
begin
- case code of
+ Case code of
SQLITE_OK: Result := 'not an error';
SQLITE_ERROR: Result := 'SQL logic error or missing database';
SQLITE_INTERNAL: Result := 'internal SQLite implementation flaw';
@@ -760,24 +757,22 @@
SQLITE_FORMAT: Result := 'auxiliary database format error';
SQLITE_RANGE: Result := 'bind index out of range';
SQLITE_NOTADB: Result := 'file is encrypted or is not a database';
- else
- Result := 'unknown error';
+ else Result := 'unknown error';
end;
end;
-function TZSQLite3PlainDriver.Execute(db: Psqlite; const sql: PAnsiChar;
+function TZSQLite3PlainDriver.Execute(db: Psqlite; const sql: PChar;
sqlite_callback: Tsqlite_callback; arg: Pointer;
- var errmsg: PAnsiChar): Integer;
+ var errmsg: PChar): Integer;
begin
errmsg:= nil;
Result := ZPlainSqLite3.sqlite_exec(db, sql, sqlite_callback, arg, errmsg);
end;
function TZSQLite3PlainDriver.Finalize(vm: Psqlite_vm;
- var pzErrMsg: PAnsiChar): Integer;
+ var pzErrMsg: PChar): Integer;
begin
- Result := ZPlainSqLite3.sqlite_finalize(vm);
- pzErrMsg := nil;
+ Result:= ZPlainSqLite3.sqlite_finalize(vm); pzErrMsg:=nil;
end;
procedure TZSQLite3PlainDriver.FreeMem(ptr: Pointer);
@@ -785,20 +780,20 @@
ZPlainSqLite3.sqlite_freemem(ptr);
end;
-procedure TZSQLite3PlainDriver.FreeTable(var result: PAnsiChar);
+procedure TZSQLite3PlainDriver.FreeTable(var result: PChar);
begin
ZPlainSqLite3.sqlite_free_table(result);
end;
function TZSQLite3PlainDriver.FunctionType(db: Psqlite;
- const zName: PAnsiChar; datatype: Integer): Integer;
+ const zName: PChar; datatype: Integer): Integer;
begin
Result := SQLITE_MISUSE;
end;
-function TZSQLite3PlainDriver.GetTable(db: Psqlite; const sql: PAnsiChar;
- var resultp: PPAnsiChar; var nrow, ncolumn: Integer;
- var errmsg: PAnsiChar): Integer;
+function TZSQLite3PlainDriver.GetTable(db: Psqlite; const sql: PChar;
+ var resultp: PPChar; var nrow, ncolumn: Integer;
+ var errmsg: PChar): Integer;
begin
Result := ZPlainSqLite3.sqlite_get_table(db, sql, resultp, nrow, ncolumn,
errmsg);
@@ -819,18 +814,18 @@
Result := SQLITE_MISUSE;
end;
-function TZSQLite3PlainDriver.LibEncoding: PAnsiChar;
+function TZSQLite3PlainDriver.LibEncoding: PChar;
begin
Result := nil;
end;
-function TZSQLite3PlainDriver.LibVersion: PAnsiChar;
+function TZSQLite3PlainDriver.LibVersion: PChar;
begin
Result := ZPlainSqLite3.sqlite_libversion;
end;
-function TZSQLite3PlainDriver.Open(const filename: PAnsiChar; mode: Integer;
- var errmsg: PAnsiChar): Psqlite;
+function TZSQLite3PlainDriver.Open(const filename: PChar; mode: Integer;
+ var errmsg: PChar): Psqlite;
var
Result0: Psqlite;
Version: string;
@@ -843,11 +838,12 @@
ZPlainSqLite3.sqlite_open(PAnsiChar(AnsiToUTF8(FileNameString)), Result0)
else
ZPlainSqLite3.sqlite_open(filename, Result0);
+ ZPlainSqLite3.sqlite_busy_timeout(Result0,50000);
Result := Result0;
end;
-function TZSQLite3PlainDriver.OpenEncrypted(const zFilename, pKey: PAnsiChar;
- nKey: Integer; var pErrcode: Integer; var pzErrmsg: PAnsiChar): Psqlite;
+function TZSQLite3PlainDriver.OpenEncrypted(const zFilename, pKey: PChar;
+ nKey: Integer; var pErrcode: Integer; var pzErrmsg: PChar): Psqlite;
begin
pErrcode := SQLITE_MISUSE;
pzErrmsg := 'function is not used in the current version of the library';
@@ -867,8 +863,7 @@
begin
Result := SQLITE_OK;
end
- else
- begin
+ else begin
Result := ZPlainSqLite3.sqlite_rekey(db, pKey, nKey);
end;
end;
@@ -880,14 +875,13 @@
begin
Result := SQLITE_OK;
end
- else
- begin
+ else begin
Result := ZPlainSqLite3.sqlite_key(db, pKey, nKey);
end;
end;
function TZSQLite3PlainDriver.Reset(vm: Psqlite_vm;
- var pzErrMsg: PAnsiChar): Integer;
+ var pzErrMsg: PChar): Integer;
begin
Result := ZPlainSqLite3.sqlite_reset(vm);
pzErrMsg := nil;
@@ -906,7 +900,7 @@
end;
procedure TZSQLite3PlainDriver.SetResultError(func: Psqlite_func;
- const arg: PAnsiChar; len: Integer);
+ const arg: PChar; len: Integer);
begin
ZPlainSqLite3.sqlite_set_result_error(func, arg, len);
end;
@@ -918,44 +912,39 @@
end;
function TZSQLite3PlainDriver.SetResultString(func: Psqlite_func;
- const arg: PAnsiChar; len: Integer): PAnsiChar;
+ const arg: PChar; len: Integer): PChar;
begin
Result := ZPlainSqLite3.sqlite_set_result_string(func, arg, len, nil);
end;
function TZSQLite3PlainDriver.Step(pVm: Psqlite_vm; var pN: Integer;
- var pazValue, pazColName: PPAnsiChar): Integer;
-var
- i: Integer;
- val,cname,ctype: PAnsiChar;
- pazValue0, pazColName0, pazColType: PPAnsiChar;
+ var pazValue, pazColName: PPChar): Integer;
+var i: Integer;
+ val,cname,ctype: PChar;
+ pazValue0, pazColName0, pazColType: PPChar;
begin
pazValue0 := nil; // satisfy compiler
Result := ZPlainSqLite3.sqlite_step(pVm);
- if (Result = SQLITE_ROW) or (Result = SQLITE_DONE) then
- begin
+ if (Result=SQLITE_ROW) or (Result=SQLITE_DONE) then begin
pN:= ZPlainSqLite3.sqlite_column_count(pVm);
- if Result = SQLITE_ROW then
- begin
- pazValue:= AllocMem(SizeOf(PPAnsiChar)*(pN+1));
+ if Result=SQLITE_ROW then begin
+ pazValue:= AllocMem(SizeOf(PPChar)*(pN+1));
pazValue0:= pazValue;
end;
- pazColName:= AllocMem(SizeOf(PPAnsiChar)*(pN+1)*2);
+ pazColName:= AllocMem(SizeOf(PPChar)*(pN+1)*2);
pazColName0:= pazColName;
pazColType:= pazColName;
Inc(pazColType, pN);
// for i:=1 to pN do
// inc(pazColType);
- for i := 0 to pN - 1 do
- begin
+ for i:=0 to pN-1 do begin
if Result = SQLITE_ROW then
begin
val := ZPlainSqLite3.sqlite_column_bytes(pVm, i);
cname:= ZPlainSqLite3.sqlite_column_name(pVm, i);
ctype:= ZPlainSqLite3.sqlite_column_decltype(pVm, i);
- pazValue0^ := val;
- inc(pazValue0);
+ pazValue0^ := val; inc(pazValue0);
end
else
begin
@@ -964,14 +953,11 @@
end;
pazColName0^:= cname;
pazColType^ := ctype;
- inc(pazColName0);
- inc(pazColType);
+ inc(pazColName0);inc(pazColType);
end;
- if Result = SQLITE_ROW then
- pazValue0^ := nil;
+ if Result=SQLITE_ROW then pazValue0^:= nil;
pazColType^:= nil;
- if Result = SQLITE_DONE then
- pazValue := nil;
+ if Result=SQLITE_DONE then pazValue:= nil;
end;
end;