fixed a bug in mysqli_fetch

removed c++ comment (thx to Jani :)
fixed compiler warning
This commit is contained in:
Georg Richter 2003-02-14 18:17:25 +00:00
parent 031dd997fb
commit c544a77836

View file

@ -282,6 +282,8 @@ PHP_FUNCTION(mysqli_bind_result)
case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONGLONG:
stmt->bind[ofs].type = IS_STRING; stmt->bind[ofs].type = IS_STRING;
/* TODO: change and check buflen when bug #74 is fixed */
stmt->bind[ofs].buflen = sizeof(my_ulonglong); stmt->bind[ofs].buflen = sizeof(my_ulonglong);
stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen); stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen);
bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
@ -298,7 +300,7 @@ PHP_FUNCTION(mysqli_bind_result)
case MYSQL_TYPE_BLOB: case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_TIMESTAMP:
stmt->bind[ofs].type = IS_STRING; stmt->bind[ofs].type = IS_STRING;
stmt->bind[ofs].buflen = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].length + 1: 250; stmt->bind[ofs].buflen = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].length + 1: 256;
stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen); stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen);
bind[ofs].buffer_type = MYSQL_TYPE_STRING; bind[ofs].buffer_type = MYSQL_TYPE_STRING;
bind[ofs].buffer = stmt->bind[ofs].buffer; bind[ofs].buffer = stmt->bind[ofs].buffer;
@ -307,7 +309,6 @@ PHP_FUNCTION(mysqli_bind_result)
bind[ofs].length = &stmt->bind[ofs].buflen; bind[ofs].length = &stmt->bind[ofs].buflen;
break; break;
} }
// bind[ofs].length = &stmt->bind[ofs].buflen;
} }
if (mysql_bind_result(stmt->stmt, bind)) { if (mysql_bind_result(stmt->stmt, bind)) {
@ -598,7 +599,7 @@ PHP_FUNCTION(mysqli_execute)
} }
/* }}} */ /* }}} */
/* {{{ proto bool mysqli_fetch(resource stmt) /* {{{ proto int mysqli_fetch(resource stmt)
*/ */
PHP_FUNCTION(mysqli_fetch) PHP_FUNCTION(mysqli_fetch)
{ {
@ -622,8 +623,6 @@ PHP_FUNCTION(mysqli_fetch)
} }
if (!(ret = mysql_fetch(stmt->stmt))) { if (!(ret = mysql_fetch(stmt->stmt))) {
RETURN_FALSE;
}
for (i = 0; i < stmt->var_cnt; i++) { for (i = 0; i < stmt->var_cnt; i++) {
if (!stmt->is_null[i]) { if (!stmt->is_null[i]) {
@ -657,6 +656,7 @@ PHP_FUNCTION(mysqli_fetch)
stmt->vars[i]->type = IS_NULL; stmt->vars[i]->type = IS_NULL;
} }
} }
}
RETURN_LONG(ret); RETURN_LONG(ret);
} }
@ -1266,7 +1266,7 @@ PHP_FUNCTION(mysqli_real_connect)
if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) { if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) {
/* Save error messages */ /* Save error messages */
php_mysqli_set_error(mysql_errno(mysql), mysql_error(mysql) TSRMLS_CC); php_mysqli_set_error(mysql_errno(mysql), (char *)mysql_error(mysql) TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql));
RETURN_FALSE; RETURN_FALSE;