diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-23 10:30:33 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-23 10:30:33 +0000 |
commit | cd5f64daf7a6a9af42ec823e76a7b7a82855527c (patch) | |
tree | f580bcaa77983df81a92b69b43df25f6e0765603 /src/modules | |
parent | e09d69dc5399f5207da9512f2d2750ff4df394be (diff) |
Adjust m_mysql to match the assumed behaviour of m_pgsql exactly, e.g. when there are now rows left return an empty row
Fix mistake which required a reference to be freed (?!)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4523 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index daf59a5d9..a2d30917a 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -206,6 +206,7 @@ class MySQLresult : public SQLresult std::vector<std::string> colnames; std::vector<SQLfieldList> fieldlists; SQLfieldMap* fieldmap; + SQLfieldMap fieldmap2; int rows; int cols; public: @@ -325,15 +326,18 @@ class MySQLresult : public SQLresult virtual SQLfieldMap& GetRowMap() { - fieldmap = new SQLfieldMap(); - - for (int i = 0; i < cols; i++) + fieldmap2 = SQLfieldMap(); + + if (currentrow < rows) { - fieldmap->insert(std::make_pair(colnames[cols],GetValue(currentrow, i))); + for (int i = 0; i < cols; i++) + { + fieldmap2.insert(std::make_pair(colnames[cols],GetValue(currentrow, i))); + } + currentrow++; } - currentrow++; - return *fieldmap; + return fieldmap2; } virtual SQLfieldList* GetRowPtr() @@ -344,12 +348,15 @@ class MySQLresult : public SQLresult virtual SQLfieldMap* GetRowMapPtr() { fieldmap = new SQLfieldMap(); - - for (int i = 0; i < cols; i++) + + if (currentrow < rows) { - fieldmap->insert(std::make_pair(colnames[cols],GetValue(currentrow, i))); + for (int i = 0; i < cols; i++) + { + fieldmap->insert(std::make_pair(colnames[cols],GetValue(currentrow, i))); + } + currentrow++; } - currentrow++; return fieldmap; } |