return 1;
}
-static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen TSRMLS_DC)
+static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC)
{
*quoted = emalloc(2*unquotedlen + 3);
(*quoted)[0] = '\'';
#define OIDOID 26
+static void _pdo_pgsql_free_lobs(pdo_stmt_t *stmt TSRMLS_DC)
+{
+ pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
+ int i;
+
+ for (i=0; i<stmt->column_count; i++) {
+ if (S->cols[i].lobval) {
+ free(S->cols[i].lobval);
+ S->cols[i].lobval = NULL;
+ S->cols[i].lobval = 0;
+ }
+ }
+}
+
static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
{
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
}
if(S->cols) {
+ _pdo_pgsql_free_lobs(stmt TSRMLS_CC);
efree(S->cols);
S->cols = NULL;
}
{
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
+ /* free any allocated lob objects from the previos fetch operation */
+ _pdo_pgsql_free_lobs(stmt TSRMLS_CC);
+
if (S->cursor_name) {
char *ori_str = NULL;
char *q = NULL;
}
break;
+ case BYTEAOID:
+ cols[colno].param_type = PDO_PARAM_LOB;
+ break;
+
default:
cols[colno].param_type = PDO_PARAM_STR;
}
*ptr = (char *) &(S->cols[colno].boolval);
*len = sizeof(zend_bool);
break;
+
+ case PDO_PARAM_LOB:
+ S->cols[colno].lobval = PQunescapeBytea(*ptr, &(S->cols[colno].loblen));
+ *ptr = S->cols[colno].lobval;
+ *len = S->cols[colno].loblen;
+ break;
}
}