|
|
| version 1.8, 2002/03/22 16:19:13 | version 1.11, 2003/01/15 10:55:38 |
|---|---|
| Line 186 public: | Line 186 public: |
| *to++='\''; result++; | *to++='\''; result++; |
| break; | break; |
| case '\\': // "\" -> "\\" | case '\\': // "\" -> "\\" |
| *to++='\''; result++; | *to++='\\'; result++; |
| break; | break; |
| } | } |
| *to++=*from++; | *to++=*from++; |
| Line 229 public: | Line 229 public: |
| if(!column_count) | if(!column_count) |
| PQclear_throw("result contains no columns"); | PQclear_throw("result contains no columns"); |
| bool failed=false; | |
| SQL_Error sql_error; | |
| #define CHECK(afailed) \ | |
| if(afailed) { \ | |
| failed=true; \ | |
| goto cleanup; \ | |
| } | |
| for(int i=0; i<column_count; i++){ | for(int i=0; i<column_count; i++){ |
| char *name=PQfname(res, i); | char *name=PQfname(res, i); |
| size_t size=strlen(name); | size_t size=strlen(name); |
| void *ptr=services.malloc(size); | void *ptr=services.malloc(size); |
| memcpy(ptr, name, size); | memcpy(ptr, name, size); |
| handlers.add_column(ptr, size); | CHECK(handlers.add_column(sql_error, ptr, size)); |
| } | } |
| handlers.before_rows(); | CHECK(handlers.before_rows(sql_error)); |
| if(unsigned long row_count=(unsigned long)PQntuples(res)) | if(unsigned long row_count=(unsigned long)PQntuples(res)) |
| for(unsigned long r=0; r<row_count; r++) { | for(unsigned long r=0; r<row_count; r++) { |
| handlers.add_row(); | CHECK(handlers.add_row(sql_error)); |
| for(int i=0; i<column_count; i++){ | for(int i=0; i<column_count; i++){ |
| const char *cell=PQgetvalue(res, r, i); | const char *cell=PQgetvalue(res, r, i); |
| size_t size; | size_t size; |
| Line 284 public: | Line 292 public: |
| } else | } else |
| ptr=0; | ptr=0; |
| } | } |
| handlers.add_row_cell(ptr, size); | CHECK(handlers.add_row_cell(sql_error, ptr, size)); |
| } | } |
| } | } |
| cleanup: | |
| PQclear(res); | PQclear(res); |
| if(failed) | |
| services._throw(sql_error); | |
| } | } |
| private: // private funcs | private: // private funcs |
| Line 438 private: // conn client library funcs | Line 448 private: // conn client library funcs |
| private: // conn client library funcs linking | private: // conn client library funcs linking |
| const char *dlink(const char *dlopen_file_spec) { | const char *dlink(const char *dlopen_file_spec) { |
| if(lt_dlinit()) | |
| return lt_dlerror(); | |
| lt_dlhandle handle=lt_dlopen(dlopen_file_spec); | lt_dlhandle handle=lt_dlopen(dlopen_file_spec); |
| if(!handle) | if(!handle) |
| return "can not open the dynamic link module"; | return "can not open the dynamic link module"; |