Lines Matching refs:var
75 XSQLVAR const *var = &sqlda->sqlvar[i]; in free_sqlda() local
77 if (var->sqlind) { in free_sqlda()
78 efree(var->sqlind); in free_sqlda()
132 XSQLVAR *var = &S->out_sqlda.sqlvar[i]; in firebird_stmt_execute() local
133 if (var->sqlind) { in firebird_stmt_execute()
134 efree(var->sqlind); in firebird_stmt_execute()
136 var->sqlind = (void*)ecalloc(1, var->sqllen + 2 * sizeof(short)); in firebird_stmt_execute()
137 var->sqldata = &((char*)var->sqlind)[sizeof(short)]; in firebird_stmt_execute()
239 XSQLVAR *var = &S->out_sqlda.sqlvar[colno]; in firebird_stmt_describe() local
243 if ((var->sqltype & ~1) == SQL_TEXT) { in firebird_stmt_describe()
244 var->sqltype = SQL_VARYING | (var->sqltype & 1); in firebird_stmt_describe()
246 colname_len = (S->H->fetch_table_names && var->relname_length) in firebird_stmt_describe()
247 ? (var->aliasname_length + var->relname_length + 1) in firebird_stmt_describe()
248 : (var->aliasname_length); in firebird_stmt_describe()
249 col->precision = -var->sqlscale; in firebird_stmt_describe()
250 col->maxlen = var->sqllen; in firebird_stmt_describe()
253 if (colname_len > var->aliasname_length) { in firebird_stmt_describe()
254 memmove(cp, var->relname, var->relname_length); in firebird_stmt_describe()
255 cp += var->relname_length; in firebird_stmt_describe()
258 memmove(cp, var->aliasname, var->aliasname_length); in firebird_stmt_describe()
259 *(cp+var->aliasname_length) = '\0'; in firebird_stmt_describe()
268 XSQLVAR *var = &S->out_sqlda.sqlvar[colno]; in firebird_stmt_get_column_meta() local
271 if (var->sqlscale < 0) { in firebird_stmt_get_column_meta()
274 switch (var->sqltype & ~1) { in firebird_stmt_get_column_meta()
388 XSQLVAR const *var = &S->out_sqlda.sqlvar[colno]; in firebird_stmt_get_col() local
390 if (*var->sqlind == -1) { in firebird_stmt_get_col()
393 if (var->sqlscale < 0) { in firebird_stmt_get_col()
411 ISC_INT64 n, f = scales[-var->sqlscale]; in firebird_stmt_get_col()
414 switch (var->sqltype & ~1) { in firebird_stmt_get_col()
416 n = *(short*)var->sqldata; in firebird_stmt_get_col()
419 n = get_isc_long_from_sqldata(var->sqldata); in firebird_stmt_get_col()
422 n = get_isc_int64_from_sqldata(var->sqldata); in firebird_stmt_get_col()
429 if ((var->sqltype & ~1) == SQL_DOUBLE) { in firebird_stmt_get_col()
430 str = zend_strpprintf(0, "%.*F", -var->sqlscale, get_double_from_sqldata(var->sqldata)); in firebird_stmt_get_col()
433 n / f, -var->sqlscale, n % f); in firebird_stmt_get_col()
436 n / f, -var->sqlscale, -n % f); in firebird_stmt_get_col()
438 str = zend_strpprintf(0, "-0.%0*" LL_MASK "d", -var->sqlscale, -n % f); in firebird_stmt_get_col()
442 switch (var->sqltype & ~1) { in firebird_stmt_get_col()
447 ZVAL_STRINGL_FAST(result, &var->sqldata[2], *(short*)var->sqldata); in firebird_stmt_get_col()
450 ZVAL_STRINGL_FAST(result, var->sqldata, var->sqllen); in firebird_stmt_get_col()
453 ZVAL_LONG(result, *(short*)var->sqldata); in firebird_stmt_get_col()
456 ZVAL_LONG(result, get_isc_long_from_sqldata(var->sqldata)); in firebird_stmt_get_col()
460 ZVAL_LONG(result, get_isc_int64_from_sqldata(var->sqldata)); in firebird_stmt_get_col()
462 … ZVAL_STR(result, zend_strpprintf(0, "%" LL_MASK "d", get_isc_int64_from_sqldata(var->sqldata))); in firebird_stmt_get_col()
467 ZVAL_STR(result, zend_strpprintf_unchecked(0, "%.8H", get_float_from_sqldata(var->sqldata))); in firebird_stmt_get_col()
471 ZVAL_STR(result, zend_strpprintf_unchecked(0, "%.16H", get_double_from_sqldata(var->sqldata))); in firebird_stmt_get_col()
475 ZVAL_BOOL(result, *(FB_BOOLEAN*)var->sqldata); in firebird_stmt_get_col()
479 isc_decode_sql_date((ISC_DATE*)var->sqldata, &t); in firebird_stmt_get_col()
483 isc_decode_sql_time((ISC_TIME*)var->sqldata, &t); in firebird_stmt_get_col()
488 ISC_TIMESTAMP timestamp = get_isc_timestamp_from_sqldata(var->sqldata); in firebird_stmt_get_col()
499 ISC_QUAD quad = get_isc_quad_from_sqldata(var->sqldata); in firebird_stmt_get_col()
555 XSQLVAR *var; in firebird_stmt_param_hook() local
577 XSQLVAR *var = &sqlda->sqlvar[i]; in firebird_stmt_param_hook() local
579 if ((var->aliasname_length && !strncasecmp(ZSTR_VAL(param->name), var->aliasname, in firebird_stmt_param_hook()
580 min(ZSTR_LEN(param->name), var->aliasname_length))) in firebird_stmt_param_hook()
581 || (var->sqlname_length && !strncasecmp(ZSTR_VAL(param->name), var->sqlname, in firebird_stmt_param_hook()
582 min(ZSTR_LEN(param->name), var->sqlname_length)))) { in firebird_stmt_param_hook()
595 var = &sqlda->sqlvar[param->paramno]; in firebird_stmt_param_hook()
603 if (var->sqlind) { in firebird_stmt_param_hook()
604 efree(var->sqlind); in firebird_stmt_param_hook()
606 var->sqlind = (void*)emalloc(var->sqllen + 2*sizeof(short)); in firebird_stmt_param_hook()
607 var->sqldata = &((char*)var->sqlind)[sizeof(short)]; in firebird_stmt_param_hook()
616 *var->sqlind = 0; in firebird_stmt_param_hook()
637 switch (var->sqltype & ~1) { in firebird_stmt_param_hook()
646 if (~var->sqltype & 1) { in firebird_stmt_param_hook()
651 *var->sqlind = -1; in firebird_stmt_param_hook()
654 ISC_QUAD quad = get_isc_quad_from_sqldata(var->sqldata); in firebird_stmt_param_hook()
656 memcpy(var->sqldata, &quad, sizeof(quad)); in firebird_stmt_param_hook()
665 if ((var->sqltype & ~1) == SQL_BOOLEAN) { in firebird_stmt_param_hook()
671 *(FB_BOOLEAN*)var->sqldata = zend_is_true(parameter) ? FB_TRUE : FB_FALSE; in firebird_stmt_param_hook()
679 *(FB_BOOLEAN*)var->sqldata = FB_FALSE; in firebird_stmt_param_hook()
685 *(FB_BOOLEAN*)var->sqldata = (lval != 0) ? FB_TRUE : FB_FALSE; in firebird_stmt_param_hook()
688 *(FB_BOOLEAN*)var->sqldata = (dval != 0) ? FB_TRUE : FB_FALSE; in firebird_stmt_param_hook()
692 *(FB_BOOLEAN*)var->sqldata = FB_TRUE; in firebird_stmt_param_hook()
694 *(FB_BOOLEAN*)var->sqldata = FB_FALSE; in firebird_stmt_param_hook()
705 *var->sqlind = -1; in firebird_stmt_param_hook()
723 var->sqltype = (sizeof(zend_long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); in firebird_stmt_param_hook()
724 var->sqldata = (void*)&Z_LVAL_P(parameter); in firebird_stmt_param_hook()
725 var->sqllen = sizeof(zend_long); in firebird_stmt_param_hook()
729 var->sqltype = SQL_DOUBLE | (var->sqltype & 1); in firebird_stmt_param_hook()
730 var->sqldata = (void*)&Z_DVAL_P(parameter); in firebird_stmt_param_hook()
731 var->sqllen = sizeof(double); in firebird_stmt_param_hook()
737 switch (var->sqltype & ~1) { in firebird_stmt_param_hook()
750 var->sqltype = SQL_TEXT | (var->sqltype & 1); in firebird_stmt_param_hook()
751 var->sqldata = Z_STRVAL_P(parameter); in firebird_stmt_param_hook()
752 var->sqllen = Z_STRLEN_P(parameter); in firebird_stmt_param_hook()
758 if (~var->sqltype & 1) { in firebird_stmt_param_hook()
763 *var->sqlind = -1; in firebird_stmt_param_hook()