@@ -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
807807Dictionary 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
10401043void 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
0 commit comments