From c22eb211b0b64fd4f2dcd13e75edff8e991a702e Mon Sep 17 00:00:00 2001 From: Martin Nilsson <mani@lysator.liu.se> Date: Tue, 12 Apr 2005 02:39:19 +0200 Subject: [PATCH] Try harder to figure out correct _sprintf information. Rev: lib/modules/Sql.pmod/sql_result.pike:1.15 --- lib/modules/Sql.pmod/sql_result.pike | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/modules/Sql.pmod/sql_result.pike b/lib/modules/Sql.pmod/sql_result.pike index 651ab1a31b..b34bb1ef76 100644 --- a/lib/modules/Sql.pmod/sql_result.pike +++ b/lib/modules/Sql.pmod/sql_result.pike @@ -1,5 +1,5 @@ /* - * $Id: sql_result.pike,v 1.14 2005/04/10 03:50:27 nilsson Exp $ + * $Id: sql_result.pike,v 1.15 2005/04/12 00:39:19 nilsson Exp $ * * Implements the generic result module of the SQL-interface * @@ -14,7 +14,8 @@ //! The actual result. mixed master_res; -//! This is the number of the current row. (0 <= @[index] < @[num_rows()]) +//! This is the number of the current row. The actual semantics +//! differs between different databases. int index; //! Create a new Sql.sql_result object @@ -25,10 +26,14 @@ static void create(mixed res); static string _sprintf(int type, mapping|void flags) { - int f; - return type=='O' && master_res && sprintf("%O(/* row %d/%d, %d field%s */)", - this_program, index, num_rows(), - f=num_fields(), f>1?"s":""); + int f = num_fields(); + int r = num_rows(); + int e = eof(); + return type=='O' && master_res && + sprintf("%O(/* row %d/%s, %d field%s */)", + this_program, index, + (index==r && !e)?"?":(string)num_rows(), + f=num_fields(), f>1?"s":""); } //! Returns the number of rows in the result. -- GitLab