summaryrefslogtreecommitdiff
path: root/ext/pdo/pdo_sql_parser.re
diff options
context:
space:
mode:
authorAdam Baratz <adambaratz@php.net>2016-10-17 17:06:49 -0400
committerAdam Baratz <adambaratz@php.net>2016-10-17 17:07:10 -0400
commit82fe200a3feddc7f219869cdabd62eebff275e0f (patch)
tree22a1db71655f4ee1723a0c334ca4d0e10722b78d /ext/pdo/pdo_sql_parser.re
parentf4578d5a0e8630b1e348cbdf953c791384a314ce (diff)
downloadphp-git-82fe200a3feddc7f219869cdabd62eebff275e0f.tar.gz
Remove dead code
Diffstat (limited to 'ext/pdo/pdo_sql_parser.re')
-rw-r--r--ext/pdo/pdo_sql_parser.re126
1 files changed, 0 insertions, 126 deletions
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 604ec59304..16fc29f0f1 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -417,132 +417,6 @@ clean_up:
return ret;
}
-#if 0
-int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery,
- int *outquery_len)
-{
- Scanner s;
- char *ptr;
- int t;
- int bindno = 0;
- int newbuffer_len;
- int padding;
- HashTable *params = stmt->bound_params;
- struct pdo_bound_param_data *param;
- /* allocate buffer for query with expanded binds, ptr is our writing pointer */
- newbuffer_len = inquery_len;
-
- /* calculate the possible padding factor due to quoting */
- if(stmt->dbh->max_escaped_char_length) {
- padding = stmt->dbh->max_escaped_char_length;
- } else {
- padding = 3;
- }
- if(params) {
- ZEND_HASH_FOREACH_PTR(params, param) {
- if(param->parameter) {
- convert_to_string(param->parameter);
- /* accommodate a string that needs to be fully quoted
- bind placeholders are at least 2 characters, so
- the accommodate their own "'s
- */
- newbuffer_len += padding * Z_STRLEN_P(param->parameter);
- }
- } ZEND_HASH_FOREACH_END();
- }
- *outquery = (char *) emalloc(newbuffer_len + 1);
- *outquery_len = 0;
-
- ptr = *outquery;
- s.cur = inquery;
- while((t = scan(&s)) != PDO_PARSER_EOI) {
- if(t == PDO_PARSER_TEXT) {
- memcpy(ptr, s.tok, s.cur - s.tok);
- ptr += (s.cur - s.tok);
- *outquery_len += (s.cur - s.tok);
- }
- else if(t == PDO_PARSER_BIND) {
- if(!params) {
- /* error */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- /* lookup bind first via hash and then index */
- /* stupid keys need to be null-terminated, even though we know their length */
- if((NULL != (param = zend_hash_str_find_ptr(params, s.tok, s.cur-s.tok))
- ||
- NULL != (params = zend_hash_index_find_ptr(params, bindno)))
- {
- char *quotedstr;
- int quotedstrlen;
- /* restore the in-string key, doesn't need null-termination here */
- /* currently everything is a string here */
-
- /* quote the bind value if necessary */
- if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen))
- {
- memcpy(ptr, quotedstr, quotedstrlen);
- ptr += quotedstrlen;
- *outquery_len += quotedstrlen;
- efree(quotedstr);
- } else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
- ptr += Z_STRLEN_P(param->parameter);
- *outquery_len += (Z_STRLEN_P(param->parameter));
- }
- }
- else {
- /* error and cleanup */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- bindno++;
- }
- else if(t == PDO_PARSER_BIND_POS) {
- if(!params) {
- /* error */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- /* lookup bind by index */
- if(NULL != (params = zend_hash_index_find_ptr(params, bindno)))
- {
- char *quotedstr;
- int quotedstrlen;
- /* currently everything is a string here */
-
- /* quote the bind value if necessary */
- if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen))
- {
- memcpy(ptr, quotedstr, quotedstrlen);
- ptr += quotedstrlen;
- *outquery_len += quotedstrlen;
- efree(quotedstr);
- } else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
- ptr += Z_STRLEN_P(param->parameter);
- *outquery_len += (Z_STRLEN_P(param->parameter));
- }
- }
- else {
- /* error and cleanup */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- bindno++;
- }
- }
- *ptr = '\0';
- return 0;
-}
-#endif
-
/*
* Local variables:
* tab-width: 4