mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
add input/output parameter type flag
This commit is contained in:
parent
504afcfc5a
commit
36e3ea8cb2
@ -222,6 +222,7 @@ PHP_MINIT_FUNCTION(pdo)
|
||||
REGISTER_LONG_CONSTANT("PDO_PARAM_STR", (long)PDO_PARAM_STR, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PDO_PARAM_LOB", (long)PDO_PARAM_LOB, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PDO_PARAM_STMT", (long)PDO_PARAM_STMT, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PDO_PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT, CONST_CS|CONST_PERSISTENT);
|
||||
|
||||
REGISTER_LONG_CONSTANT("PDO_FETCH_LAZY", (long)PDO_FETCH_LAZY, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PDO_FETCH_ASSOC",(long)PDO_FETCH_ASSOC, CONST_CS|CONST_PERSISTENT);
|
||||
|
@ -214,7 +214,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s
|
||||
}
|
||||
}
|
||||
|
||||
if (param->param_type == PDO_PARAM_STR && param->max_value_len <= 0) {
|
||||
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && param->max_value_len <= 0) {
|
||||
convert_to_string(param->parameter);
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno TSRMLS_DC
|
||||
|
||||
stmt->methods->get_col(stmt, colno, &value, &value_len, &caller_frees TSRMLS_CC);
|
||||
|
||||
switch (col->param_type) {
|
||||
switch (PDO_PARAM_TYPE(col->param_type)) {
|
||||
case PDO_PARAM_INT:
|
||||
if (value && value_len == sizeof(long)) {
|
||||
ZVAL_LONG(dest, *(long*)value);
|
||||
|
@ -58,9 +58,15 @@ enum pdo_param_type {
|
||||
PDO_PARAM_STMT, /* hierarchical result set */
|
||||
|
||||
/* get_col ptr should point to a zend_bool */
|
||||
PDO_PARAM_BOOL
|
||||
PDO_PARAM_BOOL,
|
||||
|
||||
|
||||
/* magic flag to denote a parameter as being input/output */
|
||||
PDO_PARAM_INPUT_OUTPUT = 0x80000000
|
||||
};
|
||||
|
||||
#define PDO_PARAM_TYPE(x) ((x) & ~PDO_PARAM_INPUT_OUTPUT)
|
||||
|
||||
enum pdo_fetch_type {
|
||||
PDO_FETCH_USE_DEFAULT,
|
||||
PDO_FETCH_LAZY,
|
||||
|
Loading…
Reference in New Issue
Block a user