diff options
Diffstat (limited to 'ext/dbx/dbx_mssql.c')
| -rw-r--r-- | ext/dbx/dbx_mssql.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/dbx/dbx_mssql.c b/ext/dbx/dbx_mssql.c index f905ed10be..9ea38ca1eb 100644 --- a/ext/dbx/dbx_mssql.c +++ b/ext/dbx/dbx_mssql.c @@ -249,6 +249,27 @@ int dbx_mssql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) return 1; } +int dbx_mssql_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 |
