summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2005-04-19 13:42:31 +0000
committerAndrey Hristov <andrey@php.net>2005-04-19 13:42:31 +0000
commitfd13faea132bb5c059e4ea0b21339cd9bf5ed079 (patch)
tree33353253218c75f70bf2ea7112a516d3194dcc13 /ext/mysqli/mysqli_api.c
parent28a638fe7bfdcd2555acdb11ca06e890b4c5fd6f (diff)
downloadphp-git-fd13faea132bb5c059e4ea0b21339cd9bf5ed079.tar.gz
MFH
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r--ext/mysqli/mysqli_api.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 814ef3d2ad..f285024bf2 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -311,6 +311,9 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DECIMAL:
+#ifdef FIELD_TYPE_NEWDECIMAL
+ case MYSQL_TYPE_NEWDECIMAL:
+#endif
stmt->result.buf[ofs].type = IS_STRING;
stmt->result.buf[ofs].buflen =
(stmt->stmt->fields) ? (stmt->stmt->fields[ofs].length) ? stmt->stmt->fields[ofs].length + 1: 256: 256;
@@ -585,7 +588,7 @@ PHP_FUNCTION(mysqli_stmt_fetch)
zval *mysql_stmt;
unsigned int i;
ulong ret;
- long lval;
+ int lval;
double dval;
my_ulonglong llval;
@@ -611,11 +614,11 @@ PHP_FUNCTION(mysqli_stmt_fetch)
if (!stmt->result.is_null[i]) {
switch (stmt->result.buf[i].type) {
case IS_LONG:
- memcpy(&lval, stmt->result.buf[i].val, sizeof(long));
+ memcpy(&lval, stmt->result.buf[i].val, sizeof(lval));
ZVAL_LONG(stmt->result.vars[i], lval);
break;
case IS_DOUBLE:
- memcpy(&dval, stmt->result.buf[i].val, sizeof(double));
+ memcpy(&dval, stmt->result.buf[i].val, sizeof(dval));
ZVAL_DOUBLE(stmt->result.vars[i], dval);
break;
case IS_STRING:
@@ -749,7 +752,7 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
MYSQL_RES *result;
zval *mysql_result;
MYSQL_FIELD *field;
- int offset;
+ long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
@@ -839,7 +842,7 @@ PHP_FUNCTION(mysqli_field_seek)
{
MYSQL_RES *result;
zval *mysql_result;
- unsigned int fieldnr;
+ unsigned long fieldnr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
return;
@@ -1029,7 +1032,7 @@ PHP_FUNCTION(mysqli_kill)
{
MY_MYSQL *mysql;
zval *mysql_link;
- int processid;
+ unsigned long processid;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
return;
@@ -1277,7 +1280,7 @@ PHP_FUNCTION(mysqli_real_connect)
MY_MYSQL *mysql;
char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
unsigned int hostname_len, username_len, passwd_len, dbname_len, socket_len;
- unsigned int port=0, flags=0;
+ unsigned long port=0, flags=0;
zval *mysql_link;
zval *object = getThis();
@@ -1416,7 +1419,8 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
MY_STMT *stmt;
zval *mysql_stmt;
char *data;
- long param_nr, data_len;
+ long param_nr;
+ int data_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, &param_nr, &data, &data_len) == FAILURE) {
@@ -1521,6 +1525,9 @@ PHP_FUNCTION(mysqli_stmt_data_seek)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
return;
}
+ if (offset < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be positive");
+ }
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt");