📄 sqlite3lib.pas
字号:
@SQLite3_Create_Collation := @_sqlite3_create_collation;
@SQLite3_Create_Collation16 := @_sqlite3_create_collation16;
@SQLite3_Create_Collation_v2 := @_sqlite3_create_collation_v2;
@SQLite3_Create_Function := @_sqlite3_create_function;
@SQLite3_Create_Function16 := @_sqlite3_create_function16;
@SQLite3_Create_Module := @_sqlite3_create_module;
@SQLite3_Create_Module_v2 := @_sqlite3_create_module_v2;
@SQLite3_Data_Count := @_sqlite3_data_count;
@SQLite3_DB_Handle := @_sqlite3_db_handle;
@SQLite3_DB_Mutex := @_sqlite3_db_mutex;
@SQLite3_DB_Status := @_sqlite3_db_status;
@SQLite3_Declare_Vtab := @_sqlite3_declare_vtab;
@SQLite3_Enable_Load_Extension := @_sqlite3_enable_load_extension;
@SQLite3_Enable_Shared_Cache := @_sqlite3_enable_shared_cache;
@SQLite3_ErrCode := @_sqlite3_errcode;
@SQLite3_ErrMsg := @_sqlite3_errmsg;
@SQLite3_ErrMsg16 := @_sqlite3_errmsg16;
@SQLite3_Exec := @_sqlite3_exec;
@SQLite3_Extended_Errcode := @_sqlite3_extended_errcode;
@SQLite3_Extended_Result_Codes := @_sqlite3_extended_result_codes;
@SQLite3_File_Control := @_sqlite3_file_control;
@SQLite3_Finalize := @_sqlite3_finalize;
@SQLite3_Free := @_sqlite3_free;
@SQLite3_FreeTable := @_sqlite3_free_table;
@SQLite3_Get_Autocommit := @_sqlite3_get_autocommit;
@SQLite3_Get_Auxdata := @_sqlite3_get_auxdata;
@SQLite3_GetTable := @_sqlite3_get_table;
@SQLite3_Initialize := @_sqlite3_initialize;
@SQLite3_Interrupt := @_sqlite3_interrupt;
@SQLite3_Last_Insert_RowID := @_sqlite3_last_insert_rowid;
@SQLite3_LibVersion := @_sqlite3_libversion;
@SQLite3_Libversion_Number := @_SQLite3_Libversion_Number;
@SQLite3_Limit := @_sqlite3_limit;
@SQLite3_Load_Extension := @_sqlite3_load_extension;
@SQLite3_Malloc := @_sqlite3_malloc;
@SQLite3_Mutex_Alloc := @_sqlite3_mutex_alloc;
@SQLite3_Mutex_Enter := @_sqlite3_mutex_enter;
@SQLite3_Mutex_Free := @_sqlite3_mutex_free;
@SQLite3_Mutex_Leave := @_sqlite3_mutex_leave;
@SQLite3_Mutex_Try := @_sqlite3_mutex_try;
@SQLite3_Next_Stmt := @_sqlite3_next_stmt;
@SQLite3_Open := @_sqlite3_open;
@SQLite3_Open16 := @_sqlite3_open16;
@SQLite3_Open_v2 := @_sqlite3_open_v2;
@SQLite3_OS_End := @_sqlite3_os_end;
@SQLite3_OS_Init := @_sqlite3_os_init;
@SQLite3_Overload_Function := @_sqlite3_overload_function;
@SQLite3_Prepare := @_sqlite3_prepare;
@SQLite3_Prepare_v2 := @_sqlite3_prepare_v2;
@SQLite3_Prepare16 := @_sqlite3_prepare16;
@SQLite3_Prepare16_v2 := @_sqlite3_prepare16_v2;
@SQLite3_Profile := @_sqlite3_profile;
@SQLite3_Progress_handler := @_sqlite3_progress_handler;
@SQLite3_Randomness := @_sqlite3_randomness;
@SQLite3_Realloc := @_sqlite3_realloc;
@SQLite3_Release_Memory := @_sqlite3_release_memory;
@SQLite3_Reset := @_SQLite3_Reset;
@SQLite3_Reset_Auto_Extension := @_sqlite3_reset_auto_extension;
@SQLite3_Result_Blob := @_sqlite3_result_blob;
@SQLite3_Result_Double := @_sqlite3_result_double;
@SQLite3_Result_Error := @_sqlite3_result_error;
@SQLite3_Result_Error16 := @_sqlite3_result_error16;
@SQLite3_Result_Error_code := @_sqlite3_result_error_code;
@SQLite3_Result_Error_nomem := @_sqlite3_result_error_nomem;
@SQLite3_Result_Error_toobig := @_sqlite3_result_error_toobig;
@SQLite3_Result_Int := @_sqlite3_result_int;
@SQLite3_Result_Int64 := @_sqlite3_result_int64;
@SQLite3_Result_Null := @_sqlite3_result_null;
@SQLite3_Result_Text := @_sqlite3_result_text;
@SQLite3_Result_Text16 := @_sqlite3_result_text16;
@SQLite3_Result_Text16be := @_sqlite3_result_text16be;
@SQLite3_Result_Text16le := @_sqlite3_result_text16le;
@SQLite3_Result_Value := @_sqlite3_result_value;
@SQLite3_Result_Zeroblob := @_sqlite3_result_zeroblob;
@SQLite3_Rollback_Hook := @_sqlite3_rollback_hook;
@SQLite3_Set_Authorizer := @_sqlite3_set_authorizer;
@SQLite3_Set_Auxdata := @_sqlite3_set_auxdata;
@SQLite3_Shutdown := @_sqlite3_shutdown;
@SQLite3_Sleep := @_sqlite3_sleep;
@SQLite3_Soft_Heap_Limit := @_sqlite3_soft_heap_limit;
@SQLite3_Sql := @_sqlite3_sql;
@SQLite3_Status := @_sqlite3_status;
@SQLite3_Step := @_sqlite3_step;
@SQLite3_Stmt_Status := @_sqlite3_stmt_status;
@SQLite3_Table_Column_Metadata := @_sqlite3_table_column_metadata;
@SQLite3_Threadsafe := @_sqlite3_threadsafe;
@SQLite3_TotalChanges := @_sqlite3_total_changes;
@SQLite3_Trace := @_sqlite3_trace;
@SQLite3_Update_Hook := @_sqlite3_update_hook;
@SQLite3_User_Data := @_sqlite3_user_data;
@SQLite3_Value_Blob := @_sqlite3_value_blob;
@SQLite3_Value_Bytes := @_sqlite3_value_bytes;
@SQLite3_Value_Bytes16 := @_sqlite3_value_bytes16;
@SQLite3_Value_Double := @_sqlite3_value_double;
@SQLite3_Value_Int := @_sqlite3_value_int;
@SQLite3_Value_Int64 := @_sqlite3_value_int64;
@SQLite3_Value_Numeric_Type := @_sqlite3_value_numeric_type;
@SQLite3_Value_Text := @_sqlite3_value_text;
@SQLite3_Value_Text16 := @_sqlite3_value_text16;
@SQLite3_Value_Text16be := @_sqlite3_value_text16be;
@SQLite3_Value_Text16le := @_sqlite3_value_text16le;
@SQLite3_Value_Type := @_sqlite3_value_type;
@SQLite3_Vfs_Find := @_sqlite3_vfs_find;
@SQLite3_Vfs_Register := @_sqlite3_vfs_register;
@SQLite3_Vfs_Unregister := @_sqlite3_vfs_unregister;
@SQLite3_Win32_Mbcs_TO_UTF8 := @_sqlite3_win32_mbcs_to_utf8;
//For SQLite 3.6.11
{
@SQLite3_Backup_Init := @_sqlite3_backup_init;
@SQLite3_Backup_Step := @_sqlite3_backup_step;
@SQLite3_Backup_Finish := @_sqlite3_backup_finish;
@SQLite3_Backup_Remaining := @_sqlite3_backup_remaining;
@SQLite3_Backup_Pagecount := @_sqlite3_backup_pagecount;
}
{$ENDIF}
Result := SQLite3_DllHandle <> 0;
End;
Procedure SQLite3FreeLibrary;
Begin
If SQLite3_DllHandle <> 1 Then
If SQLite3_DllHandle <> 0 Then
FreeLibrary(SQLite3_DllHandle);
SQLite3_DllHandle := 0;
End;
Function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString;
Begin
Case SQLiteFieldTypeCode Of
SQLITE_INTEGER: Result := 'Integer';
SQLITE_FLOAT: Result := 'Float';
SQLITE_TEXT: Result := 'Text';
SQLITE_BLOB: Result := 'Blob';
SQLITE_NULL: Result := 'Null';
Else
Result := 'Unknown SQLite Field Type Code "' + IntToStr(SQLiteFieldTypeCode) + '"';
End;
End;
Function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString;
Begin
Case SQLiteErrorCode Of
SQLITE_OK: Result := 'Successful result';
SQLITE_ERROR: Result := 'SQL error or missing database';
SQLITE_INTERNAL: Result := 'An internal logic error in SQLite';
SQLITE_PERM: Result := 'Access permission denied';
SQLITE_ABORT: Result := 'Callback routine requested an abort';
SQLITE_BUSY: Result := 'The database file is locked';
SQLITE_LOCKED: Result := 'A table in the database is locked';
SQLITE_NOMEM: Result := 'A malloc() failed';
SQLITE_READONLY: Result := 'Attempt to write a readonly database';
SQLITE_INTERRUPT: Result := 'Operation terminated by sqlite3_interrupt()';
SQLITE_IOERR: Result := 'Some kind of disk I/O error occurred';
SQLITE_CORRUPT: Result := 'The database disk image is malformed';
SQLITE_NOTFOUND: Result := '(Internal Only) Table or record not found';
SQLITE_FULL: Result := 'Insertion failed because database is full';
SQLITE_CANTOPEN: Result := 'Unable to open the database file';
SQLITE_PROTOCOL: Result := 'Database lock protocol error';
SQLITE_EMPTY: Result := 'Database is empty';
SQLITE_SCHEMA: Result := 'The database schema changed';
SQLITE_TOOBIG: Result := 'Too much data for one row of a table';
SQLITE_CONSTRAINT: Result := 'Abort due to contraint violation';
SQLITE_MISMATCH: Result := 'Data type mismatch';
SQLITE_MISUSE: Result := 'Library used incorrectly';
SQLITE_NOLFS: Result := 'Uses OS features not supported on host';
SQLITE_AUTH: Result := 'Authorization denied';
SQLITE_FORMAT: Result := 'Auxiliary database format error';
SQLITE_RANGE: Result := '2nd parameter to sqlite3_bind out of range';
SQLITE_NOTADB: Result := 'File opened that is not a database file';
SQLITE_ROW: Result := 'sqlite3_step() has another row ready';
SQLITE_DONE: Result := 'sqlite3_step() has finished executing';
Else
Result := 'Unknown SQLite Error Code "' + IntToStr(SQLiteErrorCode) + '"';
End;
End;
Function SQLite3_Bind_Str(hStmt: TSQLiteStmt; ParamNum: Integer; ptrData: AnsiString): Integer;
Begin
Result := SQLite3_Bind_Text(hStmt, ParamNum, PAnsiChar(ptrData), Length(ptrData), Nil);
End;
Function SQLite3_Bind_Str16(hStmt: TSQLiteStmt; ParamNum: Integer; ptrData: WideString): Integer;
Begin
Result := SQLite3_Bind_Text16(hStmt, ParamNum, PWideChar(ptrData), Length(ptrData) * 2, Nil);
End;
Function SQLite3_Column_Str(hStmt: TSQLiteStmt; ColNum: Integer): AnsiString;
Begin
Result := AnsiString(SQLite3_Column_Text(hStmt, ColNum));
End;
Function SQLite3_Column_Str16(hStmt: TSQLiteStmt; ColNum: Integer): WideString;
Begin
Result := WideString(SQLite3_Column_Text(hStmt, ColNum));
End;
Procedure SQLite3_Result_Str(Const Context: Pointer; Data: AnsiString);
Begin
SQLite3_Result_Text(Context, PAnsiChar(Data), Length(Data), Nil);
End;
Procedure SQLite3_Result_Str16(Const Context: Pointer; Data: WideString);
Begin
SQLite3_Result_Text16(Context, PWideChar(Data), Length(Data) * 2, Nil);
End;
Function SQLite3_Value_Str(Value: Pointer): AnsiString;
Begin
Result := AnsiString(SQLite3_Value_Text(Value));
End;
Function SQLite3_Value_Str16(Value: Pointer): WideString;
Begin
Result := WideString(SQLite3_Value_Text16(Value));
End;
End.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -