|
|
| version 1.78, 2006/06/09 19:03:49 | version 1.80, 2007/05/18 12:44:22 |
|---|---|
| Line 73 public: | Line 73 public: |
| } | } |
| bool before_rows(SQL_Error& error) { | bool before_rows(SQL_Error& error) { |
| if(columns.count()<1) { | if(columns.count()<1) { |
| error=SQL_Error("parser.runtime", "no columns"); | error=SQL_Error(PARSER_RUNTIME, "no columns"); |
| return true; | return true; |
| } | } |
| only_one_column=columns.count()==1; | only_one_column=columns.count()==1; |
| Line 100 public: | Line 100 public: |
| row_hash->put(*columns[column_index], new VString(cell)); | row_hash->put(*columns[column_index], new VString(cell)); |
| if(duplicate & !distinct) { | if(duplicate & !distinct) { |
| error=SQL_Error("parser.runtime", "duplicate key"); | error=SQL_Error(PARSER_RUNTIME, "duplicate key"); |
| return true; | return true; |
| } | } |
| Line 265 static void _sql(Request& r, MethodParam | Line 265 static void _sql(Request& r, MethodParam |
| distinct=r.process_to_value(*vdistinct).as_bool(); | distinct=r.process_to_value(*vdistinct).as_bool(); |
| } | } |
| if(valid_options!=options->count()) | if(valid_options!=options->count()) |
| throw Exception("parser.runtime", | throw Exception(PARSER_RUNTIME, |
| 0, | 0, |
| "called with invalid option"); | "called with invalid option"); |
| } else | } else |
| throw Exception("parser.runtime", | throw Exception(PARSER_RUNTIME, |
| 0, | 0, |
| "options must be hash"); | "options must be hash"); |
| } | } |
| Line 333 static void _delete(Request& r, MethodPa | Line 333 static void _delete(Request& r, MethodPa |
| GET_SELF(r, VHash).hash().remove(params.as_string(0, "key must be string")); | GET_SELF(r, VHash).hash().remove(params.as_string(0, "key must be string")); |
| } | } |
| static void _contain(Request& r, MethodParams& params) { | |
| bool result = GET_SELF(r, VHash).hash().contain(params.as_string(0, "key must be string")); | |
| r.write_no_lang(*new VBool(result)); | |
| } | |
| #ifndef DOXYGEN | #ifndef DOXYGEN |
| struct Foreach_info { | struct Foreach_info { |
| Request *r; | Request *r; |
| Line 406 MHash::MHash(): Methoded("hash") | Line 412 MHash::MHash(): Methoded("hash") |
| // ^a.delete[key] | // ^a.delete[key] |
| add_native_method("delete", Method::CT_DYNAMIC, _delete, 1, 1); | add_native_method("delete", Method::CT_DYNAMIC, _delete, 1, 1); |
| // ^hash:sql[query][options hash] | // ^a.contain[key] |
| add_native_method("contain", Method::CT_DYNAMIC, _contain, 1, 1); | |
| // ^hash::sql[query][options hash] | |
| add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 2); | add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 2); |
| // ^hash._keys[[column name]] | // ^hash._keys[[column name]] |