diff options
| author | Marc Boeren <mboeren@php.net> | 2002-10-29 14:08:40 +0000 |
|---|---|---|
| committer | Marc Boeren <mboeren@php.net> | 2002-10-29 14:08:40 +0000 |
| commit | 25e7a092293b4e54e25592d34834bb3d55ae0fdc (patch) | |
| tree | e0ceed1f54846d8ff4e5ce455fa65c1c682373c9 /ext/dbx/dbx_odbc.c | |
| parent | 82317945e5ff22cf6addb9251f656fe5bcc15b1d (diff) | |
| download | php-git-25e7a092293b4e54e25592d34834bb3d55ae0fdc.tar.gz | |
Added dbx_escape_string function
# tested on odbc, oci8 and mysql
@Added dbx_escape_string function to dbx module. (Marc)
Diffstat (limited to 'ext/dbx/dbx_odbc.c')
| -rw-r--r-- | ext/dbx/dbx_odbc.c | 21 |
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 |
