diff options
Diffstat (limited to 'ext/pdo_firebird/firebird_statement.c')
-rw-r--r-- | ext/pdo_firebird/firebird_statement.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 5c3e435f7..2b57cd8ba 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -344,7 +344,7 @@ static int firebird_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, /* {{ if (n >= 0) { *len = slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK "d.%0*" LL_MASK "d", n / f, -var->sqlscale, n % f); - } else if (n < -f) { + } else if (n <= -f) { *len = slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK "d.%0*" LL_MASK "d", n / f, -var->sqlscale, -n % f); } else { @@ -535,12 +535,14 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat int force_null; case IS_LONG: - var->sqltype = sizeof(long) == 8 ? SQL_INT64 : SQL_LONG; + /* keep the allow-NULL flag */ + var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); var->sqldata = (void*)&Z_LVAL_P(param->parameter); var->sqllen = sizeof(long); break; case IS_DOUBLE: - var->sqltype = SQL_DOUBLE; + /* keep the allow-NULL flag */ + var->sqltype = SQL_DOUBLE | (var->sqltype & 1); var->sqldata = (void*)&Z_DVAL_P(param->parameter); var->sqllen = sizeof(double); break; @@ -560,7 +562,8 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat force_null = (Z_STRLEN_P(param->parameter) == 0); } if (!force_null) { - var->sqltype = SQL_TEXT; + /* keep the allow-NULL flag */ + var->sqltype = SQL_TEXT | (var->sqltype & 1); var->sqldata = Z_STRVAL_P(param->parameter); var->sqllen = Z_STRLEN_P(param->parameter); break; |