| | 158 | string SQLHandlerPostgres::escapeBinary(string *str) |
|---|
| | 159 | { |
|---|
| | 160 | |
|---|
| | 161 | unsigned char *res; |
|---|
| | 162 | size_t size; |
|---|
| | 163 | res = PQescapeBytea((const unsigned char *)str->c_str(),str->size(),&size); |
|---|
| | 164 | string result((char *)res,(int)size); |
|---|
| | 165 | PQfreemem(res); |
|---|
| | 166 | return result; |
|---|
| | 167 | } |
|---|
| | 168 | |
|---|
| | 169 | string SQLHandlerPostgres::unescapeBinary(string *str) |
|---|
| | 170 | { |
|---|
| | 171 | |
|---|
| | 172 | unsigned char *res; |
|---|
| | 173 | size_t size; |
|---|
| | 174 | res = PQunescapeBytea((unsigned char *)str->c_str(),&size); |
|---|
| | 175 | string result((char *)res,(int)size); |
|---|
| | 176 | PQfreemem(res); |
|---|
| | 177 | return result; |
|---|
| | 178 | } |
|---|
| 211 | | foo[PQfname(res,i)] = PQgetvalue(res, j, i); |
|---|
| | 232 | if ( PQfformat(res,i) == 0 ) |
|---|
| | 233 | { |
|---|
| | 234 | foo[PQfname(res,i)] = PQgetvalue(res, j, i); |
|---|
| | 235 | } else |
|---|
| | 236 | { |
|---|
| | 237 | string bar = PQgetvalue(res, j, i); |
|---|
| | 238 | foo[PQfname(res,i)] = unescapeBinary(&bar); |
|---|
| | 239 | } |
|---|