Skip to content
Snippets Groups Projects
Commit c22eb211 authored by Martin Nilsson's avatar Martin Nilsson
Browse files

Try harder to figure out correct _sprintf information.

Rev: lib/modules/Sql.pmod/sql_result.pike:1.15
parent 67582ff2
No related branches found
No related tags found
No related merge requests found
/* /*
* $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 * Implements the generic result module of the SQL-interface
* *
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
//! The actual result. //! The actual result.
mixed master_res; 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; int index;
//! Create a new Sql.sql_result object //! Create a new Sql.sql_result object
...@@ -25,9 +26,13 @@ static void create(mixed res); ...@@ -25,9 +26,13 @@ static void create(mixed res);
static string _sprintf(int type, mapping|void flags) static string _sprintf(int type, mapping|void flags)
{ {
int f; int f = num_fields();
return type=='O' && master_res && sprintf("%O(/* row %d/%d, %d field%s */)", int r = num_rows();
this_program, index, 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":""); f=num_fields(), f>1?"s":"");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment