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 - ext/pdo_dblib - dblib_stmt.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 0 258 0.0 %
Date: 2022-01-18 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2018 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: Wez Furlong <wez@php.net>                                    |
      16             :   |         Frank M. Kromann <frank@kromann.info>                        |
      17             :   +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : #ifdef HAVE_CONFIG_H
      21             : # include "config.h"
      22             : #endif
      23             : 
      24             : #include "php.h"
      25             : #include "php_ini.h"
      26             : #include "ext/standard/php_string.h"
      27             : #include "ext/standard/info.h"
      28             : #include "pdo/php_pdo.h"
      29             : #include "pdo/php_pdo_driver.h"
      30             : #include "php_pdo_dblib.h"
      31             : #include "php_pdo_dblib_int.h"
      32             : #include "zend_exceptions.h"
      33             : 
      34             : 
      35             : /* {{{ pdo_dblib_get_field_name
      36             :  *
      37             :  * Return the data type name for a given TDS number
      38             :  *
      39             :  */
      40           0 : static char *pdo_dblib_get_field_name(int type)
      41             : {
      42             :         /*
      43             :          * I don't return dbprtype(type) because it does not fully describe the type
      44             :          * (example: varchar is reported as char by dbprtype)
      45             :          *
      46             :          * FIX ME: Cache datatypes from server systypes table in pdo_dblib_handle_factory()
      47             :          *                 to make this future proof.
      48             :          */
      49             : 
      50           0 :         switch (type) {
      51           0 :                 case 31: return "nvarchar";
      52           0 :                 case 34: return "image";
      53           0 :                 case 35: return "text";
      54           0 :                 case 36: return "uniqueidentifier";
      55           0 :                 case 37: return "varbinary"; /* & timestamp - Sybase AS12 */
      56           0 :                 case 38: return "bigint"; /* & bigintn - Sybase AS12 */
      57           0 :                 case 39: return "varchar"; /* & sysname & nvarchar - Sybase AS12 */
      58           0 :                 case 40: return "date";
      59           0 :                 case 41: return "time";
      60           0 :                 case 42: return "datetime2";
      61           0 :                 case 43: return "datetimeoffset";
      62           0 :                 case 45: return "binary"; /* Sybase AS12 */
      63           0 :                 case 47: return "char"; /* & nchar & uniqueidentifierstr Sybase AS12 */
      64           0 :                 case 48: return "tinyint";
      65           0 :                 case 50: return "bit"; /* Sybase AS12 */
      66           0 :                 case 52: return "smallint";
      67           0 :                 case 55: return "decimal"; /* Sybase AS12 */
      68           0 :                 case 56: return "int";
      69           0 :                 case 58: return "smalldatetime";
      70           0 :                 case 59: return "real";
      71           0 :                 case 60: return "money";
      72           0 :                 case 61: return "datetime";
      73           0 :                 case 62: return "float";
      74           0 :                 case 63: return "numeric"; /* or uint, ubigint, usmallint Sybase AS12 */
      75           0 :                 case 98: return "sql_variant";
      76           0 :                 case 99: return "ntext";
      77           0 :                 case 104: return "bit";
      78           0 :                 case 106: return "decimal"; /* decimal n on sybase */
      79           0 :                 case 108: return "numeric"; /* numeric n on sybase */
      80           0 :                 case 122: return "smallmoney";
      81           0 :                 case 127: return "bigint";
      82           0 :                 case 165: return "varbinary";
      83           0 :                 case 167: return "varchar";
      84           0 :                 case 173: return "binary";
      85           0 :                 case 175: return "char";
      86           0 :                 case 189: return "timestamp";
      87           0 :                 case 231: return "nvarchar";
      88           0 :                 case 239: return "nchar";
      89           0 :                 case 240: return "geometry";
      90           0 :                 case 241: return "xml";
      91           0 :                 default: return "unknown";
      92             :         }
      93             : }
      94             : /* }}} */
      95             : 
      96           0 : static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt)
      97             : {
      98           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
      99           0 :         pdo_dblib_db_handle *H = S->H;
     100             : 
     101             :         /* Cancel any pending results */
     102           0 :         dbcancel(H->link);
     103             : 
     104           0 :         pdo_dblib_err_dtor(&H->err);
     105             : 
     106           0 :         return 1;
     107             : }
     108             : 
     109           0 : static int pdo_dblib_stmt_dtor(pdo_stmt_t *stmt)
     110             : {
     111           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     112             : 
     113           0 :         pdo_dblib_err_dtor(&S->err);
     114             : 
     115           0 :         efree(S);
     116             : 
     117           0 :         return 1;
     118             : }
     119             : 
     120           0 : static int pdo_dblib_stmt_next_rowset_no_cancel(pdo_stmt_t *stmt)
     121             : {
     122           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     123           0 :         pdo_dblib_db_handle *H = S->H;
     124             :         RETCODE ret;
     125             :         int num_fields;
     126             : 
     127             :         do {
     128           0 :                 ret = dbresults(H->link);
     129           0 :                 num_fields = dbnumcols(H->link);
     130           0 :         } while (H->skip_empty_rowsets && num_fields <= 0 && ret == SUCCEED);
     131             : 
     132             : 
     133           0 :         if (FAIL == ret) {
     134           0 :                 pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbresults() returned FAIL");
     135           0 :                 return 0;
     136             :         }
     137             : 
     138           0 :         if (NO_MORE_RESULTS == ret) {
     139           0 :                 return 0;
     140             :         }
     141             : 
     142           0 :         if (H->skip_empty_rowsets && num_fields <= 0) {
     143           0 :                 return 0;
     144             :         }
     145             : 
     146           0 :         stmt->row_count = DBCOUNT(H->link);
     147           0 :         stmt->column_count = num_fields;
     148             : 
     149           0 :         return 1;
     150             : }
     151             : 
     152           0 : static int pdo_dblib_stmt_next_rowset(pdo_stmt_t *stmt)
     153             : {
     154           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     155           0 :         pdo_dblib_db_handle *H = S->H;
     156           0 :         RETCODE ret = SUCCESS;
     157             : 
     158             :         /* Ideally use dbcanquery here, but there is a bug in FreeTDS's implementation of dbcanquery
     159             :          * It has been resolved but is currently only available in nightly builds
     160             :          */
     161           0 :         while (NO_MORE_ROWS != ret) {
     162           0 :                 ret = dbnextrow(H->link);
     163             : 
     164           0 :                 if (FAIL == ret) {
     165           0 :                         pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbnextrow() returned FAIL");
     166           0 :                         return 0;
     167             :                 }
     168             :         }
     169             : 
     170           0 :         return pdo_dblib_stmt_next_rowset_no_cancel(stmt);
     171             : }
     172             : 
     173           0 : static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt)
     174             : {
     175           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     176           0 :         pdo_dblib_db_handle *H = S->H;
     177             : 
     178           0 :         dbsetuserdata(H->link, (BYTE*) &S->err);
     179             : 
     180           0 :         pdo_dblib_stmt_cursor_closer(stmt);
     181             : 
     182           0 :         if (FAIL == dbcmd(H->link, stmt->active_query_string)) {
     183           0 :                 return 0;
     184             :         }
     185             : 
     186           0 :         if (FAIL == dbsqlexec(H->link)) {
     187           0 :                 return 0;
     188             :         }
     189             : 
     190           0 :         pdo_dblib_stmt_next_rowset_no_cancel(stmt);
     191             : 
     192           0 :         stmt->row_count = DBCOUNT(H->link);
     193           0 :         stmt->column_count = dbnumcols(H->link);
     194             : 
     195           0 :         return 1;
     196             : }
     197             : 
     198           0 : static int pdo_dblib_stmt_fetch(pdo_stmt_t *stmt,
     199             :         enum pdo_fetch_orientation ori, zend_long offset)
     200             : {
     201             : 
     202             :         RETCODE ret;
     203             : 
     204           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     205           0 :         pdo_dblib_db_handle *H = S->H;
     206             : 
     207           0 :         ret = dbnextrow(H->link);
     208             : 
     209           0 :         if (FAIL == ret) {
     210           0 :                 pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbnextrow() returned FAIL");
     211           0 :                 return 0;
     212             :         }
     213             : 
     214           0 :         if(NO_MORE_ROWS == ret) {
     215           0 :                 return 0;
     216             :         }
     217             : 
     218           0 :         return 1;
     219             : }
     220             : 
     221           0 : static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno)
     222             : {
     223           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     224           0 :         pdo_dblib_db_handle *H = S->H;
     225             :         struct pdo_column_data *col;
     226             :         char *fname;
     227             : 
     228           0 :         if(colno >= stmt->column_count || colno < 0)  {
     229           0 :                 return FAILURE;
     230             :         }
     231             : 
     232           0 :         if (colno == 0) {
     233           0 :                 S->computed_column_name_count = 0;
     234             :         }
     235             : 
     236           0 :         col = &stmt->columns[colno];
     237           0 :         fname = (char*)dbcolname(H->link, colno+1);
     238             : 
     239           0 :         if (fname && *fname) {
     240           0 :                 col->name =  zend_string_init(fname, strlen(fname), 0);
     241             :         } else {
     242           0 :                 if (S->computed_column_name_count > 0) {
     243             :                         char buf[16];
     244             :                         int len;
     245             : 
     246           0 :                         len = snprintf(buf, sizeof(buf), "computed%d", S->computed_column_name_count);
     247           0 :                         col->name = zend_string_init(buf, len, 0);
     248             :                 } else {
     249           0 :                         col->name = zend_string_init("computed", strlen("computed"), 0);
     250             :                 }
     251             : 
     252           0 :                 S->computed_column_name_count++;
     253             :         }
     254             : 
     255           0 :         col->maxlen = dbcollen(H->link, colno+1);
     256           0 :         col->param_type = PDO_PARAM_ZVAL;
     257             : 
     258           0 :         return 1;
     259             : }
     260             : 
     261           0 : static int pdo_dblib_stmt_should_stringify_col(pdo_stmt_t *stmt, int coltype)
     262             : {
     263           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     264           0 :         pdo_dblib_db_handle *H = S->H;
     265             : 
     266           0 :         switch (coltype) {
     267           0 :                 case SQLDECIMAL:
     268             :                 case SQLNUMERIC:
     269             :                 case SQLMONEY:
     270             :                 case SQLMONEY4:
     271             :                 case SQLMONEYN:
     272             :                 case SQLFLT4:
     273             :                 case SQLFLT8:
     274             :                 case SQLINT4:
     275             :                 case SQLINT2:
     276             :                 case SQLINT1:
     277             :                 case SQLBIT:
     278           0 :                         if (stmt->dbh->stringify) {
     279           0 :                                 return 1;
     280             :                         }
     281           0 :                         break;
     282             : 
     283           0 :                 case SQLINT8:
     284           0 :                         if (stmt->dbh->stringify) {
     285           0 :                                 return 1;
     286             :                         }
     287             : 
     288             :                         /* force stringify if DBBIGINT won't fit in zend_long */
     289             :                         /* this should only be an issue for 32-bit machines */
     290             :                         if (sizeof(zend_long) < sizeof(DBBIGINT)) {
     291             :                                 return 1;
     292             :                         }
     293           0 :                         break;
     294             : 
     295             : #ifdef SQLMSDATETIME2
     296             :                 case SQLMSDATETIME2:
     297             : #endif
     298           0 :                 case SQLDATETIME:
     299             :                 case SQLDATETIM4:
     300           0 :                         if (H->datetime_convert) {
     301           0 :                                 return 1;
     302             :                         }
     303           0 :                         break;
     304             :         }
     305             : 
     306           0 :         return 0;
     307             : }
     308             : 
     309           0 : static void pdo_dblib_stmt_stringify_col(int coltype, LPBYTE data, DBINT data_len, zval **ptr)
     310             : {
     311             :         DBCHAR *tmp_data;
     312             :         DBINT tmp_data_len;
     313             :         zval *zv;
     314             : 
     315             :         /* FIXME: We allocate more than we need here */
     316           0 :         tmp_data_len = 32 + (2 * (data_len));
     317             : 
     318           0 :         switch (coltype) {
     319           0 :                 case SQLDATETIME:
     320             :                 case SQLDATETIM4: {
     321           0 :                         if (tmp_data_len < DATETIME_MAX_LEN) {
     322           0 :                                 tmp_data_len = DATETIME_MAX_LEN;
     323             :                         }
     324           0 :                         break;
     325             :                 }
     326             :         }
     327             : 
     328           0 :         tmp_data = emalloc(tmp_data_len);
     329           0 :         data_len = dbconvert(NULL, coltype, data, data_len, SQLCHAR, (LPBYTE) tmp_data, tmp_data_len);
     330             : 
     331           0 :         zv = emalloc(sizeof(zval));
     332           0 :         if (data_len > 0) {
     333             :                 /* to prevent overflows, tmp_data_len is provided as a dest len for dbconvert()
     334             :                  * this code previously passed a dest len of -1
     335             :                  * the FreeTDS impl of dbconvert() does an rtrim with that value, so replicate that behavior
     336             :                  */
     337           0 :                 while (data_len > 0 && tmp_data[data_len - 1] == ' ') {
     338           0 :                         data_len--;
     339             :                 }
     340             : 
     341           0 :                 ZVAL_STRINGL(zv, tmp_data, data_len);
     342             :         } else {
     343           0 :                 ZVAL_EMPTY_STRING(zv);
     344             :         }
     345             : 
     346           0 :         efree(tmp_data);
     347             : 
     348           0 :         *ptr = zv;
     349           0 : }
     350             : 
     351           0 : static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
     352             :          zend_ulong *len, int *caller_frees)
     353             : {
     354             : 
     355           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     356           0 :         pdo_dblib_db_handle *H = S->H;
     357             : 
     358             :         int coltype;
     359             :         LPBYTE data;
     360             :         DBCHAR *tmp_data;
     361             :         DBINT data_len, tmp_data_len;
     362           0 :         zval *zv = NULL;
     363             : 
     364           0 :         coltype = dbcoltype(H->link, colno+1);
     365           0 :         data = dbdata(H->link, colno+1);
     366           0 :         data_len = dbdatlen(H->link, colno+1);
     367             : 
     368           0 :         if (data_len != 0 || data != NULL) {
     369           0 :                 if (pdo_dblib_stmt_should_stringify_col(stmt, coltype) && dbwillconvert(coltype, SQLCHAR)) {
     370           0 :                         pdo_dblib_stmt_stringify_col(coltype, data, data_len, &zv);
     371             :                 }
     372             : 
     373           0 :                 if (!zv) {
     374           0 :                         switch (coltype) {
     375           0 :                                 case SQLCHAR:
     376             :                                 case SQLVARCHAR:
     377             :                                 case SQLTEXT: {
     378             : #if ilia_0
     379             :                                         while (data_len>0 && data[data_len-1] == ' ') { /* nuke trailing whitespace */
     380             :                                                 data_len--;
     381             :                                         }
     382             : #endif
     383             :                                 }
     384             :                                 case SQLVARBINARY:
     385             :                                 case SQLBINARY:
     386             :                                 case SQLIMAGE: {
     387           0 :                                         zv = emalloc(sizeof(zval));
     388           0 :                                         ZVAL_STRINGL(zv, (DBCHAR *) data, data_len);
     389             : 
     390           0 :                                         break;
     391             :                                 }
     392             : #ifdef SQLMSDATETIME2
     393             :                                 case SQLMSDATETIME2:
     394             : #endif
     395           0 :                                 case SQLDATETIME:
     396             :                                 case SQLDATETIM4: {
     397             :                                         size_t dl;
     398             :                                         DBDATEREC di;
     399             :                                         DBDATEREC dt;
     400             : 
     401           0 :                                         dbconvert(H->link, coltype, data, -1, SQLDATETIME, (LPBYTE) &dt, -1);
     402           0 :                                         dbdatecrack(H->link, &di, (DBDATETIME *) &dt);
     403             : 
     404           0 :                                         dl = spprintf(&tmp_data, 20, "%04d-%02d-%02d %02d:%02d:%02d",
     405             : #if defined(PHP_DBLIB_IS_MSSQL) || defined(MSDBLIB)
     406             :                                                         di.year,     di.month,       di.day,        di.hour,     di.minute,     di.second
     407             : #else
     408             :                                                         di.dateyear, di.datemonth+1, di.datedmonth, di.datehour, di.dateminute, di.datesecond
     409             : #endif
     410             :                                         );
     411             : 
     412           0 :                                         zv = emalloc(sizeof(zval));
     413           0 :                                         ZVAL_STRINGL(zv, tmp_data, dl);
     414             : 
     415           0 :                                         efree(tmp_data);
     416             : 
     417           0 :                                         break;
     418             :                                 }
     419           0 :                                 case SQLFLT4: {
     420           0 :                                         zv = emalloc(sizeof(zval));
     421           0 :                                         ZVAL_DOUBLE(zv, *(DBFLT4 *) data);
     422             : 
     423           0 :                                         break;
     424             :                                 }
     425           0 :                                 case SQLFLT8: {
     426           0 :                                         zv = emalloc(sizeof(zval));
     427           0 :                                         ZVAL_DOUBLE(zv, *(DBFLT8 *) data);
     428             : 
     429           0 :                                         break;
     430             :                                 }
     431           0 :                                 case SQLINT8: {
     432           0 :                                         zv = emalloc(sizeof(zval));
     433           0 :                                         ZVAL_LONG(zv, *(DBBIGINT *) data);
     434             : 
     435           0 :                                         break;
     436             :                                 }
     437           0 :                                 case SQLINT4: {
     438           0 :                                         zv = emalloc(sizeof(zval));
     439           0 :                                         ZVAL_LONG(zv, *(DBINT *) data);
     440             : 
     441           0 :                                         break;
     442             :                                 }
     443           0 :                                 case SQLINT2: {
     444           0 :                                         zv = emalloc(sizeof(zval));
     445           0 :                                         ZVAL_LONG(zv, *(DBSMALLINT *) data);
     446             : 
     447           0 :                                         break;
     448             :                                 }
     449           0 :                                 case SQLINT1:
     450             :                                 case SQLBIT: {
     451           0 :                                         zv = emalloc(sizeof(zval));
     452           0 :                                         ZVAL_LONG(zv, *(DBTINYINT *) data);
     453             : 
     454           0 :                                         break;
     455             :                                 }
     456           0 :                                 case SQLDECIMAL:
     457             :                                 case SQLNUMERIC:
     458             :                                 case SQLMONEY:
     459             :                                 case SQLMONEY4:
     460             :                                 case SQLMONEYN: {
     461             :                                         DBFLT8 float_value;
     462           0 :                                         dbconvert(NULL, coltype, data, 8, SQLFLT8, (LPBYTE) &float_value, -1);
     463             : 
     464           0 :                                         zv = emalloc(sizeof(zval));
     465           0 :                                         ZVAL_DOUBLE(zv, float_value);
     466             : 
     467           0 :                                         break;
     468             :                                 }
     469             : 
     470           0 :                                 case SQLUNIQUE: {
     471           0 :                                         if (H->stringify_uniqueidentifier) {
     472             :                                                 /* 36-char hex string representation */
     473           0 :                                                 tmp_data_len = 36;
     474           0 :                                                 tmp_data = safe_emalloc(tmp_data_len, sizeof(char), 1);
     475           0 :                                                 data_len = dbconvert(NULL, SQLUNIQUE, data, data_len, SQLCHAR, (LPBYTE) tmp_data, tmp_data_len);
     476           0 :                                                 php_strtoupper(tmp_data, data_len);
     477           0 :                                                 zv = emalloc(sizeof(zval));
     478           0 :                                                 ZVAL_STRINGL(zv, tmp_data, data_len);
     479           0 :                                                 efree(tmp_data);
     480             :                                         } else {
     481             :                                                 /* 16-byte binary representation */
     482           0 :                                                 zv = emalloc(sizeof(zval));
     483           0 :                                                 ZVAL_STRINGL(zv, (DBCHAR *) data, 16);
     484             :                                         }
     485           0 :                                         break;
     486             :                                 }
     487             : 
     488           0 :                                 default: {
     489           0 :                                         if (dbwillconvert(coltype, SQLCHAR)) {
     490           0 :                                                 pdo_dblib_stmt_stringify_col(coltype, data, data_len, &zv);
     491             :                                         }
     492             : 
     493           0 :                                         break;
     494             :                                 }
     495             :                         }
     496           0 :                 }
     497             :         }
     498             : 
     499           0 :         if (zv != NULL) {
     500           0 :                 *ptr = (char*)zv;
     501           0 :                 *len = sizeof(zval);
     502             :         } else {
     503           0 :                 *ptr = NULL;
     504           0 :                 *len = 0;
     505             :         }
     506             : 
     507           0 :         *caller_frees = 1;
     508             : 
     509           0 :         return 1;
     510             : }
     511             : 
     512           0 : static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value)
     513             : {
     514           0 :         pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
     515           0 :         pdo_dblib_db_handle *H = S->H;
     516             :         DBTYPEINFO* dbtypeinfo;
     517             :         int coltype;
     518             : 
     519           0 :         if(colno >= stmt->column_count || colno < 0)  {
     520           0 :                 return FAILURE;
     521             :         }
     522             : 
     523           0 :         array_init(return_value);
     524             : 
     525           0 :         dbtypeinfo = dbcoltypeinfo(H->link, colno+1);
     526             : 
     527           0 :         if(!dbtypeinfo) return FAILURE;
     528             : 
     529           0 :         coltype = dbcoltype(H->link, colno+1);
     530             : 
     531           0 :         add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) );
     532           0 :         add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision );
     533           0 :         add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale );
     534           0 :         add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1));
     535           0 :         add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(coltype));
     536           0 :         add_assoc_long(return_value, "native_type_id", coltype);
     537           0 :         add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1));
     538             : 
     539           0 :         switch (coltype) {
     540           0 :                 case SQLBIT:
     541             :                 case SQLINT1:
     542             :                 case SQLINT2:
     543             :                 case SQLINT4:
     544           0 :                         add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT);
     545           0 :                         break;
     546           0 :                 default:
     547           0 :                         add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR);
     548           0 :                         break;
     549             :         }
     550             : 
     551           0 :         return 1;
     552             : }
     553             : 
     554             : 
     555             : const struct pdo_stmt_methods dblib_stmt_methods = {
     556             :         pdo_dblib_stmt_dtor,
     557             :         pdo_dblib_stmt_execute,
     558             :         pdo_dblib_stmt_fetch,
     559             :         pdo_dblib_stmt_describe,
     560             :         pdo_dblib_stmt_get_col,
     561             :         NULL, /* param hook */
     562             :         NULL, /* set attr */
     563             :         NULL, /* get attr */
     564             :         pdo_dblib_stmt_get_column_meta, /* meta */
     565             :         pdo_dblib_stmt_next_rowset, /* nextrow */
     566             :         pdo_dblib_stmt_cursor_closer
     567             : };

Generated by: LCOV version 1.10

Generated at Wed, 19 Jan 2022 00:14:19 +0000 (3 days ago)

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