summaryrefslogtreecommitdiff
path: root/ext/dbx/dbx_odbc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dbx/dbx_odbc.c')
-rw-r--r--ext/dbx/dbx_odbc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/dbx/dbx_odbc.c b/ext/dbx/dbx_odbc.c
index 01a0a82aec..139855026b 100644
--- a/ext/dbx/dbx_odbc.c
+++ b/ext/dbx/dbx_odbc.c
@@ -272,6 +272,27 @@ int dbx_odbc_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
return 1;
}
+int dbx_odbc_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
+{
+ /* returns escaped string */
+ /* replace ' with '' */
+ char * str;
+ int len;
+ char * tmpstr;
+ int tmplen;
+
+ tmpstr = estrdup(Z_STRVAL_PP(string));
+ tmplen = Z_STRLEN_PP(string);
+ /* php_str_to_str uses a smart_str that allocates memory */
+ /* this memory must be freed or passed on to rv */
+ str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
+ efree(tmpstr);
+
+ ZVAL_STRINGL(*rv, str, len, 0);
+
+ return 1;
+}
+
/*
* Local variables:
* tab-width: 4