diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-23 10:45:06 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-23 10:45:06 +0000 |
commit | 9309ce59d33605c15ad54c1a120e87fa191f7de3 (patch) | |
tree | 685a84dabef8a3703f758e350c50e80bd2bcc1ae /src | |
parent | cd5f64daf7a6a9af42ec823e76a7b7a82855527c (diff) |
More stuff to return empty lists and maps when there are no more rows in the dataset
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4524 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index a2d30917a..9679f9cef 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -207,6 +207,7 @@ class MySQLresult : public SQLresult std::vector<SQLfieldList> fieldlists; SQLfieldMap* fieldmap; SQLfieldMap fieldmap2; + SQLfieldList emptyfieldlist; int rows; int cols; public: @@ -321,12 +322,15 @@ class MySQLresult : public SQLresult virtual SQLfieldList& GetRow() { - return fieldlists[currentrow]; + if (currentrow < rows) + return fieldlists[currentrow]; + else + return emptyfieldlist; } virtual SQLfieldMap& GetRowMap() { - fieldmap2 = SQLfieldMap(); + fieldmap2.clear(); if (currentrow < rows) { @@ -342,7 +346,10 @@ class MySQLresult : public SQLresult virtual SQLfieldList* GetRowPtr() { - return &fieldlists[currentrow++]; + if (currentrow < rows) + return &fieldlists[currentrow++]; + else + return &emptyfieldlist; } virtual SQLfieldMap* GetRowMapPtr() |