|
|
| version 1.26, 2007/01/26 10:10:32 | version 1.27, 2007/01/29 10:22:45 |
|---|---|
| Line 237 public: | Line 237 public: |
| //services._throw("bind variables not supported (yet)"); | //services._throw("bind variables not supported (yet)"); |
| int binds_size=sizeof(char) * placeholders_count; | int binds_size=sizeof(char) * placeholders_count; |
| paramValues = static_cast<const char**>(services.malloc_atomic(binds_size)); | paramValues = static_cast<const char**>(services.malloc_atomic(binds_size)); |
| for(size_t i=0; i<placeholders_count; ++i) { | bind_parameters(placeholders_count, placeholders, paramValues, connection); |
| Placeholder& ph=placeholders[i]; | |
| size_t value_length; | |
| if(cstrClientCharset) { | |
| size_t name_length; | |
| services.transcode(ph.name, strlen(ph.name), | |
| ph.name, name_length, | |
| services.request_charset(), | |
| cstrClientCharset); | |
| if(ph.value){ | |
| services.transcode(ph.value, strlen(ph.value), | |
| ph.value, value_length, | |
| services.request_charset(), | |
| cstrClientCharset); | |
| } | |
| } else { | |
| value_length=ph.value? strlen(ph.value): 0; | |
| } | |
| if( atoi(ph.name) <= 0 || atoi(ph.name) > placeholders_count) { | |
| services._throw("bad bind parameter key"); | |
| } | |
| paramValues[atoi(ph.name)-1] = ph.value; | |
| } | |
| } | } |
| // transcode from $request:charset to connect-string?client_charset | // transcode from $request:charset to connect-string?client_charset |
| Line 399 cleanup: | Line 376 cleanup: |
| private: // private funcs | private: // private funcs |
| void bind_parameters( | |
| size_t placeholders_count, | |
| Placeholder* placeholders, | |
| const char** paramValues, | |
| Connection& connection | |
| ) { | |
| for(size_t i=0; i<placeholders_count; i++) { | |
| Placeholder& ph=placeholders[i]; | |
| size_t value_length; | |
| if(connection.cstrClientCharset) { | |
| size_t name_length; | |
| connection.services->transcode(ph.name, strlen(ph.name), | |
| ph.name, name_length, | |
| connection.services->request_charset(), | |
| connection.cstrClientCharset); | |
| if(ph.value) { | |
| connection.services->transcode(ph.value, strlen(ph.value), | |
| ph.value, value_length, | |
| connection.services->request_charset(), | |
| connection.cstrClientCharset); | |
| } | |
| } | |
| if( atoi(ph.name) <= 0 || atoi(ph.name) > placeholders_count) { | |
| connection.services->_throw("bad bind parameter key"); | |
| } | |
| paramValues[atoi(ph.name)-1] = ph.value; | |
| } | |
| } | |
| void execute_transaction_cmd(void *aconnection, const char *query) { | void execute_transaction_cmd(void *aconnection, const char *query) { |
| if(isDefaultTransaction) | if(isDefaultTransaction) |
| { | { |