@@ -49,12 +49,13 @@ mod aliased {
4949 sqlite3_column_value as column_value, sqlite3_commit_hook as commit_hook,
5050 sqlite3_context_db_handle as context_db_handle,
5151 sqlite3_create_function_v2 as create_function_v2,
52- sqlite3_create_module_v2 as create_module_v2, sqlite3_declare_vtab as declare_vtab,
53- sqlite3_errcode as errcode, sqlite3_errmsg as errmsg, sqlite3_error_offset as error_offset,
54- sqlite3_exec as exec, sqlite3_finalize as finalize, sqlite3_free as free,
55- sqlite3_get_autocommit as get_autocommit, sqlite3_get_auxdata as get_auxdata,
56- sqlite3_libversion as libversion, sqlite3_libversion_number as libversion_number,
57- sqlite3_malloc as malloc, sqlite3_malloc64 as malloc64, sqlite3_mutex_alloc as mutex_alloc,
52+ sqlite3_create_module_v2 as create_module_v2, sqlite3_db_readonly as db_readonly,
53+ sqlite3_declare_vtab as declare_vtab, sqlite3_errcode as errcode, sqlite3_errmsg as errmsg,
54+ sqlite3_error_offset as error_offset, sqlite3_exec as exec, sqlite3_finalize as finalize,
55+ sqlite3_free as free, sqlite3_get_autocommit as get_autocommit,
56+ sqlite3_get_auxdata as get_auxdata, sqlite3_libversion as libversion,
57+ sqlite3_libversion_number as libversion_number, sqlite3_malloc as malloc,
58+ sqlite3_malloc64 as malloc64, sqlite3_mutex_alloc as mutex_alloc,
5859 sqlite3_mutex_enter as mutex_enter, sqlite3_mutex_free as mutex_free,
5960 sqlite3_mutex_leave as mutex_leave, sqlite3_mutex_try as mutex_try,
6061 sqlite3_next_stmt as next_stmt, sqlite3_open as open, sqlite3_prepare_v2 as prepare_v2,
@@ -148,6 +149,16 @@ pub fn bind_blob(
148149 }
149150}
150151
152+ pub fn db_readonly ( connection : * mut sqlite3 , db : & CStr ) -> Option < bool > {
153+ let res = unsafe { invoke_sqlite ! ( db_readonly, connection, db. as_ptr( ) ) } ;
154+
155+ match res {
156+ 1 => Some ( true ) , // Readonly
157+ 0 => Some ( false ) , // Read/write
158+ _ => None , // Not the name of a database on the connection.
159+ }
160+ }
161+
151162pub fn changes64 ( db : * mut sqlite3 ) -> int64 {
152163 unsafe { invoke_sqlite ! ( changes64, db) }
153164}
0 commit comments