MCPcopy Create free account
hub / github.com/MariaDB/server / ExecSQLcmd

Method ExecSQLcmd

storage/connect/myconn.cpp:1041–1072  ·  view source on GitHub ↗

/ Exec the Select SQL command and return ncol or afrws (TDBMYEXC). */ /

Source from the content-addressed store, hash-verified

1039/* Exec the Select SQL command and return ncol or afrws (TDBMYEXC). */
1040/***********************************************************************/
1041int MYSQLC::ExecSQLcmd(PGLOBAL g, const char *query, int *w)
1042 {
1043 int rc = RC_OK;
1044
1045 if (!m_DB) {
1046 strcpy(g->Message, "MySQL not connected");
1047 return RC_FX;
1048 } else
1049 *w = 0;
1050
1051 if (!stricmp(query, "Warning") || !stricmp(query, "Note")
1052 || !stricmp(query, "Error"))
1053 return RC_INFO;
1054 else
1055 m_Afrw = 0;
1056
1057//if (mysql_query(m_DB, query) != 0) {
1058 if (mysql_real_query(m_DB, query, strlen(query))) {
1059 m_Afrw = (int)mysql_errno(m_DB);
1060 snprintf(g->Message, sizeof(g->Message), "Remote: %s", mysql_error(m_DB));
1061 rc = RC_FX;
1062//} else if (!(m_Fields = mysql_field_count(m_DB))) {
1063 } else if (!(m_Fields = (int)m_DB->field_count)) {
1064// m_Afrw = (int)mysql_affected_rows(m_DB);
1065 m_Afrw = (int)m_DB->affected_rows;
1066 rc = RC_NF;
1067 } // endif's
1068
1069//*w = mysql_warning_count(m_DB);
1070 *w = m_DB->warning_count;
1071 return rc;
1072 } // end of ExecSQLcmd
1073
1074/***********************************************************************/
1075/* Close the connection. */

Callers 2

SendCommandMethod · 0.80
ReadDBMethod · 0.80

Calls 3

mysql_real_queryFunction · 0.85
mysql_errnoFunction · 0.85
mysql_errorFunction · 0.85

Tested by

no test coverage detected