--- parser3/src/classes/string.C 2002/10/09 11:49:14 1.121 +++ parser3/src/classes/string.C 2002/12/09 12:19:16 1.124 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_STRING_C="$Date: 2002/10/09 11:49:14 $"; +static const char* IDENT_STRING_C="$Date: 2002/12/09 12:19:16 $"; #include "classes.h" #include "pa_request.h" @@ -366,7 +366,7 @@ static void _lower(Request& r, const Str class String_sql_event_handlers : public SQL_Driver_query_event_handlers { public: String_sql_event_handlers(Pool& apool, - const String& astatement_string, const char *astatement_cstr) : + const String& astatement_string, const char *astatement_cstr): pool(apool), statement_string(astatement_string), statement_cstr(astatement_cstr), @@ -374,23 +374,34 @@ public: result=new(pool) String(pool); } - void add_column(void *ptr, size_t size) { - if(got_column) - throw Exception("parser.runtime", + bool add_column(SQL_Error& error, void *ptr, size_t size) { + if(got_column) { + error=SQL_Error("parser.runtime", &statement_string, "result must contain exactly one column"); + return true; + } got_column=true; + return false; } - void before_rows() { /* ignore */ } - void add_row() { /* ignore */ } - void add_row_cell(void *ptr, size_t size) { - if(got_cell) - throw Exception("parser.runtime", + bool before_rows(SQL_Error& /*error*/ ) { /* ignore */ return false; } + bool add_row(SQL_Error& /*error*/) { /* ignore */ return false; } + bool add_row_cell(SQL_Error& error, void *ptr, size_t size) { + if(got_cell) { + error=SQL_Error("parser.runtime", &statement_string, "result must not contain more then one row"); - got_cell=true; + return true; + } - result->APPEND_TAINTED((const char *)ptr, size, statement_cstr, 0); + try { + got_cell=true; + result->APPEND_TAINTED((const char *)ptr, size, statement_cstr, 0); + return false; + } catch(...) { + error=SQL_Error("exception occured in String_sql_event_handlers::add_row_cell"); + return true; + } } private: @@ -502,7 +513,7 @@ static void _save(Request& r, const Stri } // write - const char *buf=src.cstr(String::UL_UNSPECIFIED); + const char *buf=src.cstr(String::UL_UNSPECIFIED, r.connection(0/*no error if none*/)); file_write(r.absolute(file_name), buf, strlen(buf), true, do_append); }