|
|
| version 1.20, 2002/08/01 11:26:44 | version 1.24, 2002/08/20 09:37:31 |
|---|---|
| Line 5 | Line 5 |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| static const char* IDENT_VOID_C="$Id$"; | static const char* IDENT_VOID_C="$Date$"; |
| #include "classes.h" | #include "classes.h" |
| #include "pa_request.h" | #include "pa_request.h" |
| Line 25 public: // Methoded | Line 25 public: // Methoded |
| // methods | // methods |
| static void _length(Request& r, const String&, MethodParams *params) { | |
| Pool& pool=r.pool(); | |
| // always zero | |
| r.write_no_lang(*new(pool) VInt(pool, 0)); | |
| } | |
| static void _pos(Request& r, const String& method_name, MethodParams *params) { | |
| Pool& pool=r.pool(); | |
| Value& substr=params->as_no_junction(0, "substr must not be code"); | |
| // never found | |
| r.write_assign_lang(*new(pool) VInt(pool, -1)); | |
| } | |
| static void _int(Request& r, const String&, MethodParams *params) { | static void _int(Request& r, const String&, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| VVoid *vvoid=static_cast<VVoid *>(r.self); | VVoid *vvoid=static_cast<VVoid *>(r.self); |
| Line 70 static void _sql(Request& r, const Strin | Line 84 static void _sql(Request& r, const Strin |
| const char *statement_cstr= | const char *statement_cstr= |
| statement_string.cstr(String::UL_UNSPECIFIED, r.connection(&method_name)); | statement_string.cstr(String::UL_UNSPECIFIED, r.connection(&method_name)); |
| Void_sql_event_handlers handlers(pool, statement_string); | Void_sql_event_handlers handlers(pool, statement_string); |
| try { | r.connection(&method_name)->query( |
| r.connection(&method_name)->query( | statement_cstr, 0, 0, |
| statement_cstr, 0, 0, | handlers, |
| handlers); | statement_string); |
| } catch(const Exception& e) { | |
| // more specific source [were url] | |
| throw Exception("sql.execute", | |
| &statement_string, | |
| "%s", e.comment()); | |
| } | |
| } | } |
| // constructor | // constructor |
| MVoid::MVoid(Pool& apool) : Methoded(apool, "void") { | MVoid::MVoid(Pool& apool) : Methoded(apool, "void") { |
| // ^void.length[] | |
| add_native_method("length", Method::CT_DYNAMIC, _length, 0, 0); | |
| // ^void.pos[substr] | |
| add_native_method("pos", Method::CT_DYNAMIC, _pos, 1, 1); | |
| // ^void.int[] | // ^void.int[] |
| // ^void.int(default) | // ^void.int(default) |
| add_native_method("int", Method::CT_DYNAMIC, _int, 0, 1); | add_native_method("int", Method::CT_DYNAMIC, _int, 0, 1); |