|
|
| version 1.10, 2002/12/15 08:52:10 | version 1.12.6.1, 2003/03/26 14:09:06 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser PgSQL driver. | Parser PgSQL driver. |
| Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) | Copyright(c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| Line 175 public: | Line 175 public: |
| return PQstatus((PGconn *)connection)==CONNECTION_OK; | return PQstatus((PGconn *)connection)==CONNECTION_OK; |
| } | } |
| unsigned int quote( | const char* quote( |
| SQL_Driver_services&, void *connection, | SQL_Driver_services& services, void *connection, |
| char *to, const char *from, unsigned int length) { | const char *from, unsigned int length) { |
| if(to) { // store mode | char *result=(char*)services.malloc_atomic(length*2+1); |
| unsigned int result=length; | char *to=result; |
| while(length--) { | while(length--) { |
| switch(*from) { | switch(*from) { |
| case '\'': // "'" -> "''" | case '\'': // "'" -> "''" |
| *to++='\''; result++; | *to++='\''; result++; |
| break; | break; |
| case '\\': // "\" -> "\\" | case '\\': // "\" -> "\\" |
| *to++='\\'; result++; | *to++='\\'; result++; |
| break; | break; |
| } | |
| *to++=*from++; | |
| } | } |
| return result; | *to++=*from++; |
| } else // estimate mode | } |
| return length*2; | *to=0; |
| } | return result; |
| } | |
| void query( | void query( |
| SQL_Driver_services& services, void *connection, | SQL_Driver_services& services, void *connection, |
| const char *astatement, unsigned long offset, unsigned long limit, | const char *astatement, unsigned long offset, unsigned long limit, |
| Line 448 private: // conn client library funcs | Line 447 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"; |