Skip to content

Commit 3efb496

Browse files
committed
Formating
1 parent 4b89ce1 commit 3efb496

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

SCsub

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55
# DO NOT FORGET TO REPLACE THE SLASH FOR BACKSLASH ON PATHS => "\" FOR "/"
66

77
# Enter with path to Boost library here
8-
boost_path = "C:/boost_1_76_0"
8+
# boost_path = "C:/boost_1_76_0"
9+
boost_path = "/media/cleber/686A6A516A6A1BD6/boost_1_76_0"
10+
911

1012
# Enter with the path to jdbc here (mysql_connection.h & mysql_driver.h)
11-
include_path = "C:/mysql/mysql-connector-c++-8.0.29-winx64/include/jdbc"
13+
# include_path = "C:/mysql/mysql-connector-c++-8.0.29-winx64/include/jdbc"
14+
include_path = "/media/cleber/686A6A516A6A1BD6/mysql/mysql-connector-c++-8.0.29-winx64/include/jdbc"
1215

13-
# Enter with the path to mysql libs here (mysqlcppconn.lib)
14-
lib_path = 'C:/mysql/mysql-connector-c++-8.0.29-winx64/lib64/vs14/debug'
1516

17+
# Enter with the path to mysql libs here (mysqlcppconn.lib)
18+
# lib_path = 'C:/mysql/mysql-connector-c++-8.0.29-winx64/lib64/vs14/debug'
19+
lib_path = "/media/cleber/686A6A516A6A1BD6/mysql/mysql-connector-c++-8.0.29-winx64/lib64/vs14/debug"
1620

1721
# Enable the module debug.
1822
module_debug = True
@@ -77,7 +81,8 @@ if env["platform"] in ["windows", "UWP"]:
7781
sufix = sufix[0:-3]
7882

7983
mysql_env.Append(CPPFLAGS =["-I" + include_path, "-L " + lib_path])
80-
target_lib_arr = [target_lib] # TODO: More libs are expected for static compilling (ssl, crypto e etc...)
84+
# TODO: More libs are expected for static compilling (ssl, crypto e etc...)
85+
target_lib_arr = [target_lib]
8186

8287
# copy libs
8388
for i in target_lib_arr:

mysql.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Array MySQL::_query(String p_sqlquery, Array p_values, DataFormat data_model, bo
310310

311311
else{
312312
// This module can't recognize this format.
313-
ERR_FAIL_V_EDMSG( Array(), "Format not supoeted!");
313+
ERR_FAIL_V_EDMSG( Array(), "Format not supported!");
314314
}
315315
// FITTING DATA -------- END
316316

@@ -326,7 +326,7 @@ Array MySQL::_query(String p_sqlquery, Array p_values, DataFormat data_model, bo
326326

327327
} // WHILE
328328

329-
} // try
329+
} // TRY
330330

