diff --git a/Phase2/Databases/Phase2DB/dialogdb b/Phase2/Databases/Phase2DB/dialogdb new file mode 100644 index 0000000..4102e0c Binary files /dev/null and b/Phase2/Databases/Phase2DB/dialogdb differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/DB.gd b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/DB.gd new file mode 100644 index 0000000..b085b53 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/DB.gd @@ -0,0 +1,12 @@ +extends Node2D + +const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") +var db +var db_name = "res://DataStore/database" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/LICENSE.md b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/LICENSE.md new file mode 100644 index 0000000..4bce6d2 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2023 Piet Bronders & Jeroen De Geeter + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so new file mode 100644 index 0000000..ee8cad4 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so new file mode 100644 index 0000000..9981487 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86/libgdsqlite.so new file mode 100644 index 0000000..2442b60 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so new file mode 100644 index 0000000..043484a Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdnlib b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdnlib new file mode 100644 index 0000000..6c9e227 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdnlib @@ -0,0 +1,34 @@ +[general] + +singleton=false +load_once=true +symbol_prefix="godot_" +reloadable=false + +[entry] + +Android.armeabi-v7a="res://addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so" +Android.arm64-v8a="res://addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so" +Android.x86="res://addons/godot-sqlite/bin/android/x86/libgdsqlite.so" +Android.x86_64="res://addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so" +HTML5.wasm32="res://addons/godot-sqlite/bin/javascript/libgdsqlite.wasm" +OSX.64="res://addons/godot-sqlite/bin/osx/libgdsqlite.dylib" +Windows.64="res://addons/godot-sqlite/bin/win64/libgdsqlite.dll" +X11.64="res://addons/godot-sqlite/bin/x11/libgdsqlite.so" +iOS.armv7="res://addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a" +iOS.arm64="res://addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a" +Server="res://addons/godot-sqlite/bin/x11/libgdsqlite.so" + +[dependencies] + +Android.armeabi-v7a=[ ] +Android.arm64-v8a=[ ] +Android.x86=[ ] +Android.x86_64=[ ] +HTML5.wasm32=[ ] +OSX.64=[ ] +Windows.64=[ ] +X11.64=[ ] +iOS.armv7=[ "res://addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a" ] +iOS.arm64=[ "res://addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a" ] +Server=[ ] diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdns b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdns new file mode 100644 index 0000000..2f01a53 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdns @@ -0,0 +1,8 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://addons/godot-sqlite/bin/gdsqlite.gdnlib" type="GDNativeLibrary" id=1] + +[resource] +resource_name = "gdsqlite" +class_name = "SQLite" +library = ExtResource( 1 ) \ No newline at end of file diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a new file mode 100644 index 0000000..6da71d5 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a new file mode 100644 index 0000000..9855c8e Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a new file mode 100644 index 0000000..ae326ef Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a new file mode 100644 index 0000000..a1aab9b Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm new file mode 100644 index 0000000..d5c3735 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/osx/libgdsqlite.dylib b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/osx/libgdsqlite.dylib new file mode 100644 index 0000000..8f39345 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/osx/libgdsqlite.dylib differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/win64/libgdsqlite.dll b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/win64/libgdsqlite.dll new file mode 100644 index 0000000..0a19e3b Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/win64/libgdsqlite.dll differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/x11/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/x11/libgdsqlite.so new file mode 100644 index 0000000..3012282 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/x11/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite-wrapper.gd b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite-wrapper.gd new file mode 100644 index 0000000..6aa739a --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite-wrapper.gd @@ -0,0 +1,221 @@ +class_name SQLiteWrapper +# This class aims to make documentation accessible in the Godot editor and +# is meant to be fully interchangeable with `gdsqlite.gdns`. +# More extensive documentation can be found here: +# https://github.com/2shady4u/godot-sqlite/blob/master/README.md + +var SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") +var db + +enum VerbosityLevel { + QUIET = 0, + NORMAL = 1, + VERBOSE = 2, + VERY_VERBOSE = 3 +} + +func _init(): + db = SQLite.new() + +# VARIABLES -------------------------------------------------------------------- + +# NAME: path +# DEFAULT: "" +# DESCRIPTION: +# Path to the database, should be set before opening the database with `open_db()`. +var path : String setget set_path, get_path +func set_path(value : String) -> void: + if db: db.path = value + +func get_path() -> String: + if db: return db.path + return "" + +# NAME: error_message +# DEFAULT: "" +# DESCRIPTION: +# Contains the zErrMsg returned by the SQLite query in human-readable form. +var error_message : String setget set_error_message, get_error_message +func set_error_message(message: String) -> void: + if db: db.error_message = message + +func get_error_message() -> String: + if db: return db.error_message + return "" + +# NAME: default_extension +# DEFAULT: "db" +# DESCRIPTION: +# Default extension that is automatically appended to the `path`-variable whenever +# **no** extension is detected or given. +var default_extension :String setget set_default_extension, get_default_extension +func set_default_extension(value : String) -> void: + if db: db.default_extension = value + +func get_default_extension() -> String: + if db: return db.default_extension + return "" + +# NAME: foreign_keys +# DEFAULT: false +# DESCRIPTION: +# Enables or disables the availability of foreign keys in the SQLite database. +var foreign_keys : bool setget set_foreign_keys, get_foreign_keys +func set_foreign_keys(value : bool) -> void: + if db: db.foreign_keys = value + +func get_foreign_keys() -> bool: + if db: return db.foreign_keys + return false + +# NAME: read_only +# DEFAULT: false +# DESCRIPTION: +# Enabling this property opens the database in read-only mode & allows databases +# to be packaged inside of the PCK. +var read_only : bool setget set_read_only, get_read_only +func set_read_only(value : bool) -> void: + if db: db.read_only = value + +func get_read_only() -> bool: + if db: return db.read_only + return false + +# NAME: query_result +# DEFAULT: [] +# DESCRIPTION: +# Contains the results from the latest query by value; meaning that this property +# is safe to use when looping successive queries as it does not get overwritten by any future queries. +var query_result : Array setget set_query_result, get_query_result +func set_query_result(value : Array) -> void: + if db: db.query_result = value + +func get_query_result() -> Array: + if db: return db.query_result + return [] + +# NAME: query_result_by_reference +# DEFAULT: [] +# DESCRIPTION: +# Contains the results from the latest query **by reference** and is, as a direct result, +# cleared and repopulated after every new query. +var query_result_by_reference : Array setget set_query_result_by_reference, get_query_result_by_reference +func set_query_result_by_reference(value : Array) -> void: + if db: db.query_result_by_reference = value + +func get_query_result_by_reference() -> Array: + if db: return db.query_result_by_reference + return [] + +# NAME: last_insert_rowid +# DEFAULT: -1 +# DESCRIPTION: +# Exposes both the `sqlite3_last_insert_rowid()`- and `sqlite3_set_last_insert_rowid()`-methods to Godot as described [here](https://www.sqlite.org/c3ref/last_insert_rowid.html) and [here](https://www.sqlite.org/c3ref/set_last_insert_rowid.html) respectively. +var last_insert_rowid : int setget set_last_insert_rowid, get_last_insert_rowid +func set_last_insert_rowid(value : int) -> void: + if db: db.last_insert_rowid = value + +func get_last_insert_rowid() -> int: + if !db: return db.last_insert_rowid + return -1 + +# NAME: verbosity_level +# DEFAULT: -1 +# DESCRIPTION: +# The verbosity_level determines the amount of logging to the Godot console that is handy for debugging your (possibly faulty) SQLite queries. +# Following levels are available: +# QUIET (0) : Don't print anything to the console +# NORMAL (1) : Print essential information to the console +# VERBOSE (2) : Print additional information to the console +# VERY_VERBOSE (3): Same as VERBOSE +# **NOTE:** VERBOSE and higher levels might considerably slow down your queries due to excessive logging. +var verbosity_level : int setget set_verbosity_level, get_verbosity_level +func set_verbosity_level(var value) -> void: + if db: db.verbosity_level = value + +func get_verbosity_level() -> int: + if db: return db.verbosity_level + return -1 + +# FUNCTIONS -------------------------------------------------------------------- + +# Open a connection to the database at the path set by the `path`-variable. +# **NOTE:** The `path`-variable has to be set beforehand! +func open_db() -> bool: + return db.open_db() + +# Close the connection to the database. +func close_db() -> void: + db.close_db() + +# Executes a query on the database connection. +# **NOTE:** Allowing the user to directly access this method makes you vulnerable to SQL injection attacks! +func query(query_string : String) -> bool: + return db.query(query_string) + +# Executes a query with bindings on the database connection. +# For example, calling `query_with_bindings("SELECT name from monsters WHERE health < ?", [24])` +# would select all monsters with health below 24. +func query_with_bindings(query_string : String, param_bindings : Array) -> bool: + return db.query_with_bindings(query_string, param_bindings) + +# Creates the table with the name "table_name" if it doesn't already exist. +# For more information regarding the composition of the `table_dictionary`-property see: +# https://github.com/2shady4u/godot-sqlite/blob/master/README.md#functions +func create_table(table_name: String, table_dictionary: Dictionary) -> bool: + return db.create_table(table_name, table_dictionary) + +# Drops (removes) the table with the name "table_name" from the database. +func drop_table(table_name: String) -> bool: + return db.drop_table(table_name) + +# Insert a new row into the table with the given properties. +# For example, calling `insert_row("monsters", {"name": "Wolf", "health": 20})` +# would add a new row to the "monsters" table with the given properties. +func insert_row(table_name: String, row_dictionary : Dictionary) -> bool: + return db.insert_row(table_name, row_dictionary) + +# Insert multiple rows into the table with the given properties. +# For example, calling `insert_rows("monsters", [{"name": "Wolf", "health": 20}, {"name": "Boar", "health": 12}])` +# would add 2 new rows to the "monsters" table with the given properties. +func insert_rows(table_name: String, row_array : Array) -> bool: + return db.insert_rows(table_name,row_array) + +# Select all rows from the table that match the given conditions and return the wanted columns. +# For example, calling `select_rows("monsters", "health < 24", ["name", "health"])` +# would select all monsters with health below 24 and return their names & health in an array of dictionaries. +func select_rows(table_name : String, query_conditions: String, selected_columns: Array) -> Array: + return db.select_rows(table_name,query_conditions,selected_columns) + +# Update all rows from the table that match the given conditions. +# For example, calling `update_rows("monsters", "name = 'Wolf'", {"health": 24})` +# would update/change the health of all monsters with the name "Wolf" to 24. +func update_rows(table_name : String, query_conditions: String, updated_row_dictionary: Dictionary) -> bool: + return db.update_rows(table_name, query_conditions, updated_row_dictionary) + +# Delete all the rows in the table that match the given conditions. +# For example, calling `delete_rows("monsters", "name = 'Wolf' AND health > 18")` +# would delete all the rows in the "monsters" table that match the following conditions: +# - A "name" column value equal to "Wolf" +# - A "health" column value that is greater than 18 +func delete_rows(table_name: String, query_conditions: String) -> bool: + return db.delete_rows(table_name, query_conditions) + +# Drops all database tables and imports the database structure and content present inside of `import_path.json`. +func import_from_json(import_path: String) -> bool: + return db.import_from_json(import_path) + +# Exports the database structure and content to `export_path.json` as a backup or for ease of editing. +func export_to_json(export_path : String) -> bool: + return db.export_to_json(export_path) + +# Bind a scalar SQL function to the database that can then be used in subsequent queries. +# Creating a function should only be seen as a measure of last resort and only be used when you perfectly know what you are doing. +func create_function(function_name: String, function_reference: FuncRef, number_of_arguments: int) -> bool: + return db.create_function(function_name, function_reference, number_of_arguments) + +# Get the current autocommit mode of the open database connection which can be used to check if +# there's any database transactions in progress, see here: +# http://www.sqlite.org/c3ref/get_autocommit.html +func get_autocommit() -> int: + return db.get_autocommit() diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite.gd b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite.gd new file mode 100644 index 0000000..dc5e8ff --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite.gd @@ -0,0 +1,14 @@ +# ############################################################################ # +# Copyright © 2019-2023 Piet Bronders & Jeroen De Geeter +# Licensed under the MIT License. +# See LICENSE in the project root for license information. +# ############################################################################ # + +tool +extends EditorPlugin + +func _enter_tree(): + pass + +func _exit_tree(): + pass diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/plugin.cfg b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/plugin.cfg new file mode 100644 index 0000000..b43dc35 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Godot SQLite" +description="GDNative wrapper for SQLite (Godot 3.2+), making it possible to use SQLite databases as data storage in all your future games." +author="Piet Bronders & Jeroen De Geeter" +version="3.5" +script="godot-sqlite.gd" diff --git a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/project.godot b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/project.godot index b9a380d..3e05ad0 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/project.godot +++ b/Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/project.godot @@ -8,6 +8,16 @@ config_version=4 +_global_script_classes=[ { +"base": "Reference", +"class": "SQLiteWrapper", +"language": "GDScript", +"path": "res://addons/godot-sqlite/godot-sqlite-wrapper.gd" +} ] +_global_script_class_icons={ +"SQLiteWrapper": "" +} + [application] config/name="NewTestBase" diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/TestDB.tscn b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/TestDB.tscn new file mode 100644 index 0000000..ff65928 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/TestDB.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://GenresSubstitution/genre_sub.gd" type="Script" id=1] + +[node name="Node2D" type="Node2D"] +script = ExtResource( 1 ) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/genre_sub.gd b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/genre_sub.gd new file mode 100644 index 0000000..40deb4d --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/genre_sub.gd @@ -0,0 +1,90 @@ +extends Node + + +# initialize the DB connection. +# All Databases will be under res/databases/{Desired Database} +const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") +var db +var db_name = "res://databases/genre_sub" + + + +# An item will contain the ID of the item in question, followed by the genre name, and the alias provided. +# Examples of how to use createItem +# createItem("Melee-Weapon") +# createCollection("Dessert Ration Item") +# createCollection("Single Rider Vehicle") + +func createItem(inputNameString): + db.open_db() + var tableName = "Item" + var dict : Dictionary = Dictionary() + dict["baseName"] = inputNameString + db.insert_row(tableName,dict) + print(dict) + + +# A collection will contain the ID of the item in question, followed by the genre name, and the alias provided. +# Examples of how to use createCollection +# createCollection(3, "SciFi", "Plasma Pistol") +# createCollection(3, "ModernDay", "9MM Handgun") +# createCollection(3, "Fantasy", "Shortbow") + +func createCollection(ItemID, collectionName, aliasName): + db.open_db() + var tableName = "Collection" + var dict : Dictionary = Dictionary() + dict["itemID"] = ItemID + dict["collectionName"] = collectionName + dict["itemAlias"] = aliasName + db.insert_row(tableName,dict) + print(dict) + + + +#Not to sure about this one. We may need to talk about a refactor here +func createGenreSubstitutionLayer(collectionID): + db.open_db() + var tableName = "Genre_Substitution_Layer" + var dict : Dictionary = Dictionary() + dict["collectionID"] = collectionID + db.insert_row(tableName,dict) + print(dict) + + +func getItemsByID(id): + db.open_db() + db.query("select Item.baseName as baseName, Collection.collectionName as genreName from Item left join Collection on Item.primaryKey = Collection.itemID where Item.primaryKey = " + str(id)) + for i in range(0, db.query_result.size()): + print("Query results ", db.query_result[i]["baseName"], db.query_result[i]["genreName"]) + return db.query_result + + +# TO DO: Modify this query to provide a list of all items, that use the refer to the same base item; using item.baseName as the query item + +#func getItemsByBaseName(feedName): +# db.open_db() +# db.query("select Item.baseName as baseName, Collection.collectionName as genreName from Item left join Collection on Item.primaryKey = Collection.itemID where Item.primaryKey = " + str(feedName)) +# for i in range(0, db.query_result.size()): +# print("Query results ", db.query_result[i]["baseName"], db.query_result[i]["genreName"]) +# return db.query_result + + +func readItem(): + db.open_db() + var tableName = "Item" + db.query("select * from " + tableName) + for i in range(0, db.query_result.size()): + print("Query results ", db.query_result[i]["baseName"], db.query_result[i]["primaryKey"]) + +# Called when the node enters the scene tree for the first time. +func _ready(): + db = SQLite.new() + db.path = db_name + getItemsByID(3) + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/LICENSE.md b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/LICENSE.md new file mode 100644 index 0000000..4bce6d2 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2023 Piet Bronders & Jeroen De Geeter + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so new file mode 100644 index 0000000..ee8cad4 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so new file mode 100644 index 0000000..9981487 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86/libgdsqlite.so new file mode 100644 index 0000000..2442b60 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so new file mode 100644 index 0000000..043484a Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdnlib b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdnlib new file mode 100644 index 0000000..6c9e227 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdnlib @@ -0,0 +1,34 @@ +[general] + +singleton=false +load_once=true +symbol_prefix="godot_" +reloadable=false + +[entry] + +Android.armeabi-v7a="res://addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so" +Android.arm64-v8a="res://addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so" +Android.x86="res://addons/godot-sqlite/bin/android/x86/libgdsqlite.so" +Android.x86_64="res://addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so" +HTML5.wasm32="res://addons/godot-sqlite/bin/javascript/libgdsqlite.wasm" +OSX.64="res://addons/godot-sqlite/bin/osx/libgdsqlite.dylib" +Windows.64="res://addons/godot-sqlite/bin/win64/libgdsqlite.dll" +X11.64="res://addons/godot-sqlite/bin/x11/libgdsqlite.so" +iOS.armv7="res://addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a" +iOS.arm64="res://addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a" +Server="res://addons/godot-sqlite/bin/x11/libgdsqlite.so" + +[dependencies] + +Android.armeabi-v7a=[ ] +Android.arm64-v8a=[ ] +Android.x86=[ ] +Android.x86_64=[ ] +HTML5.wasm32=[ ] +OSX.64=[ ] +Windows.64=[ ] +X11.64=[ ] +iOS.armv7=[ "res://addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a" ] +iOS.arm64=[ "res://addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a" ] +Server=[ ] diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdns b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdns new file mode 100644 index 0000000..2f01a53 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdns @@ -0,0 +1,8 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://addons/godot-sqlite/bin/gdsqlite.gdnlib" type="GDNativeLibrary" id=1] + +[resource] +resource_name = "gdsqlite" +class_name = "SQLite" +library = ExtResource( 1 ) \ No newline at end of file diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a new file mode 100644 index 0000000..6da71d5 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a new file mode 100644 index 0000000..9855c8e Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a new file mode 100644 index 0000000..ae326ef Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a new file mode 100644 index 0000000..a1aab9b Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm new file mode 100644 index 0000000..d5c3735 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/osx/libgdsqlite.dylib b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/osx/libgdsqlite.dylib new file mode 100644 index 0000000..8f39345 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/osx/libgdsqlite.dylib differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/win64/libgdsqlite.dll b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/win64/libgdsqlite.dll new file mode 100644 index 0000000..0a19e3b Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/win64/libgdsqlite.dll differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/x11/libgdsqlite.so b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/x11/libgdsqlite.so new file mode 100644 index 0000000..3012282 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/x11/libgdsqlite.so differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite-wrapper.gd b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite-wrapper.gd new file mode 100644 index 0000000..6aa739a --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite-wrapper.gd @@ -0,0 +1,221 @@ +class_name SQLiteWrapper +# This class aims to make documentation accessible in the Godot editor and +# is meant to be fully interchangeable with `gdsqlite.gdns`. +# More extensive documentation can be found here: +# https://github.com/2shady4u/godot-sqlite/blob/master/README.md + +var SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") +var db + +enum VerbosityLevel { + QUIET = 0, + NORMAL = 1, + VERBOSE = 2, + VERY_VERBOSE = 3 +} + +func _init(): + db = SQLite.new() + +# VARIABLES -------------------------------------------------------------------- + +# NAME: path +# DEFAULT: "" +# DESCRIPTION: +# Path to the database, should be set before opening the database with `open_db()`. +var path : String setget set_path, get_path +func set_path(value : String) -> void: + if db: db.path = value + +func get_path() -> String: + if db: return db.path + return "" + +# NAME: error_message +# DEFAULT: "" +# DESCRIPTION: +# Contains the zErrMsg returned by the SQLite query in human-readable form. +var error_message : String setget set_error_message, get_error_message +func set_error_message(message: String) -> void: + if db: db.error_message = message + +func get_error_message() -> String: + if db: return db.error_message + return "" + +# NAME: default_extension +# DEFAULT: "db" +# DESCRIPTION: +# Default extension that is automatically appended to the `path`-variable whenever +# **no** extension is detected or given. +var default_extension :String setget set_default_extension, get_default_extension +func set_default_extension(value : String) -> void: + if db: db.default_extension = value + +func get_default_extension() -> String: + if db: return db.default_extension + return "" + +# NAME: foreign_keys +# DEFAULT: false +# DESCRIPTION: +# Enables or disables the availability of foreign keys in the SQLite database. +var foreign_keys : bool setget set_foreign_keys, get_foreign_keys +func set_foreign_keys(value : bool) -> void: + if db: db.foreign_keys = value + +func get_foreign_keys() -> bool: + if db: return db.foreign_keys + return false + +# NAME: read_only +# DEFAULT: false +# DESCRIPTION: +# Enabling this property opens the database in read-only mode & allows databases +# to be packaged inside of the PCK. +var read_only : bool setget set_read_only, get_read_only +func set_read_only(value : bool) -> void: + if db: db.read_only = value + +func get_read_only() -> bool: + if db: return db.read_only + return false + +# NAME: query_result +# DEFAULT: [] +# DESCRIPTION: +# Contains the results from the latest query by value; meaning that this property +# is safe to use when looping successive queries as it does not get overwritten by any future queries. +var query_result : Array setget set_query_result, get_query_result +func set_query_result(value : Array) -> void: + if db: db.query_result = value + +func get_query_result() -> Array: + if db: return db.query_result + return [] + +# NAME: query_result_by_reference +# DEFAULT: [] +# DESCRIPTION: +# Contains the results from the latest query **by reference** and is, as a direct result, +# cleared and repopulated after every new query. +var query_result_by_reference : Array setget set_query_result_by_reference, get_query_result_by_reference +func set_query_result_by_reference(value : Array) -> void: + if db: db.query_result_by_reference = value + +func get_query_result_by_reference() -> Array: + if db: return db.query_result_by_reference + return [] + +# NAME: last_insert_rowid +# DEFAULT: -1 +# DESCRIPTION: +# Exposes both the `sqlite3_last_insert_rowid()`- and `sqlite3_set_last_insert_rowid()`-methods to Godot as described [here](https://www.sqlite.org/c3ref/last_insert_rowid.html) and [here](https://www.sqlite.org/c3ref/set_last_insert_rowid.html) respectively. +var last_insert_rowid : int setget set_last_insert_rowid, get_last_insert_rowid +func set_last_insert_rowid(value : int) -> void: + if db: db.last_insert_rowid = value + +func get_last_insert_rowid() -> int: + if !db: return db.last_insert_rowid + return -1 + +# NAME: verbosity_level +# DEFAULT: -1 +# DESCRIPTION: +# The verbosity_level determines the amount of logging to the Godot console that is handy for debugging your (possibly faulty) SQLite queries. +# Following levels are available: +# QUIET (0) : Don't print anything to the console +# NORMAL (1) : Print essential information to the console +# VERBOSE (2) : Print additional information to the console +# VERY_VERBOSE (3): Same as VERBOSE +# **NOTE:** VERBOSE and higher levels might considerably slow down your queries due to excessive logging. +var verbosity_level : int setget set_verbosity_level, get_verbosity_level +func set_verbosity_level(var value) -> void: + if db: db.verbosity_level = value + +func get_verbosity_level() -> int: + if db: return db.verbosity_level + return -1 + +# FUNCTIONS -------------------------------------------------------------------- + +# Open a connection to the database at the path set by the `path`-variable. +# **NOTE:** The `path`-variable has to be set beforehand! +func open_db() -> bool: + return db.open_db() + +# Close the connection to the database. +func close_db() -> void: + db.close_db() + +# Executes a query on the database connection. +# **NOTE:** Allowing the user to directly access this method makes you vulnerable to SQL injection attacks! +func query(query_string : String) -> bool: + return db.query(query_string) + +# Executes a query with bindings on the database connection. +# For example, calling `query_with_bindings("SELECT name from monsters WHERE health < ?", [24])` +# would select all monsters with health below 24. +func query_with_bindings(query_string : String, param_bindings : Array) -> bool: + return db.query_with_bindings(query_string, param_bindings) + +# Creates the table with the name "table_name" if it doesn't already exist. +# For more information regarding the composition of the `table_dictionary`-property see: +# https://github.com/2shady4u/godot-sqlite/blob/master/README.md#functions +func create_table(table_name: String, table_dictionary: Dictionary) -> bool: + return db.create_table(table_name, table_dictionary) + +# Drops (removes) the table with the name "table_name" from the database. +func drop_table(table_name: String) -> bool: + return db.drop_table(table_name) + +# Insert a new row into the table with the given properties. +# For example, calling `insert_row("monsters", {"name": "Wolf", "health": 20})` +# would add a new row to the "monsters" table with the given properties. +func insert_row(table_name: String, row_dictionary : Dictionary) -> bool: + return db.insert_row(table_name, row_dictionary) + +# Insert multiple rows into the table with the given properties. +# For example, calling `insert_rows("monsters", [{"name": "Wolf", "health": 20}, {"name": "Boar", "health": 12}])` +# would add 2 new rows to the "monsters" table with the given properties. +func insert_rows(table_name: String, row_array : Array) -> bool: + return db.insert_rows(table_name,row_array) + +# Select all rows from the table that match the given conditions and return the wanted columns. +# For example, calling `select_rows("monsters", "health < 24", ["name", "health"])` +# would select all monsters with health below 24 and return their names & health in an array of dictionaries. +func select_rows(table_name : String, query_conditions: String, selected_columns: Array) -> Array: + return db.select_rows(table_name,query_conditions,selected_columns) + +# Update all rows from the table that match the given conditions. +# For example, calling `update_rows("monsters", "name = 'Wolf'", {"health": 24})` +# would update/change the health of all monsters with the name "Wolf" to 24. +func update_rows(table_name : String, query_conditions: String, updated_row_dictionary: Dictionary) -> bool: + return db.update_rows(table_name, query_conditions, updated_row_dictionary) + +# Delete all the rows in the table that match the given conditions. +# For example, calling `delete_rows("monsters", "name = 'Wolf' AND health > 18")` +# would delete all the rows in the "monsters" table that match the following conditions: +# - A "name" column value equal to "Wolf" +# - A "health" column value that is greater than 18 +func delete_rows(table_name: String, query_conditions: String) -> bool: + return db.delete_rows(table_name, query_conditions) + +# Drops all database tables and imports the database structure and content present inside of `import_path.json`. +func import_from_json(import_path: String) -> bool: + return db.import_from_json(import_path) + +# Exports the database structure and content to `export_path.json` as a backup or for ease of editing. +func export_to_json(export_path : String) -> bool: + return db.export_to_json(export_path) + +# Bind a scalar SQL function to the database that can then be used in subsequent queries. +# Creating a function should only be seen as a measure of last resort and only be used when you perfectly know what you are doing. +func create_function(function_name: String, function_reference: FuncRef, number_of_arguments: int) -> bool: + return db.create_function(function_name, function_reference, number_of_arguments) + +# Get the current autocommit mode of the open database connection which can be used to check if +# there's any database transactions in progress, see here: +# http://www.sqlite.org/c3ref/get_autocommit.html +func get_autocommit() -> int: + return db.get_autocommit() diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite.gd b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite.gd new file mode 100644 index 0000000..dc5e8ff --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite.gd @@ -0,0 +1,14 @@ +# ############################################################################ # +# Copyright © 2019-2023 Piet Bronders & Jeroen De Geeter +# Licensed under the MIT License. +# See LICENSE in the project root for license information. +# ############################################################################ # + +tool +extends EditorPlugin + +func _enter_tree(): + pass + +func _exit_tree(): + pass diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/plugin.cfg b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/plugin.cfg new file mode 100644 index 0000000..b43dc35 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Godot SQLite" +description="GDNative wrapper for SQLite (Godot 3.2+), making it possible to use SQLite databases as data storage in all your future games." +author="Piet Bronders & Jeroen De Geeter" +version="3.5" +script="godot-sqlite.gd" diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/dialog_database.sqbpro b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/dialog_database.sqbpro new file mode 100644 index 0000000..8ce197a --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/dialog_database.sqbpro @@ -0,0 +1 @@ + diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/genre_sub.db b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/genre_sub.db new file mode 100644 index 0000000..21dba53 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/genre_sub.db differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/project.godot b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/project.godot index 6a4a804..5d0fe94 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/project.godot +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/project.godot @@ -8,6 +8,16 @@ config_version=4 +_global_script_classes=[ { +"base": "Reference", +"class": "SQLiteWrapper", +"language": "GDScript", +"path": "res://addons/godot-sqlite/godot-sqlite-wrapper.gd" +} ] +_global_script_class_icons={ +"SQLiteWrapper": "" +} + [application] config/name="Toolset_Initial_Work"