|
|
| version 1.50, 2021/11/07 22:16:54 | version 1.51, 2021/11/08 08:57:16 |
|---|---|
| Line 161 public: | Line 161 public: |
| if(char *key=lsplit(&options, '&')){ | if(char *key=lsplit(&options, '&')){ |
| if(*key){ | if(*key){ |
| if(char *value=lsplit(key, '=')){ | if(char *value=lsplit(key, '=')){ |
| if(strcmp(key, "ClientCharset")==0){ | if(strcmp(key, "ClientCharset")==0){ // transcoding with parser |
| toupper_str(value, value, strlen(value)); | toupper_str(value, value, strlen(value)); |
| connection.client_charset=value; | connection.client_charset=value; |
| } else if(strcasecmp(key, "charset")==0){ | } else if(strcasecmp(key, "charset")==0){ // transcoding with server |
| charset=value; | charset=value; |
| } else if(strcasecmp(key, "datestyle")==0){ | } else if(strcasecmp(key, "datestyle")==0){ |
| datestyle=value; | datestyle=value; |
| Line 192 public: | Line 192 public: |
| } | } |
| if(host && (strchr(host, ',') || pq_options)){ // pq_options can exist only if host and db are not null | if(host && (strchr(host, ',') || pq_options)){ // pq_options can exist only if host and db are not null |
| char pq_url[MAX_STRING+1]; | char pq_url[MAX_STRING]; |
| snprintf(pq_url, MAX_STRING, "postgresql://%s/%s%s", host, db ? db : "", pq_options ? pq_options : ""); | snprintf(pq_url, MAX_STRING, "postgresql://%s/%s%s", host, db ? db : "", pq_options ? pq_options : ""); |
| connection.conn=PQsetdbLogin(NULL, NULL, NULL, NULL, pq_url, user, pwd); | connection.conn=PQsetdbLogin(NULL, NULL, NULL, NULL, pq_url, user, pwd); |
| } else { | } else { |
| Line 207 public: | Line 207 public: |
| throwPQerror; | throwPQerror; |
| if(charset){ | if(charset){ |
| char statement[MAX_STRING+1]="SET CLIENT_ENCODING="; | char statement[MAX_STRING]; |
| strncat(statement, charset, MAX_STRING); | snprintf(statement, MAX_STRING, "SET CLIENT_ENCODING=%s", charset); |
| _execute_cmd(connection, statement); | _execute_cmd(connection, statement); |
| } | } |
| if(datestyle){ | if(datestyle){ |
| char statement[MAX_STRING+1]="SET DATESTYLE="; | char statement[MAX_STRING]; |
| strncat(statement, datestyle, MAX_STRING); | snprintf(statement, MAX_STRING, "SET DATESTYLE=%s", datestyle); |
| _execute_cmd(connection, statement); | _execute_cmd(connection, statement); |
| } | } |
| Line 654 private: // conn client library funcs | Line 652 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(char *dlopen_file_spec) { |
| if(lt_dlinit()){ | if(lt_dlinit()){ |
| if(const char* result=lt_dlerror()) | if(const char* result=lt_dlerror()) |
| return result; | return result; |
| return "can not prepare to dynamic loading"; | return "can not prepare to dynamic loading"; |
| } | } |
| lt_dlhandle handle=lt_dlopen(dlopen_file_spec); | lt_dlhandle handle; |
| do { | |
| char *next=lsplit(dlopen_file_spec, ','); | |
| handle=lt_dlopen(dlopen_file_spec); | |
| dlopen_file_spec=next; | |
| } while (!handle && dlopen_file_spec); | |
| if(!handle){ | if(!handle){ |
| if(const char* result=lt_dlerror()) | if(const char* result=lt_dlerror()) |
| Line 675 private: // conn client library funcs li | Line 678 private: // conn client library funcs li |
| action; | action; |
| #define DLINK(name) DSLINK(name, return "function " #name " was not found") | #define DLINK(name) DSLINK(name, return "function " #name " was not found") |
| DLINK(PQsetdbLogin); | DLINK(PQsetdbLogin); |
| DLINK(PQerrorMessage); | DLINK(PQerrorMessage); |
| DLINK(PQstatus); | DLINK(PQstatus); |