From c88d011f77538911a8929a8b51923b4ec52732c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sat, 2 Apr 2016 12:47:54 +0200
Subject: [PATCH] Sql.sql_array_result: Fixed multiple issues.

Some of the functions in Sql.sql_result assemed that they were
in Sql.sql_object_result. This broke eg next_result().
---
 lib/modules/Sql.pmod/sql_array_result.pike  |  5 +++++
 lib/modules/Sql.pmod/sql_object_result.pike | 11 +++++++++++
 lib/modules/Sql.pmod/sql_result.pike        | 17 +++++++----------
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/lib/modules/Sql.pmod/sql_array_result.pike b/lib/modules/Sql.pmod/sql_array_result.pike
index d83a7669d1..c597eead90 100644
--- a/lib/modules/Sql.pmod/sql_array_result.pike
+++ b/lib/modules/Sql.pmod/sql_array_result.pike
@@ -49,3 +49,8 @@ int|array(string|int) fetch_row() {
   index++;
   return res;
 }
+
+this_program next_result()
+{
+  return 0;
+}
diff --git a/lib/modules/Sql.pmod/sql_object_result.pike b/lib/modules/Sql.pmod/sql_object_result.pike
index 9cd83c7dbd..f27f6d5c0b 100644
--- a/lib/modules/Sql.pmod/sql_object_result.pike
+++ b/lib/modules/Sql.pmod/sql_object_result.pike
@@ -15,6 +15,11 @@ int num_rows() {
   return master_res->num_rows();
 }
 
+int num_fields()
+{
+  return master_res->num_fields();
+}
+
 int eof() {
   return master_res->eof();
 }
@@ -38,3 +43,9 @@ int|array(string|int) fetch_row() {
   index++;
   return master_res->fetch_row();
 }
+
+this_program next_result()
+{
+  if (master_res->next_result) return master_res->next_result();
+  return 0;
+}
diff --git a/lib/modules/Sql.pmod/sql_result.pike b/lib/modules/Sql.pmod/sql_result.pike
index aacd24b624..6cde8c26a3 100644
--- a/lib/modules/Sql.pmod/sql_result.pike
+++ b/lib/modules/Sql.pmod/sql_result.pike
@@ -6,8 +6,12 @@
 
 #pike __REAL_VERSION__
 
-//! Implements the generic result of the SQL-interface.
+//! Implements the generic result base class of the SQL-interface.
 //! Used for return results from SQL.sql->big_query().
+//!
+//! You typically don't get a direct clone of this class,
+//! but of a class that inherits it, like @[sql_array_result]
+//! or @[sql_object_result].
 
 //! The actual result.
 mixed master_res;
@@ -38,10 +42,7 @@ protected string _sprintf(int type, mapping|void flags)
 int num_rows();
 
 //! Returns the number of fields in the result.
-int num_fields()
-{
-  return master_res->num_fields();
-}
+int num_fields();
 
 //! Returns non-zero if there are no more rows.
 int eof();
@@ -83,11 +84,7 @@ int|array(string|int|float) fetch_row();
 //!
 //! @throws
 //!   May throw the same errors as @[Sql.Sql()->big_query()] et al.
-this_program next_result()
-{
-  if (master_res->next_result) return master_res->next_result();
-  return 0;
-}
+this_program next_result();
 
 // --- Iterator API
 
-- 
GitLab