?? sqlite3lib.pas
字號:
Procedure SQLite3FreeLibrary;
Function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString;
Function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString;
Function SQLite3_Bind_Str(hStmt: TSQLiteStmt; ParamNum: Integer; ptrData: AnsiString): Integer;
Function SQLite3_Bind_Str16(hStmt: TSQLiteStmt; ParamNum: Integer; ptrData: WideString): Integer;
Function SQLite3_Column_Str(hStmt: TSQLiteStmt; ColNum: Integer): AnsiString;
Function SQLite3_Column_Str16(hStmt: TSQLiteStmt; ColNum: Integer): WideString;
Procedure SQLite3_Result_Str(Const Context: Pointer; Data: AnsiString);
Procedure SQLite3_Result_Str16(Const Context: Pointer; Data: WideString);
Function SQLite3_Value_Str(Value: Pointer): AnsiString;
Function SQLite3_Value_Str16(Value: Pointer): WideString;
Implementation
Uses Windows, SysUtils;
{$IFDEF SQLite_Static}
{$I Sqlite3Obj.inc}
{$ENDIF}
Function IsSQLiteDBCrypted(Const FileName: WideString): Boolean;
Const
SQLITE_HEADER = 'SQLite format';
Var
H: THandle;
S: String;
Begin
Result := False;
H := CreateFileW(PWideChar(FileName), GENERIC_READ Or GENERIC_WRITE, 0,
Nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
If H = INVALID_HANDLE_VALUE Then Exit;
SetLength(S, 13);
FileRead(H, S[1], 13);
FileClose(H);
Result := CompareText(S, SQLITE_HEADER) <> 0;
End;
Function SQLite3LoadLibrary: boolean;
Function GetProcAddr(lpProcName: AnsiString): FARPROC;
Begin
Result := GetProcAddress(SQLite3_DllHandle, PAnsiChar(LowerCase(lpProcName)));
If Result = Nil Then
Exception.Create(Format('Load %s function [%s] faild.', [SQLite3_DllName, lpProcName]));
End;
Begin
{$IFNDEF SQLite_Static}
SQLite3_DllHandle := LoadLibraryA(PAnsiChar(SQLite3_DllName));
If SQLite3_DllHandle <> 0 Then
Begin
{$IFDEF UseSQLiteCrypt}
@SQLite3_Key := GetProcAddr('sqlite3_key');
@SQLite3_Rekey := GetProcAddr('sqlite3_rekey');
{$ENDIF}
@SQLite3_Aggregate_Context := GetProcAddr('sqlite3_aggregate_context');
@SQLite3_Auto_Extension := GetProcAddr('sqlite3_auto_extension');
@SQLite3_Bind_Blob := GetProcAddr('sqlite3_bind_blob');
@SQLite3_Bind_Double := GetProcAddr('sqlite3_bind_double');
@SQLite3_Bind_Int := GetProcAddr('sqlite3_bind_int');
@SQLite3_Bind_Int64 := GetProcAddr('sqlite3_bind_int64');
@SQLite3_Bind_Null := GetProcAddr('sqlite3_bind_null');
@SQLite3_Bind_Text := GetProcAddr('sqlite3_bind_text');
@SQLite3_Bind_Text16 := GetProcAddr('sqlite3_bind_text16');
@SQLite3_Bind_Value := GetProcAddr('sqlite3_bind_value');
@SQLite3_Bind_ZeroBlob := GetProcAddr('sqlite3_bind_zeroblob');
@SQLite3_Bind_Parameter_Count := GetProcAddr('sqlite3_bind_parameter_count');
@SQLite3_Bind_Parameter_Index := GetProcAddr('sqlite3_bind_parameter_index');
@SQLite3_Bind_Parameter_Name := GetProcAddr('sqlite3_bind_parameter_name');
@SQLite3_Blob_Bytes := GetProcAddr('sqlite3_blob_bytes');
@SQLite3_Blob_Close := GetProcAddr('sqlite3_blob_close');
@SQLite3_Blob_Open := GetProcAddr('sqlite3_blob_open');
@SQLite3_Blob_Read := GetProcAddr('sqlite3_blob_read');
@SQLite3_Blob_Write := GetProcAddr('sqlite3_blob_write');
@SQLite3_Busy_Handler := GetProcAddr('sqlite3_busy_handler');
@SQLite3_Busy_Timeout := GetProcAddr('sqlite3_busy_timeout');
@SQLite3_Changes := GetProcAddr('sqlite3_changes');
@SQLite3_Clear_Bindings := GetProcAddr('sqlite3_clear_bindings');
@SQLite3_Close := GetProcAddr('sqlite3_close');
@SQLite3_Collation_Needed := GetProcAddr('sqlite3_collation_needed');
@SQLite3_Collation_Needed16 := GetProcAddr('sqlite3_collation_needed16');
@SQLite3_Column_Count := GetProcAddr('sqlite3_column_count');
@SQLite3_Column_Blob := GetProcAddr('sqlite3_column_blob');
@SQLite3_Column_Bytes := GetProcAddr('sqlite3_column_bytes');
@SQLite3_Column_Bytes16 := GetProcAddr('sqlite3_column_bytes16');
@SQLite3_Column_Double := GetProcAddr('sqlite3_column_double');
@SQLite3_Column_Int := GetProcAddr('sqlite3_column_int');
@SQLite3_Column_Int64 := GetProcAddr('sqlite3_column_int64');
@SQLite3_Column_Text := GetProcAddr('sqlite3_column_text');
@SQLite3_Column_Text16 := GetProcAddr('sqlite3_column_text16');
@SQLite3_Column_Type := GetProcAddr('sqlite3_column_type');
@SQLite3_Column_Value := GetProcAddr('sqlite3_column_value');
@SQLite3_Column_Name := GetProcAddr('sqlite3_column_name');
@SQLite3_Column_Name16 := GetProcAddr('sqlite3_column_name16');
@SQLite3_Column_DeclType := GetProcAddr('sqlite3_column_decltype');
@SQLite3_Column_Database_Name := GetProcAddr('sqlite3_column_database_name');
@SQLite3_Column_Database_Name16 := GetProcAddr('sqlite3_column_database_name16');
@SQLite3_Column_Table_Name := GetProcAddr('sqlite3_column_table_name');
@SQLite3_Column_Table_Name16 := GetProcAddr('sqlite3_column_table_name16');
@SQLite3_Column_Origin_Name := GetProcAddr('sqlite3_column_origin_name');
@SQLite3_Column_Origin_Name16 := GetProcAddr('sqlite3_column_origin_name16');
@SQLite3_Commit_Hook := GetProcAddr('sqlite3_commit_hook');
@SQLite3_Complete := GetProcAddr('sqlite3_complete');
@SQLite3_Complete16 := GetProcAddr('sqlite3_complete16');
@SQLite3_Context_DB_Handle := GetProcAddr('sqlite3_context_db_handle');
@SQLite3_Create_Collation := GetProcAddr('sqlite3_create_collation');
@SQLite3_Create_Collation16 := GetProcAddr('sqlite3_create_collation16');
@SQLite3_Create_Collation_v2 := GetProcAddr('sqlite3_create_collation_v2');
@SQLite3_Create_Function := GetProcAddr('sqlite3_create_function');
@SQLite3_Create_Function16 := GetProcAddr('sqlite3_create_function16');
@SQLite3_Create_Module := GetProcAddr('sqlite3_create_module');
@SQLite3_Create_Module_v2 := GetProcAddr('sqlite3_create_module_v2');
@SQLite3_Data_Count := GetProcAddr('sqlite3_data_count');
@SQLite3_DB_Handle := GetProcAddr('sqlite3_db_handle');
@SQLite3_DB_Mutex := GetProcAddr('sqlite3_db_mutex');
@SQLite3_DB_Status := GetProcAddr('sqlite3_db_status');
@SQLite3_Declare_Vtab := GetProcAddr('sqlite3_declare_vtab');
@SQLite3_Enable_Load_Extension := GetProcAddr('sqlite3_enable_load_extension');
@SQLite3_Enable_Shared_Cache := GetProcAddr('sqlite3_enable_shared_cache');
@SQLite3_ErrCode := GetProcAddr('sqlite3_errcode');
@SQLite3_ErrMsg := GetProcAddr('sqlite3_errmsg');
@SQLite3_ErrMsg16 := GetProcAddr('sqlite3_errmsg16');
@SQLite3_Exec := GetProcAddr('sqlite3_exec');
@SQLite3_Extended_Errcode := GetProcAddr('sqlite3_extended_errcode');
@SQLite3_Extended_Result_Codes := GetProcAddr('sqlite3_extended_result_codes');
@SQLite3_File_Control := GetProcAddr('sqlite3_file_control');
@SQLite3_Finalize := GetProcAddr('sqlite3_finalize');
@SQLite3_Free := GetProcAddr('sqlite3_free');
@SQLite3_FreeTable := GetProcAddr('sqlite3_free_table');
@SQLite3_Get_Autocommit := GetProcAddr('sqlite3_get_autocommit');
@SQLite3_Get_Auxdata := GetProcAddr('sqlite3_get_auxdata');
@SQLite3_GetTable := GetProcAddr('sqlite3_get_table');
@SQLite3_Initialize := GetProcAddr('sqlite3_initialize');
@SQLite3_Interrupt := GetProcAddr('sqlite3_interrupt');
@SQLite3_Last_Insert_RowID := GetProcAddr('sqlite3_last_insert_rowid');
@SQLite3_LibVersion := GetProcAddr('sqlite3_libversion');
@SQLite3_Libversion_Number := GetProcAddr('sqlite3_libversion_number');
@SQLite3_Limit := GetProcAddr('sqlite3_limit');
@SQLite3_Load_Extension := GetProcAddr('sqlite3_load_extension');
@SQLite3_Malloc := GetProcAddr('sqlite3_malloc');
@SQLite3_Mutex_Alloc := GetProcAddr('sqlite3_mutex_alloc');
@SQLite3_Mutex_Enter := GetProcAddr('sqlite3_mutex_enter');
@SQLite3_Mutex_Free := GetProcAddr('sqlite3_mutex_free');
@SQLite3_Mutex_Leave := GetProcAddr('sqlite3_mutex_leave');
@SQLite3_Mutex_Try := GetProcAddr('sqlite3_mutex_try');
@SQLite3_Next_Stmt := GetProcAddr('sqlite3_next_stmt');
@SQLite3_Open := GetProcAddr('sqlite3_open');
@SQLite3_Open16 := GetProcAddr('sqlite3_open16');
@SQLite3_Open_v2 := GetProcAddr('sqlite3_open_v2');
@SQLite3_OS_End := GetProcAddr('sqlite3_os_end');
@SQLite3_OS_Init := GetProcAddr('sqlite3_os_init');
@SQLite3_Overload_Function := GetProcAddr('sqlite3_overload_function');
@SQLite3_Prepare := GetProcAddr('sqlite3_prepare');
@SQLite3_Prepare_v2 := GetProcAddr('sqlite3_prepare_v2');
@SQLite3_Prepare16 := GetProcAddr('sqlite3_prepare16');
@SQLite3_Prepare16_v2 := GetProcAddr('sqlite3_prepare16_v2');
@SQLite3_Profile := GetProcAddr('sqlite3_profile');
@SQLite3_Progress_handler := GetProcAddr('sqlite3_progress_handler');
@SQLite3_Randomness := GetProcAddr('sqlite3_randomness');
@SQLite3_Realloc := GetProcAddr('sqlite3_realloc');
@SQLite3_Release_Memory := GetProcAddr('sqlite3_release_memory');
@SQLite3_Reset := GetProcAddr('sqlite3_reset');
@SQLite3_Reset_Auto_Extension := GetProcAddr('sqlite3_reset_auto_extension');
@SQLite3_Result_Blob := GetProcAddr('sqlite3_result_blob');
@SQLite3_Result_Double := GetProcAddr('sqlite3_result_double');
@SQLite3_Result_Error := GetProcAddr('sqlite3_result_error');
@SQLite3_Result_Error16 := GetProcAddr('sqlite3_result_error16');
@SQLite3_Result_Error_code := GetProcAddr('sqlite3_result_error_code');
@SQLite3_Result_Error_nomem := GetProcAddr('sqlite3_result_error_nomem');
@SQLite3_Result_Error_toobig := GetProcAddr('sqlite3_result_error_toobig');
@SQLite3_Result_Int := GetProcAddr('sqlite3_result_int');
@SQLite3_Result_Int64 := GetProcAddr('sqlite3_result_int64');
@SQLite3_Result_Null := GetProcAddr('sqlite3_result_null');
@SQLite3_Result_Text := GetProcAddr('sqlite3_result_text');
@SQLite3_Result_Text16 := GetProcAddr('sqlite3_result_text16');
@SQLite3_Result_Text16be := GetProcAddr('sqlite3_result_text16be');
@SQLite3_Result_Text16le := GetProcAddr('sqlite3_result_text16le');
@SQLite3_Result_Value := GetProcAddr('sqlite3_result_value');
@SQLite3_Result_Zeroblob := GetProcAddr('sqlite3_result_zeroblob');
@SQLite3_Rollback_Hook := GetProcAddr('sqlite3_rollback_hook');
@SQLite3_Set_Authorizer := GetProcAddr('sqlite3_set_authorizer');
@SQLite3_Set_Auxdata := GetProcAddr('sqlite3_set_auxdata');
@SQLite3_Shutdown := GetProcAddr('sqlite3_shutdown');
@SQLite3_Sleep := GetProcAddr('sqlite3_sleep');
@SQLite3_Soft_Heap_Limit := GetProcAddr('sqlite3_soft_heap_limit');
@SQLite3_Sql := GetProcAddr('sqlite3_sql');
@SQLite3_Status := GetProcAddr('sqlite3_status');
@SQLite3_Step := GetProcAddr('sqlite3_step');
@SQLite3_Stmt_Status := GetProcAddr('sqlite3_stmt_status');
@SQLite3_Table_Column_Metadata := GetProcAddr('sqlite3_table_column_metadata');
@SQLite3_Threadsafe := GetProcAddr('sqlite3_threadsafe');
@SQLite3_TotalChanges := GetProcAddr('sqlite3_total_changes');
@SQLite3_Trace := GetProcAddr('sqlite3_trace');
@SQLite3_Update_Hook := GetProcAddr('sqlite3_update_hook');
@SQLite3_User_Data := GetProcAddr('sqlite3_user_data');
@SQLite3_Value_Blob := GetProcAddr('sqlite3_value_blob');
@SQLite3_Value_Bytes := GetProcAddr('sqlite3_value_bytes');
@SQLite3_Value_Bytes16 := GetProcAddr('sqlite3_value_bytes16');
@SQLite3_Value_Double := GetProcAddr('sqlite3_value_double');
@SQLite3_Value_Int := GetProcAddr('sqlite3_value_int');
@SQLite3_Value_Int64 := GetProcAddr('sqlite3_value_int64');
@SQLite3_Value_Numeric_Type := GetProcAddr('sqlite3_value_numeric_type');
@SQLite3_Value_Text := GetProcAddr('sqlite3_value_text');
@SQLite3_Value_Text16 := GetProcAddr('sqlite3_value_text16');
@SQLite3_Value_Text16be := GetProcAddr('sqlite3_value_text16be');
@SQLite3_Value_Text16le := GetProcAddr('sqlite3_value_text16le');
@SQLite3_Value_Type := GetProcAddr('sqlite3_value_type');
@SQLite3_Vfs_Find := GetProcAddr('sqlite3_vfs_find');
@SQLite3_Vfs_Register := GetProcAddr('sqlite3_vfs_register');
@SQLite3_Vfs_Unregister := GetProcAddr('sqlite3_vfs_unregister');
@SQLite3_Win32_Mbcs_TO_UTF8 := GetProcAddr('sqlite3_win32_mbcs_to_utf8');
//For SQLite 3.6.11
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -