Skip to content

Commit 513ac86

Browse files
committed
Add docs.
1 parent 40e7aaf commit 513ac86

File tree

8 files changed

+811
-9
lines changed

8 files changed

+811
-9
lines changed

capabilities.md

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Encrypted connections (TLS). For both, TCP and UNIX socket connections.
77
* Authentication methods: mysql_native_password and caching_sha2_password.
88

9-
109
### **Methods:**
1110

1211
* Supports asynchronous methods using C++20 coroutines.
@@ -15,7 +14,6 @@
1514
* Text querie: MySQL refers to this as the "text protocol", as all information is passed using text (as opposed to prepared statements).
1615
* Prepared statements: MySQL refers to this as the "binary protocol", as the result of executing a prepared statement is sent in binary format rather than in text.
1716

18-
1917
### **EQUIVALENT DATA TYPES:**
2018

2119
| DATA TYPE | GODOT DATA TYPE | C++ DATA TYPE | MYSQL DATA TYPE |

compilation.md

+7
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,10 @@ You can use the command belloww to update the module the submodules at once.
5353
```
5454
git pull --recurse-submodules
5555
```
56+
57+
58+
### **Note:**
59+
60+
At the moment it is only possible to compile this module for Linux and Windows. Support for MacOS is still being developed.
61+
It is perfectly possible to compile the module for other platforms such as Android and OSX, however this support has not yet been added.
62+
Any help adding support for these platforms would be appreciated.

config.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ def get_doc_path():
1515

1616
def get_doc_classes():
1717
return [
18-
"MySQL",
18+
"MySQL",
1919
"SqlResult",
20-
"SqlConnection",
2120
]
2221

2322

doc_classes/MySQL.xml

+720
Large diffs are not rendered by default.

doc_classes/SqlResult.xml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="SqlResult" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
3+
<brief_description>
4+
Query result.
5+
</brief_description>
6+
<description>
7+
This class holds the query's results
8+
</description>
9+
<tutorials>
10+
</tutorials>
11+
<methods>
12+
<method name="get_affected_rows" qualifiers="const">
13+
<return type="int" />
14+
<description>
15+
Returns the number of rows affected by the query that generated this SqlResult.
16+
</description>
17+
</method>
18+
<method name="get_array" qualifiers="const">
19+
<return type="Array" />
20+
<description>
21+
Retrieves the query result with an Array of Arrays. The values of each row will be contained in an Array.
22+
</description>
23+
</method>
24+
<method name="get_column" qualifiers="const">
25+
<return type="Array" />
26+
<param index="0" name="column" type="String" />
27+
<param index="1" name="as_array" type="bool" default="true" />
28+
<description>
29+
Retrieves a specific column by searching for the column name.
30+
[param column]: Name of the column.
31+
[param as_array]: If true, will return the values in an Dictionary. The keys will be the number of the each line.
32+
</description>
33+
</method>
34+
<method name="get_column_by_id" qualifiers="const">
35+
<return type="Array" />
36+
<param index="0" name="column" type="String" />
37+
<param index="1" name="as_array" type="bool" />
38+
<description>
39+
Retrieves a specific column by searching column's ID.
40+
[param column]: ID of the column.
41+
[param as_array]: If true, will return the values in an Dictionary. The keys will be the number of the each line.
42+
</description>
43+
</method>
44+
<method name="get_dictionary" qualifiers="const">
45+
<return type="Dictionary" />
46+
<description>
47+
Retrieves the query result with an Array of Dictionaries. The values of each row will be contained in an Dictionary.
48+
</description>
49+
</method>
50+
<method name="get_last_insert_id" qualifiers="const">
51+
<return type="int" />
52+
<description>
53+
Retrieves the last insert id by the query.
54+
</description>
55+
</method>
56+
<method name="get_metadata" qualifiers="const">
57+
<return type="Dictionary" />
58+
<description>
59+
Retrieves the query's metadata .
60+
</description>
61+
</method>
62+
<method name="get_row" qualifiers="const">
63+
<return type="Variant" />
64+
<param index="0" name="row" type="int" />
65+
<param index="1" name="as_array" type="bool" default="false" />
66+
<description>
67+
Retrieves a specific row by searching the row's ID.
68+
[param row]: ID of the column.
69+
[param as_array]:If true, it returns each elemnt of the row as a simple value, otherwise it will return each element as a Dictionary, with the key being the name of the column.
70+
</description>
71+
</method>
72+
<method name="get_warning_count" qualifiers="const">
73+
<return type="int" />
74+
<description>
75+
Retrieves the number of warnings generated.
76+
</description>
77+
</method>
78+
</methods>
79+
</class>

scr/mysql.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class MySQL : public RefCounted {
145145

146146
// Execute sql scripts.
147147
// This function perform multi-queries, because this the "multi_queries" option must be true in the connection credentials,
148-
// otherwise this function won'tbe executed.
148+
// otherwise this function won't be executed.
149149
// Be extremely careful with this function.
150150
Array execute_sql(const String p_path_to_file);
151151

scr/sql_result.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ void SqlResult::_bind_methods() {
6767
/* ===== QUERY ===== */
6868
ClassDB::bind_method(D_METHOD("get_array"), &SqlResult::get_array);
6969
ClassDB::bind_method(D_METHOD("get_dictionary"), &SqlResult::get_dictionary);
70-
ClassDB::bind_method(D_METHOD("get_row", "row", "as_array"), &SqlResult::get_row, DEFVAL(false));
70+
ClassDB::bind_method(D_METHOD("get_row", "row", "as_array"), &SqlResult::get_row, DEFVAL(true));
7171
ClassDB::bind_method(D_METHOD("get_column", "column", "as_array"), &SqlResult::get_column, DEFVAL(true));
72-
ClassDB::bind_method(D_METHOD("get_column_by_id", "column", "as_array"), &SqlResult::get_column);
72+
ClassDB::bind_method(D_METHOD("get_column_by_id", "column", "as_array"), &SqlResult::get_column, DEFVAL(true));
7373

7474
/* ===== META ===== */
7575
ClassDB::bind_method(D_METHOD("get_metadata"), &SqlResult::get_metadata);

scr/sql_result.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ friend class MySQL;
3939
Array get_column(String column, bool as_array = true) const;
4040

4141
// Retrieves a specific column by searching for the column number.
42-
Array get_column_by_id(int column, bool as_string = false) const;
42+
Array get_column_by_id(int column, bool as_array = true) const;
4343

44-
// Returns metadata from a specific column.
4544
Dictionary get_metadata() const {return meta;};
4645

4746
// Retrieves the query content as an dictionary.

0 commit comments

Comments
 (0)