331331
catch (sql::SQLException &e) {
332332
print_SQLException(e);
@@ -698,7 +698,7 @@ Variant MySQL::get_property(String p_property){
698698

699699
ERR_FAIL_COND_V_EDMSG( prop_type == INVALID, ret, "The property '" + p_property.to_upper() + "' does not exist!");
700700

701-
// Colocar no doc
701+
// TODO: Put it on docs
702702
// "Non-existent property. \nFor more information visit: \nhttps://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-connect-options.html"
703703
map <sql::SQLString, sql::Variant>::iterator _prop;
704704
_prop = connection_properties.find( property );
@@ -805,8 +805,10 @@ MySQL::ConnectionStatus MySQL::connection_status() {
805805

806806

807807
Dictionary MySQL::get_connection_metadata(){
808-
ERR_FAIL_COND_V_MSG(connection_status() != CONNECTED, Dictionary(), "DatabaseMetaData FAILURE - database is not connected! - METHOD: get_connection_metadata");
808+
809809
Dictionary ret;
810+
ERR_FAIL_COND_V_MSG(connection_status() != CONNECTED, ret, "DatabaseMetaData FAILURE - database is not connected! - METHOD: get_connection_metadata");
811+
810812
sql::DatabaseMetaData *dbcon_meta = conn->getMetaData();
811813
std::unique_ptr < sql::ResultSet > res(dbcon_meta->getSchemas());
812814
ret["Total number of schemas"] = res->rowsCount();
@@ -831,6 +833,7 @@ Dictionary MySQL::get_connection_metadata(){
831833
ret["Maximum Columns per Table"] = dbcon_meta->getMaxColumnsInTable();
832834
ret["Maximum Columns per Index"] = dbcon_meta->getMaxColumnsInIndex();
833835
ret["Maximum Row Size per Table"] = dbcon_meta->getMaxRowSize();
836+
834837
return ret;
835838
}
836839

@@ -1039,6 +1042,7 @@ void MySQL::_fit_statement(std::shared_ptr<sql::PreparedStatement> prep_stmt, st
10391042

10401043
void MySQL::print_SQLException(sql::SQLException &e) {
10411044
/*
1045+
// NOTE:
10421046
If (e.getErrorCode() == 1047) = Your server does not seem to support Prepared Statements at all. Perhaps MYSQL < 4.1?.
10431047
Error: 1047 SQLSTATE: 08S01 (ER_UNKNOWN_COM_ERROR)
10441048
Message: Unknown command
@@ -1058,9 +1062,10 @@ void MySQL::print_SQLException(sql::SQLException &e) {
10581062
_last_sql_error["MySQL error code"] = errCode;
10591063
_last_sql_error["SQLState"] = _error;
10601064

1061-
//FIXME: ERR_FAIL_ just print
1065+
// FIXME: ERR_FAIL_just print
10621066
// ERR_PRINT(sqlError) ?
10631067

1068+
10641069
#ifdef TOOLS_ENABLED
10651070
print_line("# EXCEPTION Caught ˇ");
10661071
print_line("# ERR: SQLException in: "+String(file)+" in function: "+String(func)+"() on line "+String(line));
@@ -1092,19 +1097,22 @@ void MySQL::_bind_methods() {
10921097
ClassDB::bind_method(D_METHOD("get_connection_metadata"),&MySQL::get_connection_metadata);
10931098
ClassDB::bind_method(D_METHOD("get_last_error"),&MySQL::get_last_error);
10941099

1100+
10951101
/* PROPERTIES */
10961102
ClassDB::bind_method(D_METHOD("get_property", "property"),&MySQL::get_property);
10971103
ClassDB::bind_method(D_METHOD("set_property", "property", "value"),&MySQL::set_property);
10981104
ClassDB::bind_method(D_METHOD("set_properties_array", "properties"),&MySQL::set_properties_array);
10991105
ClassDB::bind_method(D_METHOD("get_properties_array", "properties"),&MySQL::get_properties_array);
11001106

1107+
11011108
/* DATABASE */
1102-
ClassDB::bind_method(D_METHOD("query", "Sql Statement", "DataFormat", "Return data as String", "Metadata"),&MySQL::query, DEFVAL(DICTIONARY), DEFVAL(false), DEFVAL(PoolIntArray()) );
1103-
ClassDB::bind_method(D_METHOD("query_prepared", "sql_statement", "Values", "DataFormat", "return_string", "meta"), &MySQL::query_prepared, DEFVAL(Array()), DEFVAL(MySQL::DataFormat::DICTIONARY), DEFVAL(false), DEFVAL(PoolIntArray()));
11041109
ClassDB::bind_method(D_METHOD("execute", "sql_statement"),&MySQL::execute);
11051110
ClassDB::bind_method(D_METHOD("execute_prepared", "sql_statement", "Values"),&MySQL::execute_prepared);
11061111
ClassDB::bind_method(D_METHOD("update", "sql_statement"),&MySQL::update);
11071112
ClassDB::bind_method(D_METHOD("update_prepared", "sql_statement", "Values"),&MySQL::update_prepared);
1113+
ClassDB::bind_method(D_METHOD("query", "Sql Statement", "DataFormat", "Return data as String", "Metadata"),&MySQL::query, DEFVAL(DICTIONARY), DEFVAL(false), DEFVAL(PoolIntArray()) );
1114+
ClassDB::bind_method(D_METHOD("query_prepared", "sql_statement", "Values", "DataFormat", "return_string", "meta"), &MySQL::query_prepared, DEFVAL(Array()), DEFVAL(MySQL::DataFormat::DICTIONARY), DEFVAL(false), DEFVAL(PoolIntArray()));
1115+
11081116

11091117
/* CONNECTOR */
11101118
ClassDB::bind_method(D_METHOD("set_database", "database"),&MySQL::set_database);
@@ -1115,11 +1123,13 @@ void MySQL::_bind_methods() {
11151123
ClassDB::bind_method(D_METHOD("get_catalog"),&MySQL::get_catalog);
11161124
ClassDB::bind_method(D_METHOD("get_client_info"),&MySQL::get_client_info);
11171125

1126+
11181127
/* CONN OPTIONS */
11191128
ClassDB::bind_method(D_METHOD("get_driver_info"),&MySQL::get_driver_info);
11201129
ClassDB::bind_method(D_METHOD("set_client_option", "option", "value"),&MySQL::set_client_option);
11211130
ClassDB::bind_method(D_METHOD("get_client_option", "option"),&MySQL::get_client_option);
11221131

1132+
11231133
/* TRANSACTION */
11241134
ClassDB::bind_method(D_METHOD("set_autocommit", "bool"),&MySQL::set_autocommit);
11251135
ClassDB::bind_method(D_METHOD("get_autocommit"),&MySQL::get_autocommit);
@@ -1132,6 +1142,7 @@ void MySQL::_bind_methods() {
11321142
ClassDB::bind_method(D_METHOD("get_savepoints"),&MySQL::get_savepoints);
11331143

11341144

1145+
/* ENUMS */
11351146
BIND_ENUM_CONSTANT(TRANSACTION_ERROR);
11361147
BIND_ENUM_CONSTANT(TRANSACTION_NONE);
11371148
BIND_ENUM_CONSTANT(TRANSACTION_READ_COMMITTED);
@@ -1153,6 +1164,7 @@ void MySQL::_bind_methods() {
11531164
BIND_ENUM_CONSTANT(ARRAY);
11541165
BIND_ENUM_CONSTANT(DICTIONARY);
11551166

1167+
11561168
}
11571169

11581170

mysql.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class MySQL : public Reference{
7373
};
7474

7575

76-
7776
private:
7877

7978
enum OP {
@@ -128,14 +127,14 @@ class MySQL : public Reference{
128127
int get_prop_type( String p_prop );
129128
int get_time_format( String time );
130129
void _fit_statement( std::shared_ptr<sql::PreparedStatement> prep_stmt, std::stringstream *blob, Variant arg, int index );
131-
PoolStringArray prop_string = String("hostName, userName, password, schema, pipe, pluginDir, postInit, preInit, readDefaultFile, readDefaultGroup, rsaKey, socket, sslCA, sslCAPath, sslCert, sslCipher, sslCRL, sslCRLPath, sslKey, characterSetResults, charsetDir, defaultAuth, defaultPreparedStatementResultType, defaultStatementResultType, OPT_TLS_VERSION, OPT_CHARSET_NAME").rsplit(", ");
132-
PoolStringArray prop_bool = String("OPT_RECONNECT, CLIENT_COMPRESS, CLIENT_FOUND_ROWS, CLIENT_IGNORE_SIGPIPE, CLIENT_IGNORE_SPACE, CLIENT_INTERACTIVE, CLIENT_LOCAL_FILES, CLIENT_MULTI_STATEMENTS, CLIENT_NO_SCHEMA, OPT_REPORT_DATA_TRUNCATION, OPT_CAN_HANDLE_EXPIRED_PASSWORDS, OPT_ENABLE_CLEARTEXT_PLUGIN, OPT_GET_SERVER_PUBLIC_KEY, sslEnforce, sslVerify, useLegacyAuth").rsplit(", ");
130+
133131
PoolStringArray prop_int = String("port, OPT_CONNECT_TIMEOUT, OPT_LOCAL_INFILE, OPT_WRITE_TIMEOUT, OPT_READ_TIMEOUT").rsplit(", ");
134132
PoolStringArray prop_map = String("OPT_CONNECT_ATTR_ADD").rsplit(", ");
135133
PoolStringArray prop_list = String("OPT_CONNECT_ATTR_DELETE").rsplit(", ");
136134
PoolStringArray prop_void = String("OPT_CONNECT_ATTR_RESET, OPT_NAMED_PIPE").rsplit(", ");
137-
138-
135+
PoolStringArray prop_string = String("hostName, userName, password, schema, pipe, pluginDir, postInit, preInit, readDefaultFile, readDefaultGroup, rsaKey, socket, sslCA, sslCAPath, sslCert, sslCipher, sslCRL, sslCRLPath, sslKey, characterSetResults, charsetDir, defaultAuth, defaultPreparedStatementResultType, defaultStatementResultType, OPT_TLS_VERSION, OPT_CHARSET_NAME").rsplit(", ");
136+
PoolStringArray prop_bool = String("OPT_RECONNECT, CLIENT_COMPRESS, CLIENT_FOUND_ROWS, CLIENT_IGNORE_SIGPIPE, CLIENT_IGNORE_SPACE, CLIENT_INTERACTIVE, CLIENT_LOCAL_FILES, CLIENT_MULTI_STATEMENTS, CLIENT_NO_SCHEMA, OPT_REPORT_DATA_TRUNCATION, OPT_CAN_HANDLE_EXPIRED_PASSWORDS, OPT_ENABLE_CLEARTEXT_PLUGIN, OPT_GET_SERVER_PUBLIC_KEY, sslEnforce, sslVerify, useLegacyAuth").rsplit(", ");
137+
139138

140139
protected:
141140

0 commit comments

Comments
 (0)