PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - lcov_data/ext/pdo - pdo_sql_parser.re (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 161 183 88.0 %
Date: 2015-07-31 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2015 The PHP Group                                |
       6             :   +----------------------------------------------------------------------+
       7             :   | This source file is subject to version 3.01 of the PHP license,      |
       8             :   | that is bundled with this package in the file LICENSE, and is        |
       9             :   | available through the world-wide-web at the following url:           |
      10             :   | http://www.php.net/license/3_01.txt                                  |
      11             :   | If you did not receive a copy of the PHP license and are unable to   |
      12             :   | obtain it through the world-wide-web, please send a note to          |
      13             :   | license@php.net so we can mail you a copy immediately.               |
      14             :   +----------------------------------------------------------------------+
      15             :   | Author: George Schlossnagle <george@omniti.com>                      |
      16             :   +----------------------------------------------------------------------+
      17             : */
      18             : 
      19             : /* $Id$ */
      20             : 
      21             : #include "php.h"
      22             : #include "php_pdo_driver.h"
      23             : #include "php_pdo_int.h"
      24             : 
      25             : #define PDO_PARSER_TEXT 1
      26             : #define PDO_PARSER_BIND 2
      27             : #define PDO_PARSER_BIND_POS 3
      28             : #define PDO_PARSER_EOI 4
      29             : 
      30             : #define RET(i) {s->cur = cursor; return i; }
      31             : #define SKIP_ONE(i) {s->cur = s->tok + 1; return i; }
      32             : 
      33             : #define YYCTYPE         unsigned char
      34             : #define YYCURSOR        cursor
      35             : #define YYLIMIT         s->end
      36             : #define YYMARKER        s->ptr
      37             : #define YYFILL(n)               { RET(PDO_PARSER_EOI); }
      38             : 
      39             : typedef struct Scanner {
      40             :         char    *ptr, *cur, *tok, *end;
      41             : } Scanner;
      42             : 
      43        7321 : static int scan(Scanner *s)
      44             : {
      45        7321 :         char *cursor = s->cur;
      46             : 
      47        7321 :         s->tok = cursor;
      48             :         /*!re2c
      49             :         BINDCHR         = [:][a-zA-Z0-9_]+;
      50             :         QUESTION        = [?];
      51             :         COMMENTS        = ("/*"([^*]+|[*]+[^/*])*[*]*"*/"|"--"[^\r\n]*);
      52             :         SPECIALS        = [:?"'];
      53             :         MULTICHAR       = ([:]{2,}|[?]{2,});
      54             :         ANYNOEOF        = [\001-\377];
      55             :         */
      56             : 
      57             :         /*!re2c
      58           9 :                 (["](([\\]ANYNOEOF)|ANYNOEOF\["\\])*["]) { RET(PDO_PARSER_TEXT); }
      59         151 :                 (['](([\\]ANYNOEOF)|ANYNOEOF\['\\])*[']) { RET(PDO_PARSER_TEXT); }
      60          10 :                 MULTICHAR                                                               { RET(PDO_PARSER_TEXT); }
      61         417 :                 BINDCHR                                                                 { RET(PDO_PARSER_BIND); }
      62        1465 :                 QUESTION                                                                { RET(PDO_PARSER_BIND_POS); }
      63          12 :                 SPECIALS                                                                { SKIP_ONE(PDO_PARSER_TEXT); }
      64           7 :                 COMMENTS                                                                { RET(PDO_PARSER_TEXT); }
      65        3387 :                 (ANYNOEOF\SPECIALS)+                                    { RET(PDO_PARSER_TEXT); }
      66             :         */
      67             : }
      68             : 
      69             : struct placeholder {
      70             :         char *pos;
      71             :         size_t len;
      72             :         int bindno;
      73             :         size_t qlen;            /* quoted length of value */
      74             :         char *quoted;   /* quoted value */
      75             :         int freeq;
      76             :         struct placeholder *next;
      77             : };
      78             : 
      79         992 : static void free_param_name(zval *el) {
      80         992 :         efree(Z_PTR_P(el));
      81         992 : }
      82             : 
      83        1863 : PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len,
      84             :         char **outquery, size_t *outquery_len)
      85             : {
      86             :         Scanner s;
      87             :         char *ptr, *newbuffer;
      88             :         int t;
      89        1863 :         int bindno = 0;
      90        1863 :         int ret = 0;
      91             :         size_t newbuffer_len;
      92             :         HashTable *params;
      93             :         struct pdo_bound_param_data *param;
      94        1863 :         int query_type = PDO_PLACEHOLDER_NONE;
      95        1863 :         struct placeholder *placeholders = NULL, *placetail = NULL, *plc = NULL;
      96             : 
      97        1863 :         ptr = *outquery;
      98        1863 :         s.cur = inquery;
      99        1863 :         s.end = inquery + inquery_len + 1;
     100             : 
     101             :         /* phase 1: look for args */
     102        9184 :         while((t = scan(&s)) != PDO_PARSER_EOI) {
     103        5458 :                 if (t == PDO_PARSER_BIND || t == PDO_PARSER_BIND_POS) {
     104        1882 :                         if (t == PDO_PARSER_BIND) {
     105         417 :                                 int len = s.cur - s.tok;
     106         417 :                                 if ((inquery < (s.cur - len)) && isalnum(*(s.cur - len - 1))) {
     107           0 :                                         continue;
     108             :                                 }
     109         417 :                                 query_type |= PDO_PLACEHOLDER_NAMED;
     110             :                         } else {
     111        1465 :                                 query_type |= PDO_PLACEHOLDER_POSITIONAL;
     112             :                         }
     113             : 
     114        1882 :                         plc = emalloc(sizeof(*plc));
     115        1882 :                         memset(plc, 0, sizeof(*plc));
     116        1882 :                         plc->next = NULL;
     117        1882 :                         plc->pos = s.tok;
     118        1882 :                         plc->len = s.cur - s.tok;
     119        1882 :                         plc->bindno = bindno++;
     120             : 
     121        1882 :                         if (placetail) {
     122         973 :                                 placetail->next = plc;
     123             :                         } else {
     124         909 :                                 placeholders = plc;
     125             :                         }
     126        1882 :                         placetail = plc;
     127             :                 }
     128             :         }
     129             : 
     130        1863 :         if (bindno == 0) {
     131             :                 /* nothing to do; good! */
     132         954 :                 return 0;
     133             :         }
     134             : 
     135             :         /* did the query make sense to me? */
     136         909 :         if (query_type == (PDO_PLACEHOLDER_NAMED|PDO_PLACEHOLDER_POSITIONAL)) {
     137             :                 /* they mixed both types; punt */
     138           2 :                 pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters");
     139           2 :                 ret = -1;
     140           2 :                 goto clean_up;
     141             :         }
     142             : 
     143         907 :         if (stmt->supports_placeholders == query_type && !stmt->named_rewrite_template) {
     144             :                 /* query matches native syntax */
     145         276 :                 ret = 0;
     146         276 :                 goto clean_up;
     147             :         }
     148             : 
     149         631 :         if (stmt->named_rewrite_template) {
     150             :                 /* magic/hack.
     151             :                  * We we pretend that the query was positional even if
     152             :                  * it was named so that we fall into the
     153             :                  * named rewrite case below.  Not too pretty,
     154             :                  * but it works. */
     155          46 :                 query_type = PDO_PLACEHOLDER_POSITIONAL;
     156             :         }
     157             : 
     158         631 :         params = stmt->bound_params;
     159             : 
     160             :         /* Do we have placeholders but no bound params */
     161         631 :         if (bindno && !params && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
     162           0 :                 pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound");
     163           0 :                 ret = -1;
     164           0 :                 goto clean_up;
     165             :         }
     166             : 
     167         631 :         if (params && bindno != zend_hash_num_elements(params) && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
     168             :                 /* extra bit of validation for instances when same params are bound more than once */
     169         210 :                 if (query_type != PDO_PLACEHOLDER_POSITIONAL && bindno > zend_hash_num_elements(params)) {
     170          11 :                         int ok = 1;
     171          34 :                         for (plc = placeholders; plc; plc = plc->next) {
     172          46 :                                 if ((param = zend_hash_str_find_ptr(params, plc->pos, plc->len)) == NULL) {
     173           0 :                                         ok = 0;
     174           0 :                                         break;
     175             :                                 }
     176             :                         }
     177          11 :                         if (ok) {
     178          11 :                                 goto safe;
     179             :                         }
     180             :                 }
     181         199 :                 pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens");
     182         199 :                 ret = -1;
     183         199 :                 goto clean_up;
     184             :         }
     185             : safe:
     186             :         /* what are we going to do ? */
     187         432 :         if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
     188             :                 /* query generation */
     189             : 
     190         257 :                 newbuffer_len = inquery_len;
     191             : 
     192             :                 /* let's quote all the values */
     193         670 :                 for (plc = placeholders; plc; plc = plc->next) {
     194         417 :                         if (query_type == PDO_PLACEHOLDER_POSITIONAL) {
     195         570 :                                 param = zend_hash_index_find_ptr(params, plc->bindno);
     196             :                         } else {
     197         264 :                                 param = zend_hash_str_find_ptr(params, plc->pos, plc->len);
     198             :                         }
     199         417 :                         if (param == NULL) {
     200             :                                 /* parameter was not defined */
     201           4 :                                 ret = -1;
     202           4 :                                 pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined");
     203           4 :                                 goto clean_up;
     204             :                         }
     205         413 :                         if (stmt->dbh->methods->quoter) {
     206             :                                 zval *parameter;
     207         826 :                                 if (Z_ISREF(param->parameter)) {
     208         132 :                                         parameter = Z_REFVAL(param->parameter);
     209             :                                 } else {
     210         281 :                                         parameter = &param->parameter;
     211             :                                 }
     212         417 :                                 if (param->param_type == PDO_PARAM_LOB && Z_TYPE_P(parameter) == IS_RESOURCE) {
     213             :                                         php_stream *stm;
     214             : 
     215           2 :                                         php_stream_from_zval_no_verify(stm, parameter);
     216           2 :                                         if (stm) {
     217             :                                                 zend_string *buf;
     218             : 
     219           2 :                                                 buf = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0);
     220           2 :                                                 if (!stmt->dbh->methods->quoter(stmt->dbh, buf->val, buf->len, &plc->quoted, &plc->qlen,
     221             :                                                                 param->param_type)) {
     222             :                                                         /* bork */
     223           0 :                                                         ret = -1;
     224           0 :                                                         strncpy(stmt->error_code, stmt->dbh->error_code, 6);
     225           0 :                                                         if (buf) {
     226             :                                                                 zend_string_release(buf);
     227             :                                                         }
     228           0 :                                                         goto clean_up;
     229             :                                                 }
     230           2 :                                                 if (buf) {
     231             :                                                         zend_string_release(buf);
     232             :                                                 }
     233             :                                         } else {
     234           0 :                                                 pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource");
     235           0 :                                                 ret = -1;
     236           0 :                                                 goto clean_up;
     237             :                                         }
     238           2 :                                         plc->freeq = 1;
     239             :                                 } else {
     240             :                                         zval tmp_param;
     241         411 :                                         ZVAL_DUP(&tmp_param, parameter);
     242         411 :                                         switch (Z_TYPE(tmp_param)) {
     243             :                                                 case IS_NULL:
     244           5 :                                                         plc->quoted = "NULL";
     245           5 :                                                         plc->qlen = sizeof("NULL")-1;
     246           5 :                                                         plc->freeq = 0;
     247           5 :                                                         break;
     248             : 
     249             :                                                 case IS_FALSE:
     250             :                                                 case IS_TRUE:
     251           0 :                                                         convert_to_long(&tmp_param);
     252             :                                                         /* fall through */
     253             :                                                 case IS_LONG:
     254             :                                                 case IS_DOUBLE:
     255          28 :                                                         convert_to_string(&tmp_param);
     256          28 :                                                         plc->qlen = Z_STRLEN(tmp_param);
     257          28 :                                                         plc->quoted = estrdup(Z_STRVAL(tmp_param));
     258          28 :                                                         plc->freeq = 1;
     259          28 :                                                         break;
     260             : 
     261             :                                                 default:
     262         378 :                                                         convert_to_string(&tmp_param);
     263         756 :                                                         if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param),
     264         378 :                                                                         Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen,
     265             :                                                                         param->param_type)) {
     266             :                                                                 /* bork */
     267           0 :                                                                 ret = -1;
     268           0 :                                                                 strncpy(stmt->error_code, stmt->dbh->error_code, 6);
     269           0 :                                                                 goto clean_up;
     270             :                                                         }
     271         378 :                                                         plc->freeq = 1;
     272             :                                         }
     273             :                                         zval_dtor(&tmp_param);
     274             :                                 }
     275             :                         } else {
     276             :                                 zval *parameter;
     277           0 :                                 if (Z_ISREF(param->parameter)) {
     278           0 :                                         parameter = Z_REFVAL(param->parameter);
     279             :                                 } else {
     280           0 :                                         parameter = &param->parameter;
     281             :                                 }
     282           0 :                                 plc->quoted = Z_STRVAL_P(parameter);
     283           0 :                                 plc->qlen = Z_STRLEN_P(parameter);
     284             :                         }
     285         413 :                         newbuffer_len += plc->qlen;
     286             :                 }
     287             : 
     288             : rewrite:
     289             :                 /* allocate output buffer */
     290         428 :                 newbuffer = emalloc(newbuffer_len + 1);
     291         428 :                 *outquery = newbuffer;
     292             : 
     293             :                 /* and build the query */
     294         428 :                 plc = placeholders;
     295         428 :                 ptr = inquery;
     296             : 
     297             :                 do {
     298         941 :                         t = plc->pos - ptr;
     299         941 :                         if (t) {
     300         941 :                                 memcpy(newbuffer, ptr, t);
     301         941 :                                 newbuffer += t;
     302             :                         }
     303         941 :                         memcpy(newbuffer, plc->quoted, plc->qlen);
     304         941 :                         newbuffer += plc->qlen;
     305         941 :                         ptr = plc->pos + plc->len;
     306             : 
     307         941 :                         plc = plc->next;
     308         941 :                 } while (plc);
     309             : 
     310         428 :                 t = (inquery + inquery_len) - ptr;
     311         428 :                 if (t) {
     312         244 :                         memcpy(newbuffer, ptr, t);
     313         244 :                         newbuffer += t;
     314             :                 }
     315         428 :                 *newbuffer = '\0';
     316         428 :                 *outquery_len = newbuffer - *outquery;
     317             : 
     318         428 :                 ret = 1;
     319         428 :                 goto clean_up;
     320             : 
     321         175 :         } else if (query_type == PDO_PLACEHOLDER_POSITIONAL) {
     322             :                 /* rewrite ? to :pdoX */
     323             :                 char *name, *idxbuf;
     324          46 :                 const char *tmpl = stmt->named_rewrite_template ? stmt->named_rewrite_template : ":pdo%d";
     325          46 :                 int bind_no = 1;
     326             : 
     327          46 :                 newbuffer_len = inquery_len;
     328             : 
     329          46 :                 if (stmt->bound_param_map == NULL) {
     330          46 :                         ALLOC_HASHTABLE(stmt->bound_param_map);
     331          46 :                         zend_hash_init(stmt->bound_param_map, 13, NULL, free_param_name, 0);
     332             :                 }
     333             : 
     334         476 :                 for (plc = placeholders; plc; plc = plc->next) {
     335         430 :                         int skip_map = 0;
     336             :                         char *p;
     337         430 :                         name = estrndup(plc->pos, plc->len);
     338             : 
     339             :                         /* check if bound parameter is already available */
     340         892 :                         if (!strcmp(name, "?") || (p = zend_hash_str_find_ptr(stmt->bound_param_map, name, plc->len)) == NULL) {
     341         421 :                                 spprintf(&idxbuf, 0, tmpl, bind_no++);
     342             :                         } else {
     343           9 :                                 idxbuf = estrdup(p);
     344           9 :                                 skip_map = 1;
     345             :                         }
     346             : 
     347         430 :                         plc->quoted = idxbuf;
     348         430 :                         plc->qlen = strlen(plc->quoted);
     349         430 :                         plc->freeq = 1;
     350         430 :                         newbuffer_len += plc->qlen;
     351             : 
     352         430 :                         if (!skip_map && stmt->named_rewrite_template) {
     353             :                                 /* create a mapping */
     354         421 :                                 zend_hash_str_update_mem(stmt->bound_param_map, name, plc->len, idxbuf, plc->qlen + 1);
     355             :                         }
     356             : 
     357             :                         /* map number to name */
     358         430 :                         zend_hash_index_update_mem(stmt->bound_param_map, plc->bindno, idxbuf, plc->qlen + 1);
     359             : 
     360         430 :                         efree(name);
     361             :                 }
     362             : 
     363          46 :                 goto rewrite;
     364             : 
     365             :         } else {
     366             :                 /* rewrite :name to ? */
     367             : 
     368         129 :                 newbuffer_len = inquery_len;
     369             : 
     370         129 :                 if (stmt->bound_param_map == NULL) {
     371         129 :                         ALLOC_HASHTABLE(stmt->bound_param_map);
     372         129 :                         zend_hash_init(stmt->bound_param_map, 13, NULL, free_param_name, 0);
     373             :                 }
     374             : 
     375         270 :                 for (plc = placeholders; plc; plc = plc->next) {
     376             :                         char *name;
     377         141 :                         name = estrndup(plc->pos, plc->len);
     378         141 :                         zend_hash_index_update_mem(stmt->bound_param_map, plc->bindno, name, plc->len + 1);
     379         141 :                         efree(name);
     380         141 :                         plc->quoted = "?";
     381         141 :                         plc->qlen = 1;
     382             :                 }
     383             : 
     384         129 :                 goto rewrite;
     385             :         }
     386             : 
     387             : clean_up:
     388             : 
     389        3700 :         while (placeholders) {
     390        1882 :                 plc = placeholders;
     391        1882 :                 placeholders = plc->next;
     392             : 
     393        1882 :                 if (plc->freeq) {
     394         838 :                         efree(plc->quoted);
     395             :                 }
     396             : 
     397        1882 :                 efree(plc);
     398             :         }
     399             : 
     400         909 :         return ret;
     401             : }
     402             : 
     403             : #if 0
     404             : int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery,
     405             :                 int *outquery_len)
     406             : {
     407             :         Scanner s;
     408             :         char *ptr;
     409             :         int t;
     410             :         int bindno = 0;
     411             :         int newbuffer_len;
     412             :         int padding;
     413             :         HashTable *params = stmt->bound_params;
     414             :         struct pdo_bound_param_data *param;
     415             :         /* allocate buffer for query with expanded binds, ptr is our writing pointer */
     416             :         newbuffer_len = inquery_len;
     417             : 
     418             :         /* calculate the possible padding factor due to quoting */
     419             :         if(stmt->dbh->max_escaped_char_length) {
     420             :                 padding = stmt->dbh->max_escaped_char_length;
     421             :         } else {
     422             :                 padding = 3;
     423             :         }
     424             :         if(params) {
     425             :                 ZEND_HASH_FOREACH_PTR(params, param) {
     426             :                         if(param->parameter) {
     427             :                                 convert_to_string(param->parameter);
     428             :                                 /* accommodate a string that needs to be fully quoted
     429             :                    bind placeholders are at least 2 characters, so
     430             :                    the accommodate their own "'s
     431             :                 */
     432             :                                 newbuffer_len += padding * Z_STRLEN_P(param->parameter);
     433             :                         }
     434             :                 } ZEND_HASH_FOREACH_END();
     435             :         }
     436             :         *outquery = (char *) emalloc(newbuffer_len + 1);
     437             :         *outquery_len = 0;
     438             : 
     439             :         ptr = *outquery;
     440             :         s.cur = inquery;
     441             :         while((t = scan(&s)) != PDO_PARSER_EOI) {
     442             :                 if(t == PDO_PARSER_TEXT) {
     443             :                         memcpy(ptr, s.tok, s.cur - s.tok);
     444             :                         ptr += (s.cur - s.tok);
     445             :                         *outquery_len += (s.cur - s.tok);
     446             :                 }
     447             :                 else if(t == PDO_PARSER_BIND) {
     448             :                         if(!params) {
     449             :                                 /* error */
     450             :                                 efree(*outquery);
     451             :                                 *outquery = NULL;
     452             :                                 return (int) (s.cur - inquery);
     453             :                         }
     454             :                         /* lookup bind first via hash and then index */
     455             :                         /* stupid keys need to be null-terminated, even though we know their length */
     456             :                         if((NULL != (param = zend_hash_str_find_ptr(params, s.tok, s.cur-s.tok))
     457             :                             ||
     458             :                            NULL != (params = zend_hash_index_find_ptr(params, bindno)))
     459             :                         {
     460             :                                 char *quotedstr;
     461             :                                 int quotedstrlen;
     462             :                                 /* restore the in-string key, doesn't need null-termination here */
     463             :                                 /* currently everything is a string here */
     464             : 
     465             :                                 /* quote the bind value if necessary */
     466             :                                 if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
     467             :                                         Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen))
     468             :                                 {
     469             :                                         memcpy(ptr, quotedstr, quotedstrlen);
     470             :                                         ptr += quotedstrlen;
     471             :                                         *outquery_len += quotedstrlen;
     472             :                                         efree(quotedstr);
     473             :                                 } else {
     474             :                                         memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
     475             :                                         ptr += Z_STRLEN_P(param->parameter);
     476             :                                         *outquery_len += (Z_STRLEN_P(param->parameter));
     477             :                                 }
     478             :                         }
     479             :                         else {
     480             :                                 /* error and cleanup */
     481             :                                 efree(*outquery);
     482             :                                 *outquery = NULL;
     483             :                                 return (int) (s.cur - inquery);
     484             :                         }
     485             :                         bindno++;
     486             :                 }
     487             :                 else if(t == PDO_PARSER_BIND_POS) {
     488             :                         if(!params) {
     489             :                                 /* error */
     490             :                                 efree(*outquery);
     491             :                                 *outquery = NULL;
     492             :                                 return (int) (s.cur - inquery);
     493             :                         }
     494             :                         /* lookup bind by index */
     495             :                         if(NULL != (params = zend_hash_index_find_ptr(params, bindno)))
     496             :                         {
     497             :                                 char *quotedstr;
     498             :                                 int quotedstrlen;
     499             :                                 /* currently everything is a string here */
     500             : 
     501             :                                 /* quote the bind value if necessary */
     502             :                                 if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
     503             :                                         Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen))
     504             :                                 {
     505             :                                         memcpy(ptr, quotedstr, quotedstrlen);
     506             :                                         ptr += quotedstrlen;
     507             :                                         *outquery_len += quotedstrlen;
     508             :                                         efree(quotedstr);
     509             :                                 } else {
     510             :                                         memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
     511             :                                         ptr += Z_STRLEN_P(param->parameter);
     512             :                                         *outquery_len += (Z_STRLEN_P(param->parameter));
     513             :                                 }
     514             :                         }
     515             :                         else {
     516             :                                 /* error and cleanup */
     517             :                                 efree(*outquery);
     518             :                                 *outquery = NULL;
     519             :                                 return (int) (s.cur - inquery);
     520             :                         }
     521             :                         bindno++;
     522             :                 }
     523             :         }
     524             :         *ptr = '\0';
     525             :         return 0;
     526             : }
     527             : #endif
     528             : 
     529             : /*
     530             :  * Local variables:
     531             :  * tab-width: 4
     532             :  * c-basic-offset: 4
     533             :  * End:
     534             :  * vim600: noet sw=4 ts=4 fdm=marker ft=c
     535             :  * vim<600: noet sw=4 ts=4
     536             :  */

Generated by: LCOV version 1.10

Generated at Fri, 31 Jul 2015 08:59:03 +0000 (2 days ago)

Copyright © 2005-2015 The PHP Group
All rights reserved.