Platforms to show: All Mac Windows Linux Cross-Platform

Back to SQLDatabaseMBS class.

Previous items

SQLDatabaseMBS.SQLiteThreadsafe as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SQL MBS SQL Plugin 19.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Test To See If The Library Is Threadsafe.

The threadsafe() function returns zero if and only if SQLite was compiled mutexing code omitted due to the SQLITE_THREADSAFE compile-time option being set to 0.

SQLite can be compiled with or without mutexes. When the SQLITE_THREADSAFE C preprocessor macro is 1 or 2, mutexes are enabled and SQLite is threadsafe. When the SQLITE_THREADSAFE macro is 0, the mutexes are omitted. Without the mutexes, it is not safe to use SQLite concurrently from more than one thread.

Enabling mutexes incurs a measurable performance penalty. So if speed is of utmost importance, it makes sense to disable the mutexes. But for maximum safety, mutexes should be enabled. The default behavior is for mutexes to be enabled.

This interface can be used by an application to make sure that the version of SQLite that it is linking against was compiled with the desired setting of the SQLITE_THREADSAFE macro.

This interface only reports on the compile-time mutex setting of the SQLITE_THREADSAFE flag. If SQLite is compiled with SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but can be fully or partially disabled using a call to sqlite3_config() with the verbs SQLITE_CONFIG_SINGLETHREAD, SQLITE_CONFIG_MULTITHREAD, or SQLITE_CONFIG_MUTEX. ^(The return value of the sqlite3_threadsafe() function shows only the compile-time setting of thread safety, not any run-time changes to that setting made by sqlite3_config(). In other words, the return value from sqlite3_threadsafe() is unchanged by calls to sqlite3_config().)^

See the threading mode documentation for additional information.

SQLDatabaseMBS.SQLSelect(SelectString as string, CommandType as Integer) as RecordSet

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SQL MBS SQL Plugin 13.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Runs the SQLSelect threaded.

Same as SQLSelect, but with additional CommandType parameter.

For this method to work, you need to have somewhere a property with SQLDatabaseMBS so Xojo includes our SQLDatabase plugin which provides the RecordSet functionality.

If Scrollable property is true, the recordset will be requested to be scrollable.

The record set may not have a valid RecordCount or have working movefirst/movelast/moveprev methods unless the underlaying database supports those and Scrollable result sets is enabled/supported.

SQLDatabaseMBS.SQLSelectMT(SelectString as string, CommandType as Integer = 0) as RecordSet

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SQL MBS SQL Plugin 12.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Runs the SQLSelect threaded.

Same as SQLSelect, but if you run this on a thread, the plugin gives time to other threads so the rest of your application runs just fine.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

If Scrollable property is true, the recordset will be requested to be scrollable.

The record set may not have a valid RecordCount or have working movefirst/movelast/moveprev methods unless the underlaying database supports those and Scrollable result sets is enabled/supported.

SQLDatabaseMBS.UpdateRecord(TableName as String, Record as Dictionary, Keys as Dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SQL MBS SQL Plugin 18.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Convenience function to update a record.
Example
dim db as SQLDatabaseMBS // your database connection

Var d as new Dictionary

d.Value("text")="new text"
d.Value("other")="second value"

db.UpdateRecord("test_tbl", d, new dictionary("ID":2))

if db.Error then
MsgBox db.ErrorMessage
end if

The plugin builds for you SQL statement with prepared statement and runs the update command with given values for records with given key values.

You can put multiple field names in the keys dictionary.

Lasterror is set or exception raised as with SQLExecute.
Internally this uses a prepared statement. You can check the generated statement via LastStatement property.

Previous items

The items on this page are in the following plugins: MBS SQL Plugin.


The biggest plugin in space...