From 196b1b09d32130c1806108904ded406844fd90e0 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 23 Jul 2006 15:49:56 +0000 Subject: [PATCH] Tidyup and bugfix, not copying the correct column names git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4532 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_mysql.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index c08adfd1d..035d0b498 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -209,7 +209,6 @@ class MySQLresult : public SQLresult SQLfieldMap fieldmap2; SQLfieldList emptyfieldlist; int rows; - int cols; public: MySQLresult(Module* self, Module* to, MYSQL_RES* res, int affected_rows, unsigned int id) : SQLresult(self, to, id), currentrow(0), fieldmap(NULL) @@ -334,9 +333,9 @@ class MySQLresult : public SQLresult if (currentrow < rows) { - for (int i = 0; i < cols; i++) + for (int i = 0; i < Cols(); i++) { - fieldmap2.insert(std::make_pair(colnames[cols],GetValue(currentrow, i))); + fieldmap2.insert(std::make_pair(colnames[i],GetValue(currentrow, i))); } currentrow++; } @@ -354,6 +353,7 @@ class MySQLresult : public SQLresult { fieldlist->push_back(fieldlists[currentrow][i]); } + currentrow++; } return fieldlist; } @@ -364,9 +364,9 @@ class MySQLresult : public SQLresult if (currentrow < rows) { - for (int i = 0; i < cols; i++) + for (int i = 0; i < Cols(); i++) { - fieldmap->insert(std::make_pair(colnames[cols],GetValue(currentrow, i))); + fieldmap->insert(std::make_pair(colnames[i],GetValue(currentrow, i))); } currentrow++; } @@ -381,11 +381,6 @@ class MySQLresult : public SQLresult virtual void Free(SQLfieldList* fl) { - /* XXX: Yes, this is SUPPOSED to do nothing, we - * dont want to free our fieldlist until we - * destruct the object. Unlike the pgsql module, - * we only have the one. - */ delete fl; } }; -- 2.39.5