|
|
| version 1.26, 2001/05/21 16:55:52 | version 1.31, 2001/07/27 12:59:36 |
|---|---|
| Line 7 | Line 7 |
| $Id$ | $Id$ |
| */ | */ |
| static const char *RCSId="$Id$"; | |
| #include "classes.h" | #include "classes.h" |
| #include "pa_request.h" | #include "pa_request.h" |
| Line 75 static void _mod(Request& r, const Strin | Line 76 static void _mod(Request& r, const Strin |
| // from string.C | // from string.C |
| extern | extern |
| String& sql_result_string(Request& r, const String& method_name, MethodParams *params); | const String* sql_result_string(Request& r, const String& method_name, |
| MethodParams *params); | |
| static void _sql(Request& r, const String& method_name, MethodParams *params) { | static void _sql(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| int val=sql_result_string(r, method_name, params).as_int(); | int val; |
| if(const String *string=sql_result_string(r, method_name, params)) | |
| val=string->as_int(); | |
| else | |
| if(params->size()>1) | |
| val=params->as_int(1, r); | |
| else { | |
| PTHROW(0, 0, | |
| &method_name, | |
| "produced no result, but no default specified"); | |
| val=0; //calm, compiler | |
| } | |
| VInt& result=*new(pool) VInt(pool, val); | VInt& result=*new(pool) VInt(pool, val); |
| result.set_name(method_name); | result.set_name(method_name); |
| r.write_assign_lang(result); | r.write_assign_lang(result); |
| Line 117 MInt::MInt(Pool& apool) : Methoded(apool | Line 129 MInt::MInt(Pool& apool) : Methoded(apool |
| add_native_method("format", Method::CT_DYNAMIC, _string_format, 1, 1); | add_native_method("format", Method::CT_DYNAMIC, _string_format, 1, 1); |
| // ^int:sql[query] | // ^int:sql[query] |
| // ^int:sql[query](offset) | // ^int:sql[query](default) |
| add_native_method("sql", Method::CT_STATIC, _sql, 1, 2); | add_native_method("sql", Method::CT_STATIC, _sql, 1, 2); |
| } | } |
| // global variable | // global variable |