mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Created Databases for testing to be apart of the genre sub layer. Also I had to leave a few mins early, because computer crashed
This commit is contained in:
Phase2
Databases
Phase2DB
Godot_Toolset
CodeSandboxes
LukeToolset_3_19_2023
DB.gdproject.godot
addons
godot-sqlite
LICENSE.md
bin
godot-sqlite-wrapper.gdgodot-sqlite.gdplugin.cfgToolsetProjectTemplate
GenresSubstitution
addons
godot-sqlite
LICENSE.md
bin
godot-sqlite-wrapper.gdgodot-sqlite.gdplugin.cfgdatabases
project.godot@ -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.
|
||||
|
||||
|
21
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/LICENSE.md
Normal file
21
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/LICENSE.md
Normal file
@ -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.
|
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86/libgdsqlite.so
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so
Normal file
Binary file not shown.
34
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdnlib
Normal file
34
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdnlib
Normal file
@ -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=[ ]
|
8
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdns
Normal file
8
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/gdsqlite.gdns
Normal file
@ -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 )
|
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/osx/libgdsqlite.dylib
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/osx/libgdsqlite.dylib
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/win64/libgdsqlite.dll
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/win64/libgdsqlite.dll
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/x11/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/bin/x11/libgdsqlite.so
Normal file
Binary file not shown.
221
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite-wrapper.gd
Normal file
221
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite-wrapper.gd
Normal file
@ -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()
|
14
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite.gd
Normal file
14
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/godot-sqlite.gd
Normal file
@ -0,0 +1,14 @@
|
||||
# ############################################################################ #
|
||||
# Copyright © 2019-2023 Piet Bronders & Jeroen De Geeter <piet.bronders@gmail.com>
|
||||
# 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
|
7
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/plugin.cfg
Normal file
7
Phase2/Godot_Toolset/CodeSandboxes/LukeToolset_3_19_2023/addons/godot-sqlite/plugin.cfg
Normal file
@ -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"
|
@ -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"
|
||||
|
6
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/TestDB.tscn
Normal file
6
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/TestDB.tscn
Normal file
@ -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 )
|
90
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/genre_sub.gd
Normal file
90
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/GenresSubstitution/genre_sub.gd
Normal file
@ -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
|
21
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/LICENSE.md
Normal file
21
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/LICENSE.md
Normal file
@ -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.
|
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86/libgdsqlite.so
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/android/x86_64/libgdsqlite.so
Normal file
Binary file not shown.
34
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdnlib
Normal file
34
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdnlib
Normal file
@ -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=[ ]
|
8
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdns
Normal file
8
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/gdsqlite.gdns
Normal file
@ -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 )
|
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/arm64/libgodot-cpp.ios.release.arm64.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/ios/armv7/libgodot-cpp.ios.release.armv7.a
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/osx/libgdsqlite.dylib
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/osx/libgdsqlite.dylib
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/win64/libgdsqlite.dll
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/win64/libgdsqlite.dll
Normal file
Binary file not shown.
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/x11/libgdsqlite.so
Normal file
BIN
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/bin/x11/libgdsqlite.so
Normal file
Binary file not shown.
221
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite-wrapper.gd
Normal file
221
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite-wrapper.gd
Normal file
@ -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()
|
14
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite.gd
Normal file
14
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/godot-sqlite.gd
Normal file
@ -0,0 +1,14 @@
|
||||
# ############################################################################ #
|
||||
# Copyright © 2019-2023 Piet Bronders & Jeroen De Geeter <piet.bronders@gmail.com>
|
||||
# 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
|
7
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/plugin.cfg
Normal file
7
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/addons/godot-sqlite/plugin.cfg
Normal file
@ -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"
|
1
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/dialog_database.sqbpro
Normal file
1
Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/dialog_database.sqbpro
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="/home/luke/Documents/ProgrammingProjects/UpdatedRPGR/bcirpg/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/databases/genre_sub.db" readonly="0" foreign_keys="" case_sensitive_like="" temp_store="" wal_autocheckpoint="" synchronous=""/><attached/><window><main_tabs open="structure browser pragmas query" current="0"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="1609"/><column_width id="4" width="0"/></tab_structure><tab_browse><current_table name="0,0:"/><default_encoding codec=""/><browse_table_settings/></tab_browse><tab_sql><sql name="SQL 1"></sql><current_tab id="0"/></tab_sql></sqlb_project>
|
Binary file not shown.
@ -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"
|
||||
|
Reference in New Issue
Block a user