You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Binds the parameters contained in the `param_bindings`-variable to the query. Using this function stops any possible attempts at SQL data injection as the parameters are sanitized. More information regarding parameter bindings can be found [here](https://www.sqlite.org/c3ref/bind_blob.html).
117
117
@@ -121,7 +121,7 @@ Additionally, a video tutorial by [Mitch McCollum (finepointcgi)](https://github
121
121
var column_name : String = "name";
122
122
var query_string : String = "SELECT %s FROM company WHERE age < ?;" % [column_name]
123
123
var param_bindings : Array = [24]
124
-
var success = db.query_with_bindings(query_string, param_bindings)
124
+
var rc = db.query_with_bindings(query_string, param_bindings)
125
125
# Executes following query:
126
126
# SELECT name FROM company WHERE age < 24;
127
127
```
@@ -130,7 +130,7 @@ Additionally, a video tutorial by [Mitch McCollum (finepointcgi)](https://github
130
130
131
131
***NOTE**: Binding column names is not possible due to SQLite restrictions. If dynamic column names are required, insert the column name directly into the `query_string`-variable itself (see https://github.com/2shady4u/godot-sqlite/issues/41).*
Each key/value pair of the `table_dictionary`-variable defines a column of the table. Each key defines the name of a column in the database, while the value is a dictionary that contains further column specifications.
136
136
@@ -182,40 +182,40 @@ Additionally, a video tutorial by [Mitch McCollum (finepointcgi)](https://github
182
182
183
183
For more concrete usage examples see the `database.gd`-file as found in this repository's demo project.
Each key/value pair of the `row_dictionary`-variable defines the column values of a single row.
195
195
196
196
Columns should adhere to the table schema as instantiated using the `table_dictionary`-variable and are required if their corresponding **"not_null"**-column value is set to `True`.
Backup or restore the current database to/from a path, see [here](https://www.sqlite.org/backup.html). This feature is useful if you are using a database as your save file and you want to easily implement a saving/loading mechanic. Be warned that the original database will be overwritten entirely when restoring.
Copy file name to clipboardExpand all lines: doc_classes/SQLite.xml
+20-17Lines changed: 20 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -48,33 +48,33 @@
48
48
</tutorials>
49
49
<methods>
50
50
<methodname="open_db">
51
-
<returntype="bool" />
51
+
<returntype="ResultCode" />
52
52
<description>
53
53
Open a new database connection. Multiple concurrently open connections to the same database are possible.
54
54
</description>
55
55
</method>
56
56
<methodname="close_db">
57
-
<returntype="bool" />
57
+
<returntype="ResultCode" />
58
58
<description>
59
59
Close the current database connection.
60
60
</description>
61
61
</method>
62
62
<methodname="query">
63
-
<returntype="bool" />
63
+
<returntype="ResultCode" />
64
64
<description>
65
65
Query the database using the raw SQL statement defined in [code]query_string[/code].
66
66
</description>
67
67
</method>
68
68
<methodname="query_with_bindings">
69
-
<returntype="bool" />
69
+
<returntype="ResultCode" />
70
70
<description>
71
71
Binds the parameters contained in the [code]param_bindings[/code]-variable to the query. Using this function stops any possible attempts at SQL data injection as the parameters are sanitized. More information regarding parameter bindings can be found [url=https://www.sqlite.org/c3ref/bind_blob.html]here[/url].
72
72
[b]Example usage[/b]:
73
73
[codeblock]
74
74
var column_name : String = "name"
75
75
var query_string : String = "SELECT %s FROM company WHERE age < ?;" % [column_name]
76
76
var param_bindings : Array = [24]
77
-
var success = db.query_with_bindings(query_string, param_bindings)
77
+
var rc = db.query_with_bindings(query_string, param_bindings)
78
78
# Executes following query:
79
79
# SELECT name FROM company WHERE age < 24;
80
80
[/codeblock]
@@ -83,7 +83,7 @@
83
83
</description>
84
84
</method>
85
85
<methodname="create_table">
86
-
<returntype="bool" />
86
+
<returntype="ResultCode" />
87
87
<description>
88
88
Each key/value pair of the [code]table_dictionary[/code]-variable defines a column of the table. Each key defines the name of a column in the database, while the value is a dictionary that contains further column specifications.
89
89
[b]Required fields[/b]:
@@ -111,7 +111,7 @@
111
111
</description>
112
112
</method>
113
113
<methodname="drop_table">
114
-
<returntype="bool" />
114
+
<returntype="ResultCode" />
115
115
<description>
116
116
Drop the table with name [code]table_name[/code]. This method is equivalent to the following query:
117
117
[codeblock]
@@ -120,14 +120,14 @@
120
120
</description>
121
121
</method>
122
122
<methodname="insert_row">
123
-
<returntype="bool" />
123
+
<returntype="ResultCode" />
124
124
<description>
125
125
Each key/value pair of the [code]row_dictionary[/code]-variable defines the column values of a single row.
126
126
Columns should adhere to the table schema as instantiated using the [code]table_dictionary[/code]-variable and are required if their corresponding [b]"not_null"[/b]-column value is set to [code]True[/code].
127
127
</description>
128
128
</method>
129
129
<methodname="insert_rows">
130
-
<returntype="bool" />
130
+
<returntype="ResultCode" />
131
131
<description>
132
132
Insert multiple rows into the given table. The [code]row_array[/code] input argument should be an array of dictionaries where each element is defined as in [method insert_row].
133
133
</description>
@@ -139,31 +139,31 @@
139
139
</description>
140
140
</method>
141
141
<methodname="update_rows">
142
-
<returntype="bool" />
142
+
<returntype="ResultCode" />
143
143
<description>
144
144
With the [code]updated_row_dictionary[/code]-variable adhering to the same table schema & conditions as the [code]row_dictionary[/code]-variable defined previously.
145
145
</description>
146
146
</method>
147
147
<methodname="delete_rows">
148
-
<returntype="bool" />
148
+
<returntype="ResultCode" />
149
149
<description>
150
150
Delete all rows of the table that match the given conditions.
151
151
</description>
152
152
</method>
153
153
<methodname="import_from_json">
154
-
<returntype="bool" />
154
+
<returntype="ResultCode" />
155
155
<description>
156
156
Drops all database tables and imports the database structure and content present inside of [code]import_path.json[/code].
157
157
</description>
158
158
</method>
159
159
<methodname="export_to_json">
160
-
<returntype="bool" />
160
+
<returntype="ResultCode" />
161
161
<description>
162
162
Exports the database structure and content to [code]export_path.json[/code] as a backup or for ease of editing.
163
163
</description>
164
164
</method>
165
165
<methodname="import_from_buffer">
166
-
<returntype="bool" />
166
+
<returntype="ResultCode" />
167
167
<description>
168
168
Drops all database tables and imports the database structure and content encoded in JSON-formatted input buffer.
169
169
Can be used together with [method SQLite.export_to_buffer] to implement database encryption.
@@ -177,7 +177,7 @@
177
177
</description>
178
178
</method>
179
179
<methodname="create_function">
180
-
<returntype="bool" />
180
+
<returntype="ResultCode" />
181
181
<description>
182
182
Bind a [url=https://www.sqlite.org/appfunc.html]scalar SQL function[/url] to the database that can then be used in subsequent queries.
183
183
</description>
@@ -189,13 +189,13 @@
189
189
</description>
190
190
</method>
191
191
<methodname="backup_to">
192
-
<returntype="bool" />
192
+
<returntype="ResultCode" />
193
193
<description>
194
194
Backup the current database to a path, see [url=https://www.sqlite.org/backup.html]here[/url]. This feature is useful if you are using a database as your save file and you want to easily implement a saving mechanic.
195
195
</description>
196
196
</method>
197
197
<methodname="restore_from">
198
-
<returntype="bool" />
198
+
<returntype="ResultCode" />
199
199
<description>
200
200
Restore the current database from a path, see [url=https://www.sqlite.org/backup.html]here[/url]. This feature is useful if you are using a database as your save file and you want to easily implement a loading mechanic. Be warned that the original database will be overwritten entirely when restoring.
201
201
</description>
@@ -289,5 +289,8 @@
289
289
<constantname="VERY_VERBOSE"value="3">
290
290
Same as [constant VERBOSE].
291
291
</constant>
292
+
<constantname="RC_GDSQLITE_ERROR"value="10000">
293
+
Error that does not correspond to any of the result codes defined by SQLite.
0 commit comments