Lines Matching refs:var
70 XSQLVAR const *var = &sqlda->sqlvar[i]; in free_sqlda() local
72 if (var->sqlind) { in free_sqlda()
73 efree(var->sqlind); in free_sqlda()
127 XSQLVAR *var = &S->out_sqlda.sqlvar[i]; in firebird_stmt_execute() local
128 if (var->sqlind) { in firebird_stmt_execute()
129 efree(var->sqlind); in firebird_stmt_execute()
131 var->sqlind = (void*)ecalloc(1, var->sqllen + 2 * sizeof(short)); in firebird_stmt_execute()
132 var->sqldata = &((char*)var->sqlind)[sizeof(short)]; in firebird_stmt_execute()
234 XSQLVAR *var = &S->out_sqlda.sqlvar[colno]; in firebird_stmt_describe() local
238 colname_len = (S->H->fetch_table_names && var->relname_length) in firebird_stmt_describe()
239 ? (var->aliasname_length + var->relname_length + 1) in firebird_stmt_describe()
240 : (var->aliasname_length); in firebird_stmt_describe()
241 col->precision = -var->sqlscale; in firebird_stmt_describe()
242 col->maxlen = var->sqllen; in firebird_stmt_describe()
245 if (colname_len > var->aliasname_length) { in firebird_stmt_describe()
246 memmove(cp, var->relname, var->relname_length); in firebird_stmt_describe()
247 cp += var->relname_length; in firebird_stmt_describe()
250 memmove(cp, var->aliasname, var->aliasname_length); in firebird_stmt_describe()
251 *(cp+var->aliasname_length) = '\0'; in firebird_stmt_describe()
260 XSQLVAR *var = &S->out_sqlda.sqlvar[colno]; in firebird_stmt_get_column_meta() local
263 if (var->sqlscale < 0) { in firebird_stmt_get_column_meta()
266 switch (var->sqltype & ~1) { in firebird_stmt_get_column_meta()
380 XSQLVAR const *var = &S->out_sqlda.sqlvar[colno]; in firebird_stmt_get_col() local
382 if (*var->sqlind == -1) { in firebird_stmt_get_col()
385 if (var->sqlscale < 0) { in firebird_stmt_get_col()
403 ISC_INT64 n, f = scales[-var->sqlscale]; in firebird_stmt_get_col()
406 switch (var->sqltype & ~1) { in firebird_stmt_get_col()
408 n = *(short*)var->sqldata; in firebird_stmt_get_col()
411 n = get_isc_long_from_sqldata(var->sqldata); in firebird_stmt_get_col()
414 n = get_isc_int64_from_sqldata(var->sqldata); in firebird_stmt_get_col()
421 if ((var->sqltype & ~1) == SQL_DOUBLE) { in firebird_stmt_get_col()
422 str = zend_strpprintf(0, "%.*F", -var->sqlscale, get_double_from_sqldata(var->sqldata)); in firebird_stmt_get_col()
425 n / f, -var->sqlscale, n % f); in firebird_stmt_get_col()
428 n / f, -var->sqlscale, -n % f); in firebird_stmt_get_col()
430 str = zend_strpprintf(0, "-0.%0*" LL_MASK "d", -var->sqlscale, -n % f); in firebird_stmt_get_col()
434 switch (var->sqltype & ~1) { in firebird_stmt_get_col()
439 ZVAL_STRINGL_FAST(result, &var->sqldata[2], *(short*)var->sqldata); in firebird_stmt_get_col()
442 ZVAL_STRINGL_FAST(result, var->sqldata, var->sqllen); in firebird_stmt_get_col()
445 ZVAL_LONG(result, *(short*)var->sqldata); in firebird_stmt_get_col()
448 ZVAL_LONG(result, get_isc_long_from_sqldata(var->sqldata)); in firebird_stmt_get_col()
452 ZVAL_LONG(result, get_isc_int64_from_sqldata(var->sqldata)); in firebird_stmt_get_col()
454 … ZVAL_STR(result, zend_strpprintf(0, "%" LL_MASK "d", get_isc_int64_from_sqldata(var->sqldata))); in firebird_stmt_get_col()
459 ZVAL_STR(result, zend_strpprintf(0, "%F", *(float*)var->sqldata)); in firebird_stmt_get_col()
463 ZVAL_STR(result, zend_strpprintf(0, "%F", get_double_from_sqldata(var->sqldata))); in firebird_stmt_get_col()
467 ZVAL_BOOL(result, *(FB_BOOLEAN*)var->sqldata); in firebird_stmt_get_col()
471 isc_decode_sql_date((ISC_DATE*)var->sqldata, &t); in firebird_stmt_get_col()
475 isc_decode_sql_time((ISC_TIME*)var->sqldata, &t); in firebird_stmt_get_col()
480 ISC_TIMESTAMP timestamp = get_isc_timestamp_from_sqldata(var->sqldata); in firebird_stmt_get_col()
491 ISC_QUAD quad = get_isc_quad_from_sqldata(var->sqldata); in firebird_stmt_get_col()
547 XSQLVAR *var; in firebird_stmt_param_hook() local
569 XSQLVAR *var = &sqlda->sqlvar[i]; in firebird_stmt_param_hook() local
571 if ((var->aliasname_length && !strncasecmp(ZSTR_VAL(param->name), var->aliasname, in firebird_stmt_param_hook()
572 min(ZSTR_LEN(param->name), var->aliasname_length))) in firebird_stmt_param_hook()
573 || (var->sqlname_length && !strncasecmp(ZSTR_VAL(param->name), var->sqlname, in firebird_stmt_param_hook()
574 min(ZSTR_LEN(param->name), var->sqlname_length)))) { in firebird_stmt_param_hook()
587 var = &sqlda->sqlvar[param->paramno]; in firebird_stmt_param_hook()
595 if (var->sqlind) { in firebird_stmt_param_hook()
596 efree(var->sqlind); in firebird_stmt_param_hook()
598 var->sqlind = (void*)emalloc(var->sqllen + 2*sizeof(short)); in firebird_stmt_param_hook()
599 var->sqldata = &((char*)var->sqlind)[sizeof(short)]; in firebird_stmt_param_hook()
608 *var->sqlind = 0; in firebird_stmt_param_hook()
629 switch (var->sqltype & ~1) { in firebird_stmt_param_hook()
638 if (~var->sqltype & 1) { in firebird_stmt_param_hook()
643 *var->sqlind = -1; in firebird_stmt_param_hook()
646 ISC_QUAD quad = get_isc_quad_from_sqldata(var->sqldata); in firebird_stmt_param_hook()
648 memcpy(var->sqldata, &quad, sizeof(quad)); in firebird_stmt_param_hook()
657 if ((var->sqltype & ~1) == SQL_BOOLEAN) { in firebird_stmt_param_hook()
663 *(FB_BOOLEAN*)var->sqldata = zend_is_true(parameter) ? FB_TRUE : FB_FALSE; in firebird_stmt_param_hook()
671 *(FB_BOOLEAN*)var->sqldata = FB_FALSE; in firebird_stmt_param_hook()
677 *(FB_BOOLEAN*)var->sqldata = (lval != 0) ? FB_TRUE : FB_FALSE; in firebird_stmt_param_hook()
680 *(FB_BOOLEAN*)var->sqldata = (dval != 0) ? FB_TRUE : FB_FALSE; in firebird_stmt_param_hook()
684 *(FB_BOOLEAN*)var->sqldata = FB_TRUE; in firebird_stmt_param_hook()
686 *(FB_BOOLEAN*)var->sqldata = FB_FALSE; in firebird_stmt_param_hook()
697 *var->sqlind = -1; in firebird_stmt_param_hook()
715 var->sqltype = (sizeof(zend_long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); in firebird_stmt_param_hook()
716 var->sqldata = (void*)&Z_LVAL_P(parameter); in firebird_stmt_param_hook()
717 var->sqllen = sizeof(zend_long); in firebird_stmt_param_hook()
721 var->sqltype = SQL_DOUBLE | (var->sqltype & 1); in firebird_stmt_param_hook()
722 var->sqldata = (void*)&Z_DVAL_P(parameter); in firebird_stmt_param_hook()
723 var->sqllen = sizeof(double); in firebird_stmt_param_hook()
729 switch (var->sqltype & ~1) { in firebird_stmt_param_hook()
742 var->sqltype = SQL_TEXT | (var->sqltype & 1); in firebird_stmt_param_hook()
743 var->sqldata = Z_STRVAL_P(parameter); in firebird_stmt_param_hook()
744 var->sqllen = Z_STRLEN_P(parameter); in firebird_stmt_param_hook()
750 if (~var->sqltype & 1) { in firebird_stmt_param_hook()
755 *var->sqlind = -1; in firebird_stmt_param_hook()