From 9309ce59d33605c15ad54c1a120e87fa191f7de3 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 23 Jul 2006 10:45:06 +0000 Subject: 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 --- src/modules/extra/m_mysql.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/modules/extra') 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 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() -- cgit v1.2.3