|
|
| version 1.2, 2001/10/29 08:36:51 | version 1.4, 2002/02/08 07:28:14 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser ODBC driver. | Parser ODBC driver. |
| Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) | Copyright(c) 2001, 2002 ArtLebedev Group(http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru>(http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru>(http://design.ru/paf) |
| */ | */ |
| Line 49 public: | Line 49 public: |
| /// get api version | /// get api version |
| int api_version() { return SQL_DRIVER_API_VERSION; } | int api_version() { return SQL_DRIVER_API_VERSION; } |
| const char *initialize(const char *dlopen_file_spec) { return 0; } | const char *initialize(char *dlopen_file_spec) { return 0; } |
| /** connect | /** connect |
| @param used_only_in_connect_url | @param used_only_in_connect_url |
| format: @b DSN=dsn;UID=user;PWD=password (ODBC connect string) | format: @b DSN=dsn;UID=user;PWD=password (ODBC connect string) |
| Line 112 public: | Line 112 public: |
| unsigned int quote( | unsigned int quote( |
| SQL_Driver_services&, void *connection, | SQL_Driver_services&, void *connection, |
| char *to, const char *from, unsigned int length) { | char *to, const char *from, unsigned int length) { |
| /* | if(to) { // store mode |
| You must allocate the to buffer to be at least length*2+1 bytes long. | unsigned int result=length; |
| (In the worse case, each character may need to be encoded as using two bytes, | while(length--) { |
| and you need room for the terminating null byte.) | if(*from=='\'') { // ' -> '' |
| *to++='\''; result++; | |
| it's already UNTAINT_TIMES_BIGGER | } |
| */ | *to++=*from++; |
| // ' -> '' | } |
| unsigned int result=length; | return result; |
| while(length--) { | } else // estimate mode |
| if(*from=='\'') | return length*2; |
| *to++='\''; | |
| *to++=*from++; | |
| } | |
| return result; | |
| } | } |
| void query( | void query( |
| SQL_Driver_services& services, void *connection, | SQL_Driver_services& services, void *connection, |