*** mysql_statement.c 2010-04-15 16:31:01.000000000 +0800
--- mysql_statement.c.new 2010-04-15 16:30:47.000000000 +0800
***************
*** 712,718 ****
} else
#endif
{
! cols[i].param_type = PDO_PARAM_STR;
}
}
PDO_DBG_RETURN(1);
--- 712,737 ----
} else
#endif
{
! // cols[i].param_type = PDO_PARAM_STR;
! // TODO: PDO_PARAM_ZVAL, PDO_PARAM_STMT, PDO_PARAM_LOB
! if(IS_NUM_FIELD(&(S->fields[i])) || S->fields[i].type == MYSQL_TYPE_NEWDECIMAL) {
! // IS_NUM(S->fields[i].type) && S->fields[i].type != MYSQL_TYPE_TIMESTAMP
! /*if(S->fields[i].type == MYSQL_TYPE_NULL) {
! cols[i].param_type = PDO_PARAM_NULL;
! else*/ if(S->fields[i].type == MYSQL_TYPE_TINY && S->fields[i].length == 1) {
! cols[i].param_type = PDO_PARAM_BOOL;
! } else if(S->fields[i].type == MYSQL_TYPE_LONGLONG) { // long long
! cols[i].param_type = PDO_PARAM_STR;
! } else if(S->fields[i].type == MYSQL_TYPE_FLOAT || S->fields[i].type == MYSQL_TYPE_DOUBLE) {
! cols[i].param_type = PDO_PARAM_ZVAL;
! } else {
! cols[i].param_type = PDO_PARAM_INT;
! }
! } /*else if(IS_LONGDATA(S->fields[i].type)) {
! cols[i].param_type = PDO_PARAM_LOB;
! }*/ else {
! cols[i].param_type = PDO_PARAM_STR;
! }
}
}
PDO_DBG_RETURN(1);
***************
*** 769,776 ****
PDO_DBG_RETURN(1);
}
#endif /* PDO_USE_MYSQLND else HAVE_MYSQL_STMT_PREPARE */
! *ptr = S->current_data[colno];
! *len = S->current_lengths[colno];
PDO_DBG_RETURN(1);
} /* }}} */
--- 788,826 ----
PDO_DBG_RETURN(1);
}
#endif /* PDO_USE_MYSQLND else HAVE_MYSQL_STMT_PREPARE */
! // *ptr = S->current_data[colno];
! // *len = S->current_lengths[colno];
! // TODO: PDO_PARAM_ZVAL, PDO_PARAM_STMT, PDO_PARAM_LOB
! if(IS_NUM_FIELD(&(S->fields[colno])) || S->fields[colno].type == MYSQL_TYPE_NEWDECIMAL) {
! // IS_NUM(S->fields[colno].type) && S->fields[colno].type != MYSQL_TYPE_TIMESTAMP
! /*if(S->fields[colno].type == MYSQL_TYPE_NULL) {
! cols[colno].param_type = PDO_PARAM_NULL;
! else*/ if(S->fields[colno].type == MYSQL_TYPE_TINY && S->fields[colno].length == 1) {
! *ptr = emalloc(sizeof(zend_bool));
! *(zend_bool*)*ptr = atol(S->current_data[colno]);
! *len = sizeof(zend_bool);
! *caller_frees = 1;
! } else if(S->fields[colno].type == MYSQL_TYPE_LONGLONG) { // long long
! *ptr = S->current_data[colno];
! *len = S->current_lengths[colno];
! } else if(S->fields[colno].type == MYSQL_TYPE_FLOAT || S->fields[colno].type == MYSQL_TYPE_DOUBLE) {
! zval *zv = emalloc(sizeof(zval));
! ZVAL_DOUBLE(zv, strtod(S->current_data[colno], NULL));
! *ptr = &zv;
! *len = sizeof(zval);
! *caller_frees = 0; // 因为fetch_value中自动析构了。
! } else {
! *ptr = emalloc(sizeof(long));
! *(long*)*ptr = atol(S->current_data[colno]);
! *len = sizeof(long);
! *caller_frees = 1;
! }
! } /*else if(IS_LONGDATA(S->fields[colno].type)) {
! cols[colno].param_type = PDO_PARAM_LOB;
! }*/ else {
! *ptr = S->current_data[colno];
! *len = S->current_lengths[colno];
! }
PDO_DBG_RETURN(1);
} /* }}} */
|