|
|
| version 1.196, 2004/02/11 15:33:13 | version 1.203, 2004/06/18 15:55:47 |
|---|---|
| Line 36 DECLARE_CLASS_VAR(table, new MTable, 0); | Line 36 DECLARE_CLASS_VAR(table, new MTable, 0); |
| // defines for globals | // defines for globals |
| #define SQL_BIND_NAME "bind" | |
| #define SQL_LIMIT_NAME "limit" | #define SQL_LIMIT_NAME "limit" |
| #define SQL_OFFSET_NAME "offset" | #define SQL_OFFSET_NAME "offset" |
| #define SQL_DEFAULT_NAME "default" | #define SQL_DEFAULT_NAME "default" |
| Line 44 DECLARE_CLASS_VAR(table, new MTable, 0); | Line 45 DECLARE_CLASS_VAR(table, new MTable, 0); |
| // globals | // globals |
| String sql_bind_name(SQL_BIND_NAME); | |
| String sql_limit_name(SQL_LIMIT_NAME); | String sql_limit_name(SQL_LIMIT_NAME); |
| String sql_offset_name(SQL_OFFSET_NAME); | String sql_offset_name(SQL_OFFSET_NAME); |
| String sql_default_name(SQL_DEFAULT_NAME); | String sql_default_name(SQL_DEFAULT_NAME); |
| Line 251 static void skip_empty_and_comment_lines | Line 253 static void skip_empty_and_comment_lines |
| while( char c=*data ) { | while( char c=*data ) { |
| if( c== '\n' || c == '#' ) { | if( c== '\n' || c == '#' ) { |
| /*nowhere=*/getrow(&data); // remove empty&comment lines | /*nowhere=*/getrow(&data); // remove empty&comment lines |
| *data_ref=data; | if(!(*data_ref=data)) |
| break; | |
| continue; | continue; |
| } | } |
| break; | break; |
| Line 335 static void _load(Request& r, MethodPara | Line 338 static void _load(Request& r, MethodPara |
| Table::element_type row(new ArrayString); | Table::element_type row(new ArrayString); |
| skip_empty_and_comment_lines(&data); | skip_empty_and_comment_lines(&data); |
| while( lsplit_result sr=lsplit(&data, separators.column, '\n', separators.encloser) ) { | while( lsplit_result sr=lsplit(&data, separators.column, '\n', separators.encloser) ) { |
| if(!sr.delim && !row->count()) // append last empty column [if without \n] | if(!*sr.piece && !sr.delim && !row->count()) // append last empty column [if without \n] |
| break; | break; |
| *row+=new String(sr.piece, 0, true); | *row+=new String(sr.piece, 0, true); |
| if(sr.delim=='\n') { | if(sr.delim=='\n') { |
| Line 368 static void maybe_enclose( String& to, c | Line 371 static void maybe_enclose( String& to, c |
| to<<*sencloser; | to<<*sencloser; |
| } else | } else |
| to.append(from, String::L_TABLE); | to<<from; |
| } | } |
| Line 629 static void _hash(Request& r, MethodPara | Line 632 static void _hash(Request& r, MethodPara |
| } else | } else |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| 0, | 0, |
| "value field(s) must be string or self_table" | "value field(s) must be string or table" |
| ); | ); |
| } else { // by all columns, including key | } else { // by all columns, including key |
| if(!(distinct!=D_ILLEGAL && distinct!=D_FIRST)) | if(!(distinct!=D_ILLEGAL && distinct!=D_FIRST)) |
| Line 644 static void _hash(Request& r, MethodPara | Line 647 static void _hash(Request& r, MethodPara |
| &r, | &r, |
| &self_table, | &self_table, |
| /*key_code=*/key_param->get_junction()?key_param:0, | /*key_code=*/key_param->get_junction()?key_param:0, |
| /*key_field=*/0, | /*key_field=*/0/*filled below*/, |
| &value_fields, | &value_fields, |
| &result.hash(), | &result.hash(), |
| distinct, | distinct, |
| Line 925 static void _sql(Request& r, MethodParam | Line 928 static void _sql(Request& r, MethodParam |
| gettimeofday(&mt[0],NULL); | gettimeofday(&mt[0],NULL); |
| #endif | #endif |
| r.connection()->query( | r.connection()->query( |
| statement_cstr, offset, limit, | statement_cstr, |
| 0, 0, | |
| offset, limit, | |
| handlers, | handlers, |
| statement_string); | statement_string); |