diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 8 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 6 | ||||
-rw-r--r-- | src/modules/extra/m_sqlv2.h | 13 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 38c3b4c93..daf59a5d9 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -272,13 +272,7 @@ class MySQLresult : public SQLresult virtual int Rows() { - /* An INSERT can return 0 columns, but N rows. This is unsafe to - * allow the user to 'see'. Go figure. I hate you, MySQL devs. - */ - if (colnames.size()) - return rows; - else - return 0; + return rows; } virtual int Cols() diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index add188c8c..4ce24822d 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -86,7 +86,7 @@ class QueryInfo case FIND_SOURCE: // "SELECT id,actor FROM ircd_log_actors WHERE actor='"+nick+"'" // If we find it, advance to FIND_NICK state, otherwise go to INSERT_SOURCE - if (res->Rows()) + if (res->Cols()) { if (sourceid == -1) { @@ -136,7 +136,7 @@ class QueryInfo case FIND_NICK: // "SELECT id,actor FROM ircd_log_actors WHERE actor='"+nick+"'" // If we find it, advance to FIND_HOST state, otherwise go to INSERT_NICK - if (res->Rows()) + if (res->Cols()) { if (nickid == -1) { @@ -183,7 +183,7 @@ class QueryInfo case FIND_HOST: // "SELECT id,hostname FROM ircd_log_hosts WHERE hostname='"+host+"'" // If we find it, advance to INSERT_LOGENTRY state, otherwise go to INSERT_HOST - if (res->Rows()) + if (res->Cols()) { if (hostid == -1) { diff --git a/src/modules/extra/m_sqlv2.h b/src/modules/extra/m_sqlv2.h index 336fc8903..3272efec5 100644 --- a/src/modules/extra/m_sqlv2.h +++ b/src/modules/extra/m_sqlv2.h @@ -315,16 +315,19 @@ public: * Return the number of rows in the result * Note that if you have perfomed an INSERT * or UPDATE query or other query which will - * not return rows, this value will NOT be - * the number of affected rows, as this would - * then indicate there are rows in the set, - * which there are not. + * not return rows, this will return the + * number of affected rows, and SQLresult::Cols() + * will contain 0. In this case you SHOULD NEVER + * access any of the result set rows, as there arent any! * @returns Number of rows in the result set. */ virtual int Rows() = 0; /** - * Return the number of columns in the result + * Return the number of columns in the result. + * If you performed an UPDATE or INSERT which + * does not return a dataset, this value will + * be 0. * @returns Number of columns in the result set. */ virtual int Cols() = 0; |