|
|
| version 1.95, 2001/07/25 10:43:14 | version 1.97, 2001/07/28 12:07:26 |
|---|---|
| Line 376 static void table_row_to_hash(Array::Ite | Line 376 static void table_row_to_hash(Array::Ite |
| } | } |
| } | } |
| static void _hash(Request& r, const String& method_name, MethodParams *params) { | static void _hash(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | |
| Table& table=static_cast<VTable *>(r.self)->table(); | Table& table=static_cast<VTable *>(r.self)->table(); |
| Value& result=*new(pool) VHash(pool); | |
| if(const Array *columns=table.columns()) | if(const Array *columns=table.columns()) |
| if(columns->size()>1) { | if(columns->size()>1) { |
| Pool& pool=r.pool(); | |
| const String& key_field_name=params->as_no_junction(0, | const String& key_field_name=params->as_no_junction(0, |
| "key field name must not be code").as_string(); | "key field name must not be code").as_string(); |
| Line 402 static void _hash(Request& r, const Stri | Line 403 static void _hash(Request& r, const Stri |
| } | } |
| // integers: key_field & value_fields | // integers: key_field & value_fields |
| Value& result=*new(pool) VHash(pool); | |
| Row_info row_info={&table, key_field, &value_fields, result.get_hash()}; | Row_info row_info={&table, key_field, &value_fields, result.get_hash()}; |
| table.for_each(table_row_to_hash, &row_info); | table.for_each(table_row_to_hash, &row_info); |
| result.set_name(method_name); | |
| r.write_no_lang(result); | |
| } | } |
| result.set_name(method_name); | |
| r.write_no_lang(result); | |
| } | } |
| /// used by table: _sort / sort_cmp_string|sort_cmp_double | /// used by table: _sort / sort_cmp_string|sort_cmp_double |
| Line 648 static void _sql(Request& r, const Strin | Line 648 static void _sql(Request& r, const Strin |
| PTHROW(rethrow_me.type(), rethrow_me.code(), | PTHROW(rethrow_me.type(), rethrow_me.code(), |
| &statement_string, // setting more specific source [were url] | &statement_string, // setting more specific source [were url] |
| rethrow_me.comment()); | rethrow_me.comment()); |
| if(!handlers.table) | Table *result= |
| PTHROW(0, 0, | handlers.table?handlers.table: // query resulted in table? return it |
| &statement_string, | new(pool) Table(pool, &method_name, 0); // query returned no table, fake it |
| "no table result"); | |
| // replace any previous table value | // replace any previous table value |
| static_cast<VTable *>(r.self)->set_table(*handlers.table); | static_cast<VTable *>(r.self)->set_table(*result); |
| } | } |
| static void _dir(Request& r, const String& method_name, MethodParams *params) { | static void _dir(Request& r, const String& method_name, MethodParams *params) { |