|
|
| version 1.71, 2001/05/07 13:29:47 | version 1.72, 2001/05/08 06:00:34 |
|---|---|
| Line 19 | Line 19 |
| #include "pa_vint.h" | #include "pa_vint.h" |
| #include "pa_sql_connection.h" | #include "pa_sql_connection.h" |
| #include "pa_dir.h" | #include "pa_dir.h" |
| #include "pa_vbool.h" | |
| // defines | // defines |
| Line 328 static void _sort(Request& r, const Stri | Line 329 static void _sort(Request& r, const Stri |
| } | } |
| static void _locate(Request& r, const String& method_name, MethodParams *params) { | static void _locate(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | |
| VTable& vtable=*static_cast<VTable *>(r.self); | VTable& vtable=*static_cast<VTable *>(r.self); |
| Table& table=vtable.table(); | Table& table=vtable.table(); |
| vtable.last_locate_was_successful=table.locate( | Value& result=*new(pool) VBool(pool, table.locate( |
| params->get(0).as_string(), | params->get(0).as_string(), |
| params->get(1).as_string()); | params->get(1).as_string())); |
| } | result.set_name(method_name); |
| r.write_no_lang(result); | |
| static void _found(Request& r, const String& method_name, MethodParams *params) { | |
| if(static_cast<VTable *>(r.self)->last_locate_was_successful) | |
| r.write_pass_lang(r.process(params->get_junction(0, "found-parameter must be code"))); | |
| else if(params->size()==2) | |
| r.write_pass_lang(r.process(params->get_junction(0, "else-parameter must be code"))); | |
| } | } |
| static void _flip(Request& r, const String& method_name, MethodParams *params) { | static void _flip(Request& r, const String& method_name, MethodParams *params) { |
| Line 605 MTable::MTable(Pool& apool) : Methoded(a | Line 603 MTable::MTable(Pool& apool) : Methoded(a |
| // ^table.locate[field;value] | // ^table.locate[field;value] |
| add_native_method("locate", Method::CT_DYNAMIC, _locate, 2, 2); | add_native_method("locate", Method::CT_DYNAMIC, _locate, 2, 2); |
| // ^table.found{when-found} | |
| // ^table.found{when-found}{when-not-found} | |
| add_native_method("found", Method::CT_DYNAMIC, _found, 1, 2); | |
| // ^table.flip[] | // ^table.flip[] |
| add_native_method("flip", Method::CT_DYNAMIC, _flip, 0, 0); | add_native_method("flip", Method::CT_DYNAMIC, _flip, 0, 0); |