[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2009-05-28 Thread Kalle Sommer Nielsen
kalle   Thu May 28 19:40:38 2009 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB: This should be in HEAD regradless of uint8_t is available or not
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.174r2=1.175diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.174 
php-src/ext/mysqli/mysqli_api.c:1.175
--- php-src/ext/mysqli/mysqli_api.c:1.174   Wed May 20 08:29:23 2009
+++ php-src/ext/mysqli/mysqli_api.c Thu May 28 19:40:37 2009
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli_api.c,v 1.174 2009/05/20 08:29:23 kalle Exp $ 
+  $Id: mysqli_api.c,v 1.175 2009/05/28 19:40:37 kalle Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -2142,7 +2142,11 @@
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, 
MYSQLI_STATUS_INITIALIZED);
+#ifdef MYSQLI_USE_MYSQLND
RETURN_BOOL(!mysql_refresh(mysql-mysql, (uint8_t) options));
+#else
+   RETURN_BOOL(!mysql_refresh(mysql-mysql, options));
+#endif
 }
 /* }}} */
  



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2009-01-09 Thread Johannes Schlüter
johannesFri Jan  9 14:28:31 2009 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  Fix #46653 mysqlnd: can't extend mysqli
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.170r2=1.171diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.170 
php-src/ext/mysqli/mysqli_api.c:1.171
--- php-src/ext/mysqli/mysqli_api.c:1.170   Wed Dec 31 11:12:33 2008
+++ php-src/ext/mysqli/mysqli_api.c Fri Jan  9 14:28:31 2009
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli_api.c,v 1.170 2008/12/31 11:12:33 sebastian Exp $ 
+  $Id: mysqli_api.c,v 1.171 2009/01/09 14:28:31 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1366,7 +1366,7 @@
MYSQLI_RESOURCE *mysqli_resource;
MY_MYSQL *mysql;
 
-   if (getThis()  instanceof_function(Z_OBJCE_P(getThis()), 
mysqli_link_class_entry TSRMLS_CC)) {
+   if (getThis()  ((mysqli_object *) 
zend_object_store_get_object(getThis() TSRMLS_CC))-ptr) {
return;
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/mysqli/tests bug45019.phpt

2008-07-25 Thread Andrey Hristov
andrey  Fri Jul 25 12:45:27 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
/php-src/ext/mysqli/tests   bug45019.phpt 
  Log:
  Fix bug#45019 Segmentation fault with SELECT ? and UNION
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.166r2=1.167diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.166 
php-src/ext/mysqli/mysqli_api.c:1.167
--- php-src/ext/mysqli/mysqli_api.c:1.166   Thu Jul 17 09:52:51 2008
+++ php-src/ext/mysqli/mysqli_api.c Fri Jul 25 12:45:27 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli_api.c,v 1.166 2008/07/17 09:52:51 dmitry Exp $ 
+  $Id: mysqli_api.c,v 1.167 2008/07/25 12:45:27 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -389,8 +389,13 @@
if (stmt-stmt-fields[ofs].max_length == 0 
!mysql_stmt_attr_get(stmt-stmt, 
STMT_ATTR_UPDATE_MAX_LENGTH, tmp)  !tmp)
{
-   stmt-result.buf[ofs].buflen =
-   (stmt-stmt-fields) ? 
(stmt-stmt-fields[ofs].length) ? stmt-stmt-fields[ofs].length + 1: 256: 256;
+   /*
+ Allocate directly 256 because it's 
easier to allocate a bit more
+ than update max length even for text 
columns. Try SELECT UNION SELECT UNION with
+ different lengths and you will see 
that we get different lengths in stmt-stmt-fields[ofs].length
+ The just take 256 and saves us from 
realloc-ing.
+   */
+   stmt-result.buf[ofs].buflen = 256;
} else {
/*
the user has called 
store_result(). if he does not there is no way to determine the
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug45019.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/mysqli/tests/bug45019.phpt
diff -u php-src/ext/mysqli/tests/bug45019.phpt:1.1 
php-src/ext/mysqli/tests/bug45019.phpt:1.2
--- php-src/ext/mysqli/tests/bug45019.phpt:1.1  Thu Jul 24 14:17:27 2008
+++ php-src/ext/mysqli/tests/bug45019.phpt  Fri Jul 25 12:45:27 2008
@@ -57,7 +57,7 @@
printf([006] [%d] %s\n, $link-errno, $link-error);
 
$column1 = null;
-   if (!$stmt-bind_result($column1) || !$stmt-execute())
+   if (!$stmt-execute() || !$stmt-bind_result($column1))
printf([007] [%d] %s\n, $stmt-errno, $stmt-error);
 
$index = 0;
@@ -153,6 +153,6 @@
 string(3) two
 Testing bind_param(), strings only, with CAST AS CHAR...
 string(3) one
-string(5) three beers are more than enough
+string(32) three beers are more than enough
 string(3) two
-done!
\ No newline at end of file
+done!



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2008-03-20 Thread Andrey Hristov
andrey  Thu Mar 20 13:58:46 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  Missing lines from the param-bind-non-changing fix
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.161r2=1.162diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.161 
php-src/ext/mysqli/mysqli_api.c:1.162
--- php-src/ext/mysqli/mysqli_api.c:1.161   Tue Mar 18 16:58:42 2008
+++ php-src/ext/mysqli/mysqli_api.c Thu Mar 20 13:58:46 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli_api.c,v 1.161 2008/03/18 16:58:42 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.162 2008/03/20 13:58:46 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -697,6 +697,22 @@
 }
 /* }}} */
 
+#ifndef MYSQLI_USE_MYSQLND
+/* {{{ php_mysqli_stmt_copy_it */
+static void
+php_mysqli_stmt_copy_it(zval *** copies, zval *original, uint param_count, 
uint current)
+{
+   if (!*copies) {
+   *copies = ecalloc(param_count, sizeof(zval *)); 

+   }
+   MAKE_STD_ZVAL((*copies)[current]);
+   *(*copies)[current] = *original;
+   Z_SET_REFCOUNT_P((*copies)[current], 1);
+   zval_copy_ctor((*copies)[current]);
+}
+/* }}} */
+#endif
+
 /* {{{ proto bool mysqli_stmt_execute(object stmt) U
Execute a prepared statement */
 PHP_FUNCTION(mysqli_stmt_execute)
@@ -705,6 +721,7 @@
zval*mysql_stmt;
 #ifndef MYSQLI_USE_MYSQLND
unsigned inti;
+   zval**copies = NULL;
 #endif
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -713,30 +730,54 @@
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt, 
MYSQLI_STATUS_VALID);
 
 #ifndef MYSQLI_USE_MYSQLND
+   if (stmt-param.var_cnt) {
+   int j;
+   for (i = 0; i  stmt-param.var_cnt; i++) {
+   for (j = i + 1; j  stmt-param.var_cnt; j++) {
+   /* Oops, someone binding the same variable - 
clone */
+   if (stmt-param.vars[j] == stmt-param.vars[i]) 
{
+   php_mysqli_stmt_copy_it(copies, 
stmt-param.vars[i], stmt-param.var_cnt, i);
+   break;
+   }
+   }
+   }
+   }
for (i = 0; i  stmt-param.var_cnt; i++) {
if (stmt-param.vars[i]) {
if ( !(stmt-param.is_null[i] = 
(stmt-param.vars[i]-type == IS_NULL)) ) {
+   zval *the_var = copies  copies[i]? 
copies[i]:stmt-param.vars[i];
switch (stmt-stmt-params[i].buffer_type) {
case MYSQL_TYPE_VAR_STRING:
-   if (UG(unicode)  
Z_TYPE_P(stmt-param.vars[i]) == IS_UNICODE) {
-   
zend_unicode_to_string(UG(utf8_conv), (char **)stmt-stmt-params[i].buffer, 
(int *)stmt-stmt-params[i].buffer_length,
-   
  Z_USTRVAL_PP(stmt-param.vars[i]), 
Z_USTRLEN_PP(stmt-param.vars[i]) TSRMLS_CC);
+   if (UG(unicode)  
Z_TYPE_P(the_var) == IS_UNICODE) {
+   
php_mysqli_stmt_copy_it(copies, stmt-param.vars[i], stmt-param.var_cnt, i);
+   the_var = copies[i];
+   
zval_unicode_to_string_ex(the_var, UG(utf8_conv) TSRMLS_CC);
} else {
-   if 
(Z_TYPE_P(stmt-param.vars[i]) != IS_STRING) {
-   
convert_to_string_ex(stmt-param.vars[i]);
+   if (the_var == 
stmt-param.vars[i]  Z_TYPE_P(stmt-param.vars[i]) != IS_STRING) {
+   
php_mysqli_stmt_copy_it(copies, stmt-param.vars[i], stmt-param.var_cnt, i);
+   the_var = 
copies[i];
}
-   
stmt-stmt-params[i].buffer = Z_STRVAL_PP(stmt-param.vars[i]);
-   
stmt-stmt-params[i].buffer_length = Z_STRLEN_PP(stmt-param.vars[i]);
+   
convert_to_string_ex(the_var);
}
+   

[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/mysqli/tests bug42548.phpt

2007-12-25 Thread Hartmut Holzgraefe
hholzgraTue Dec 25 18:23:07 2007 UTC

  Added files: 
/php-src/ext/mysqli/tests   bug42548.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  Fix for bug #42548 PROCEDURE xxx can't return a result set
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.155r2=1.156diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.155 
php-src/ext/mysqli/mysqli_api.c:1.156
--- php-src/ext/mysqli/mysqli_api.c:1.155   Fri Nov  9 12:13:15 2007
+++ php-src/ext/mysqli/mysqli_api.c Tue Dec 25 18:23:07 2007
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli_api.c,v 1.155 2007/11/09 12:13:15 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.156 2007/12/25 18:23:07 hholzgra Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1696,6 +1696,8 @@
 
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, 
MYSQLI_STATUS_INITIALIZED);
 
+   /* set some required options */
+   flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
/* remove some insecure options */
flags = ~CLIENT_MULTI_STATEMENTS;   /* don't allow multi_queries via 
connect parameter */
if (PG(open_basedir)  PG(open_basedir)[0] != '\0') {

http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug42548.phpt?view=markuprev=1.1
Index: php-src/ext/mysqli/tests/bug42548.phpt
+++ php-src/ext/mysqli/tests/bug42548.phpt
--TEST--
Bug #42548 PROCEDURE xxx can't return a result set in the given context (works 
in 5.2.3!!)
--SKIPIF--
?php if (!extension_loaded(mysqli)) print skip; ?
--FILE--
?php
$mysqli = mysqli_init();
$mysqli-real_connect('localhost', 'root', '', 'test');
if (mysqli_connect_errno()) {
  printf(Connect failed: %s\n, mysqli_connect_error());
  exit();
}

$mysqli-query(DROP PROCEDURE IF EXISTS p1) or die($mysqli-error);
$mysqli-query(CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END) or 
die($mysqli-error);

if ($mysqli-multi_query(CALL p1();))
{   
  do
  { 
if ($objResult = $mysqli-store_result()) {
  while ($row = $objResult-fetch_assoc()) {
print_r($row);
  }
  $objResult-close();
  if ($mysqli-more_results()) {
print - next result ---\n;
  }
} else {
  print no results found;
}
  } while ($mysqli-more_results()  $mysqli-next_result());
} else {
  print $mysqli-error;
}

$mysqli-query(DROP PROCEDURE p1) or die($mysqli-error);
$mysqli-close();
?
--EXPECT--  
Array
(
[23] = 23
)
- next result ---
Array
(
[42] = 42
)
- next result ---
no results found

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-10-29 Thread Jani Taskinen
janiMon Oct 29 09:50:49 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  - Fixed invalid handling of float value passed to an integer field on 64bit 
machine
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.153r2=1.154diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.153 
php-src/ext/mysqli/mysqli_api.c:1.154
--- php-src/ext/mysqli/mysqli_api.c:1.153   Wed Oct 17 08:22:01 2007
+++ php-src/ext/mysqli/mysqli_api.c Mon Oct 29 09:50:49 2007
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli_api.c,v 1.153 2007/10/17 08:22:01 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.154 2007/10/29 09:50:49 jani Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -105,7 +105,11 @@
break;
 
case 'i': /* Integer */
-   bind[ofs].buffer_type = (sizeof(long)  4) ? 
MYSQL_TYPE_LONGLONG : MYSQL_TYPE_LONG;
+#if SIZEOF_LONG==8
+   bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
+#elif SIZEOF_LONG==4
+   bind[ofs].buffer_type = MYSQL_TYPE_LONG;
+#endif
bind[ofs].buffer = Z_LVAL_PP(args[i]);
bind[ofs].is_null = stmt-param.is_null[ofs];
break;
@@ -735,6 +739,7 @@

convert_to_double_ex(stmt-param.vars[i]);
stmt-stmt-params[i].buffer = 
Z_LVAL_PP(stmt-param.vars[i]);
break;
+   case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_LONG:

convert_to_long_ex(stmt-param.vars[i]);
stmt-stmt-params[i].buffer = 
Z_LVAL_PP(stmt-param.vars[i]);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-10-17 Thread Antony Dovgal
tony2001Wed Oct 17 08:22:01 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  commit lost part of the patch
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.152r2=1.153diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.152 
php-src/ext/mysqli/mysqli_api.c:1.153
--- php-src/ext/mysqli/mysqli_api.c:1.152   Wed Oct 17 08:17:34 2007
+++ php-src/ext/mysqli/mysqli_api.c Wed Oct 17 08:22:01 2007
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli_api.c,v 1.152 2007/10/17 08:17:34 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.153 2007/10/17 08:22:01 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1442,7 +1442,8 @@
} else {
zval_dtor(mysql-li_read);
}
-   ZVAL_ZVAL(mysql-li_read, callback_name, 0, 0);
+   p_callback_name = callback_name;
+   ZVAL_ZVAL(mysql-li_read, p_callback_name, 0, 0);
 
RETURN_TRUE;
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-07-24 Thread Andrey Hristov
andrey  Tue Jul 24 09:32:11 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.147r2=1.148diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.147 
php-src/ext/mysqli/mysqli_api.c:1.148
--- php-src/ext/mysqli/mysqli_api.c:1.147   Mon Jun 18 21:59:05 2007
+++ php-src/ext/mysqli/mysqli_api.c Tue Jul 24 09:32:11 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.147 2007/06/18 21:59:05 stas Exp $ 
+  $Id: mysqli_api.c,v 1.148 2007/07/24 09:32:11 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -145,13 +145,13 @@
switch (types[ofs]) {
case 'd': /* Double */
bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
-   bind[ofs].buffer = (gptr)Z_DVAL_PP(args[i]);
+   bind[ofs].buffer = (char*)Z_DVAL_PP(args[i]);
bind[ofs].is_null = stmt-param.is_null[ofs];
break;
 
case 'i': /* Integer */
bind[ofs].buffer_type = MYSQL_TYPE_LONG;
-   bind[ofs].buffer = (gptr)Z_LVAL_PP(args[i]);
+   bind[ofs].buffer = (char*)Z_LVAL_PP(args[i]);
bind[ofs].is_null = stmt-param.is_null[ofs];
break;
 
@@ -620,11 +620,11 @@
break;
case MYSQL_TYPE_DOUBLE:

convert_to_double_ex(stmt-param.vars[i]);
-   stmt-stmt-params[i].buffer = 
(gptr)Z_LVAL_PP(stmt-param.vars[i]);
+   stmt-stmt-params[i].buffer = 
(char*)Z_LVAL_PP(stmt-param.vars[i]);
break;
case MYSQL_TYPE_LONG:

convert_to_long_ex(stmt-param.vars[i]);
-   stmt-stmt-params[i].buffer = 
(gptr)Z_LVAL_PP(stmt-param.vars[i]);
+   stmt-stmt-params[i].buffer = 
(char*)Z_LVAL_PP(stmt-param.vars[i]);
break;
default:
break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/pdo_mysql mysql_driver.c

2007-06-18 Thread Stanislav Malyshev
stasMon Jun 18 21:59:05 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
/php-src/ext/pdo_mysql  mysql_driver.c 
  Log:
  Fix INFILE LOCAL option handling with MySQL - now not allowed when 
open_basedir
  is active
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.146r2=1.147diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.146 
php-src/ext/mysqli/mysqli_api.c:1.147
--- php-src/ext/mysqli/mysqli_api.c:1.146   Sat Apr 14 10:42:41 2007
+++ php-src/ext/mysqli/mysqli_api.c Mon Jun 18 21:59:05 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.146 2007/04/14 10:42:41 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.147 2007/06/18 21:59:05 stas Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1320,6 +1320,12 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, 
MYSQLI_STATUS_INITIALIZED);
 
+   if (PG(open_basedir)  PG(open_basedir)[0] != '\0') {
+   if(mysql_option == MYSQL_OPT_LOCAL_INFILE) {
+   RETURN_FALSE;
+   }
+   }
+
switch (Z_TYPE_PP(mysql_value)) {
case IS_UNICODE:
zval_unicode_to_string(mysql_value TSRMLS_CC);
@@ -1453,9 +1459,9 @@
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, 
MYSQLI_STATUS_INITIALIZED);
 
/* remove some insecure options */
-   flags ^= CLIENT_MULTI_STATEMENTS;   /* don't allow multi_queries via 
connect parameter */
-   if (PG(open_basedir)  strlen(PG(open_basedir))) {
-   flags ^= CLIENT_LOCAL_FILES;
+   flags = ~CLIENT_MULTI_STATEMENTS;   /* don't allow multi_queries via 
connect parameter */
+   if (PG(open_basedir)  PG(open_basedir)[0] != '\0') {
+   flags = ~CLIENT_LOCAL_FILES;
}
 
if (!socket) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_mysql/mysql_driver.c?r1=1.77r2=1.78diff_format=u
Index: php-src/ext/pdo_mysql/mysql_driver.c
diff -u php-src/ext/pdo_mysql/mysql_driver.c:1.77 
php-src/ext/pdo_mysql/mysql_driver.c:1.78
--- php-src/ext/pdo_mysql/mysql_driver.c:1.77   Mon Jan  1 09:29:28 2007
+++ php-src/ext/pdo_mysql/mysql_driver.cMon Jun 18 21:59:05 2007
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: mysql_driver.c,v 1.77 2007/01/01 09:29:28 sebastian Exp $ */
+/* $Id: mysql_driver.c,v 1.78 2007/06/18 21:59:05 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -476,6 +476,10 @@
H-emulate_prepare = pdo_attr_lval(driver_options, 
PDO_MYSQL_ATTR_DIRECT_QUERY, 1 TSRMLS_CC);
H-max_buffer_size = pdo_attr_lval(driver_options, 
PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H-max_buffer_size TSRMLS_CC);
 
+   if (PG(open_basedir)  PG(open_basedir)[0] != '\0') {
+   local_infile = 0;
+   }
+
if (mysql_options(H-server, MYSQL_OPT_CONNECT_TIMEOUT, (const 
char *)connect_timeout)) {
pdo_mysql_error(dbh);
goto cleanup;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2007-04-14 Thread Antony Dovgal
tony2001Sat Apr 14 10:42:41 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_nonapi.c mysqli_api.c 
  Log:
  use default socket (removed by mistake?)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.69r2=1.70diff_format=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.69 
php-src/ext/mysqli/mysqli_nonapi.c:1.70
--- php-src/ext/mysqli/mysqli_nonapi.c:1.69 Sat Apr 14 10:35:00 2007
+++ php-src/ext/mysqli/mysqli_nonapi.c  Sat Apr 14 10:42:41 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.69 2007/04/14 10:35:00 tony2001 Exp $ 
+  $Id: mysqli_nonapi.c,v 1.70 2007/04/14 10:42:41 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -90,6 +90,10 @@
mysql_options(mysql-mysql, MYSQL_OPT_RECONNECT, (const char 
*)my_true);
 #endif
 
+   if (!socket) {
+   socket = MyG(default_socket);
+   }
+
if (mysql_real_connect(mysql-mysql, hostname, username, passwd, 
dbname, port, socket, CLIENT_MULTI_RESULTS) == NULL) {
/* Save error messages */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.145r2=1.146diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.145 
php-src/ext/mysqli/mysqli_api.c:1.146
--- php-src/ext/mysqli/mysqli_api.c:1.145   Thu Mar  8 22:57:02 2007
+++ php-src/ext/mysqli/mysqli_api.c Sat Apr 14 10:42:41 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.145 2007/03/08 22:57:02 stas Exp $ 
+  $Id: mysqli_api.c,v 1.146 2007/04/14 10:42:41 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1458,6 +1458,10 @@
flags ^= CLIENT_LOCAL_FILES;
}
 
+   if (!socket) {
+   socket = MyG(default_socket);
+   }
+
if (mysql_real_connect(mysql-mysql, hostname, username, passwd, dbname 
,port, socket ,flags) == NULL) {
php_mysqli_set_error(mysql_errno(mysql-mysql), (char *) 
mysql_error(mysql-mysql) TSRMLS_CC);
php_mysqli_throw_sql_exception( mysql-mysql-net.sqlstate, 
mysql-mysql-net.last_errno TSRMLS_CC,

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-03-09 Thread Andrey Hristov
 Stas,
test case?

Stanislav Malyshev wrote:
 stas  Thu Mar  8 22:57:02 2007 UTC
 
   Modified files:  
 /php-src/ext/mysqli   mysqli_api.c 
   Log:
   MFB: fix crash/leak in bug #38710 
   
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.144r2=1.145diff_format=u
 Index: php-src/ext/mysqli/mysqli_api.c
 diff -u php-src/ext/mysqli/mysqli_api.c:1.144 
 php-src/ext/mysqli/mysqli_api.c:1.145
 --- php-src/ext/mysqli/mysqli_api.c:1.144 Sat Feb 24 16:25:54 2007
 +++ php-src/ext/mysqli/mysqli_api.c   Thu Mar  8 22:57:02 2007
 @@ -15,7 +15,7 @@
| Author: Georg Richter [EMAIL PROTECTED]
 |
+--+
  
 -  $Id: mysqli_api.c,v 1.144 2007/02/24 16:25:54 helly Exp $ 
 +  $Id: mysqli_api.c,v 1.145 2007/03/08 22:57:02 stas Exp $ 
  */
  
  #ifdef HAVE_CONFIG_H
 @@ -764,7 +764,16 @@
   }
  #endif
   else {
 - 
 ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
 stmt-result.buf[i].buflen, ZSTR_DUPLICATE);
 +#if defined(MYSQL_DATA_TRUNCATED)  MYSQL_VERSION_ID  50002
 + if(ret == 
 MYSQL_DATA_TRUNCATED  *(stmt-stmt-bind[i].error) != 0) {
 + /* result was 
 truncated */
 + 
 ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
 stmt-stmt-bind[i].buffer_length, ZSTR_DUPLICATE);
 + } else {
 +#else
 + {
 +#endif
 + 
 ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
 stmt-result.buf[i].buflen, ZSTR_DUPLICATE);
 + }
  
   } 
   break;
 

Andrey

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-03-08 Thread Stanislav Malyshev
stasThu Mar  8 22:57:02 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB: fix crash/leak in bug #38710 
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.144r2=1.145diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.144 
php-src/ext/mysqli/mysqli_api.c:1.145
--- php-src/ext/mysqli/mysqli_api.c:1.144   Sat Feb 24 16:25:54 2007
+++ php-src/ext/mysqli/mysqli_api.c Thu Mar  8 22:57:02 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.144 2007/02/24 16:25:54 helly Exp $ 
+  $Id: mysqli_api.c,v 1.145 2007/03/08 22:57:02 stas Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -764,7 +764,16 @@
}
 #endif
else {
-   
ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
stmt-result.buf[i].buflen, ZSTR_DUPLICATE);
+#if defined(MYSQL_DATA_TRUNCATED)  MYSQL_VERSION_ID  50002
+   if(ret == 
MYSQL_DATA_TRUNCATED  *(stmt-stmt-bind[i].error) != 0) {
+   /* result was 
truncated */
+   
ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
stmt-stmt-bind[i].buffer_length, ZSTR_DUPLICATE);
+   } else {
+#else
+   {
+#endif
+   
ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
stmt-result.buf[i].buflen, ZSTR_DUPLICATE);
+   }
 
} 
break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-01-12 Thread Andrey Hristov
andrey  Fri Jan 12 20:26:35 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  add a sticky note
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.142r2=1.143diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.142 
php-src/ext/mysqli/mysqli_api.c:1.143
--- php-src/ext/mysqli/mysqli_api.c:1.142   Sat Jan  6 05:50:36 2007
+++ php-src/ext/mysqli/mysqli_api.c Fri Jan 12 20:26:35 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.142 2007/01/06 05:50:36 georg Exp $ 
+  $Id: mysqli_api.c,v 1.143 2007/01/12 20:26:35 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -686,6 +686,11 @@
if (!ret) {
 #endif
for (i = 0; i  stmt-result.var_cnt; i++) {
+   /*
+ QQ: Isn't it quite better to call zval_dtor(). What 
if the user has
+ assigned a resource, or an array to the bound 
variable? We are going
+ to leak probably. zval_dtor() will handle also 
Unicode/Non-unicode mode.
+   */
/* Even if the string is of length zero there is one 
byte alloced so efree() in all cases */
if (Z_TYPE_P(stmt-result.vars[i]) == IS_STRING) {
efree(stmt-result.vars[i]-value.str.val);


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-01-05 Thread Georg Richter
georg   Sat Jan  6 05:50:36 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  merged from 5_2 (mysqli_info crash)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.141r2=1.142diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.141 
php-src/ext/mysqli/mysqli_api.c:1.142
--- php-src/ext/mysqli/mysqli_api.c:1.141   Tue Jan  2 05:49:05 2007
+++ php-src/ext/mysqli/mysqli_api.c Sat Jan  6 05:50:36 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.141 2007/01/02 05:49:05 georg Exp $ 
+  $Id: mysqli_api.c,v 1.142 2007/01/06 05:50:36 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1099,7 +1099,7 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, 
MYSQLI_STATUS_VALID);
 
-   RETURN_UTF8_STRING(mysql-mysql-info, ZSTR_DUPLICATE);
+   RETURN_UTF8_STRING((mysql-mysql-info) ? mysql-mysql-info : , 
ZSTR_DUPLICATE);
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2007-01-01 Thread Georg Richter
georg   Tue Jan  2 05:49:05 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed parameters for unicode in mysqli_change_user
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.140r2=1.141diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.140 
php-src/ext/mysqli/mysqli_api.c:1.141
--- php-src/ext/mysqli/mysqli_api.c:1.140   Mon Jan  1 09:29:25 2007
+++ php-src/ext/mysqli/mysqli_api.c Tue Jan  2 05:49:05 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.140 2007/01/01 09:29:25 sebastian Exp $ 
+  $Id: mysqli_api.c,v 1.141 2007/01/02 05:49:05 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -403,7 +403,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto bool mysqli_change_user(object link, string user, string 
password, string database) U
Change logged-in user of the active connection */
 PHP_FUNCTION(mysqli_change_user)
@@ -414,7 +413,7 @@
int user_len, password_len, dbname_len;
ulong   rc;
 
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Osss, mysql_link, mysqli_link_class_entry, 
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Osss, mysql_link, mysqli_link_class_entry, 
user, 
user_len, UG(utf8_conv), password, password_len, UG(utf8_conv),

dbname, dbname_len, UG(utf8_conv)) == FAILURE) {
return;
@@ -432,7 +431,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto string mysqli_character_set_name(object link) U
Returns the name of the character set used for this connection */
 PHP_FUNCTION(mysqli_character_set_name)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2006-12-04 Thread Andrey Hristov
andrey  Mon Dec  4 15:27:18 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  dummy change
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.138r2=1.139diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.138 
php-src/ext/mysqli/mysqli_api.c:1.139
--- php-src/ext/mysqli/mysqli_api.c:1.138   Tue Oct 31 15:23:16 2006
+++ php-src/ext/mysqli/mysqli_api.c Mon Dec  4 15:27:18 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.138 2006/10/31 15:23:16 georg Exp $ 
+  $Id: mysqli_api.c,v 1.139 2006/12/04 15:27:18 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -51,6 +51,7 @@
 }
 /* }}} */
 
+
 /* {{{ proto bool mysqli_autocommit(object link, bool mode) U
Turn auto commit on or of */
 PHP_FUNCTION(mysqli_autocommit)
@@ -71,6 +72,7 @@
 }
 /* }}} */
 
+
 /* {{{ proto bool mysqli_stmt_bind_param(object stmt, string types, mixed 
variable [,mixed,]) U
Bind variables to a prepared statement as parameters */
 PHP_FUNCTION(mysqli_stmt_bind_param)
@@ -196,6 +198,7 @@
 }
 /* }}} */
 
+
 /* {{{ proto bool mysqli_stmt_bind_result(object stmt, mixed var, [,mixed, 
...]) U
Bind variables to a prepared statement for result storage */
 
@@ -400,6 +403,7 @@
 }
 /* }}} */
 
+
 /* {{{ proto bool mysqli_change_user(object link, string user, string 
password, string database) U
Change logged-in user of the active connection */
 PHP_FUNCTION(mysqli_change_user)
@@ -428,6 +432,7 @@
 }
 /* }}} */
 
+
 /* {{{ proto string mysqli_character_set_name(object link) U
Returns the name of the character set used for this connection */
 PHP_FUNCTION(mysqli_character_set_name)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2006-10-31 Thread Georg Richter
georg   Tue Oct 31 15:23:16 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_nonapi.c mysqli_api.c 
  Log:
  Fixed function headers (added missing U)
  fixed socket parameter (was removed by mistake in a previous commit)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.66r2=1.67diff_format=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.66 
php-src/ext/mysqli/mysqli_nonapi.c:1.67
--- php-src/ext/mysqli/mysqli_nonapi.c:1.66 Sat Oct  7 18:24:51 2006
+++ php-src/ext/mysqli/mysqli_nonapi.c  Tue Oct 31 15:23:16 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.66 2006/10/07 18:24:51 iliaa Exp $ 
+  $Id: mysqli_nonapi.c,v 1.67 2006/10/31 15:23:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -52,6 +52,10 @@
return;
}
 
+   if (!socket_len) {
+   socket = NULL;
+   }
+
if (!passwd) {
passwd = MyG(default_pw);
if (!username){
@@ -157,7 +161,7 @@
 }
 /* }}} */
 
-/* {{{ proto mixed mysqli_fetch_object (object result [, string class_name [, 
NULL|array ctor_params]]) 
+/* {{{ proto mixed mysqli_fetch_object (object result [, string class_name [, 
NULL|array ctor_params]]) U
Fetch a result row as an object */
 PHP_FUNCTION(mysqli_fetch_object) 
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.137r2=1.138diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.137 
php-src/ext/mysqli/mysqli_api.c:1.138
--- php-src/ext/mysqli/mysqli_api.c:1.137   Sun Oct  8 13:34:22 2006
+++ php-src/ext/mysqli/mysqli_api.c Tue Oct 31 15:23:16 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.137 2006/10/08 13:34:22 bjori Exp $ 
+  $Id: mysqli_api.c,v 1.138 2006/10/31 15:23:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1084,7 +1084,7 @@
 }
 /* }}} */
 
-/* {{{ proto string mysqli_info(object link)
+/* {{{ proto string mysqli_info(object link) U
Get information about the most recent query */
 PHP_FUNCTION(mysqli_info)
 {
@@ -1631,7 +1631,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_stmt_field_count(object stmt) { U
+/* {{{ proto int mysqli_stmt_field_count(object stmt) U
Return the number of result columns for the given statement */
 PHP_FUNCTION(mysqli_stmt_field_count)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2006-10-02 Thread Antony Dovgal
tony2001Mon Oct  2 16:08:11 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  don't rely on uninitialized var
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.135r2=1.136diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.135 
php-src/ext/mysqli/mysqli_api.c:1.136
--- php-src/ext/mysqli/mysqli_api.c:1.135   Mon Oct  2 07:42:49 2006
+++ php-src/ext/mysqli/mysqli_api.c Mon Oct  2 16:08:11 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.135 2006/10/02 07:42:49 bjori Exp $ 
+  $Id: mysqli_api.c,v 1.136 2006/10/02 16:08:11 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1415,7 +1415,7 @@
 {
MY_MYSQL*mysql;
char*hostname, *username, *passwd, *dbname, *socket;
-   int hostname_len, username_len, passwd_len, 
dbname_len, socket_len;
+   int hostname_len, username_len, passwd_len, 
dbname_len, socket_len = 0;
unsigned long   port=0, flags=0;
zval*mysql_link;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2006-08-04 Thread Ilia Alshanetsky
iliaa   Fri Aug  4 22:14:10 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB: Improved fix for bug #37671
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.129r2=1.130diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.129 
php-src/ext/mysqli/mysqli_api.c:1.130
--- php-src/ext/mysqli/mysqli_api.c:1.129   Wed Jul 12 10:15:30 2006
+++ php-src/ext/mysqli/mysqli_api.c Fri Aug  4 22:14:10 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.129 2006/07/12 10:15:30 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.130 2006/08/04 22:14:10 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -294,9 +294,6 @@
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_YEAR:
-#if MYSQL_VERSION_ID  50002
-   case MYSQL_TYPE_BIT:
-#endif
convert_to_long_ex(args[i]);
stmt-result.buf[ofs].type = IS_LONG;
/* don't set stmt-result.buf[ofs].buflen to 0, 
we used ecalloc */
@@ -308,10 +305,13 @@
break;
 
case MYSQL_TYPE_LONGLONG:
+#if MYSQL_VERSION_ID  50002
+   case MYSQL_TYPE_BIT:
+#endif
stmt-result.buf[ofs].type = IS_STRING; 
stmt-result.buf[ofs].buflen = 
sizeof(my_ulonglong); 
stmt-result.buf[ofs].val = (char 
*)emalloc(stmt-result.buf[ofs].buflen);
-   bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
+   bind[ofs].buffer_type = col_type;
bind[ofs].buffer = stmt-result.buf[ofs].val;
bind[ofs].is_null = stmt-result.is_null[ofs];
bind[ofs].buffer_length = 
stmt-result.buf[ofs].buflen;
@@ -715,7 +715,14 @@
} else {

ZVAL_LONG(stmt-result.vars[i], llval);
}
-   } else {
+   } 
+#if MYSQL_VERSION_ID  50002
+   else if 
(stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_BIT) {
+   llval = *(my_ulonglong 
*)stmt-result.buf[i].val;
+   
ZVAL_LONG(stmt-result.vars[i], llval);
+   }
+#endif
+   else {

ZVAL_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
stmt-result.buf[i].buflen, 1);
}
break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/mysqli/tests 074.phpt

2006-07-12 Thread Antony Dovgal
tony2001Wed Jul 12 10:15:30 2006 UTC

  Added files: 
/php-src/ext/mysqli/tests   074.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB: fix #38072 (boolean arg for mysqli_autocommit() is always true on 
Solaris)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.128r2=1.129diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.128 
php-src/ext/mysqli/mysqli_api.c:1.129
--- php-src/ext/mysqli/mysqli_api.c:1.128   Sun Jun  4 14:57:06 2006
+++ php-src/ext/mysqli/mysqli_api.c Wed Jul 12 10:15:30 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.128 2006/06/04 14:57:06 iliaa Exp $ 
+  $Id: mysqli_api.c,v 1.129 2006/07/12 10:15:30 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -57,14 +57,14 @@
 {
MY_MYSQL*mysql;
zval*mysql_link;
-   unsigned long   automode;
+   zend_bool   automode;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Ob, mysql_link, mysqli_link_class_entry, automode) == FAILURE) {
return; 
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, 
MYSQLI_STATUS_VALID);
 
-   if (mysql_autocommit(mysql-mysql, automode)) {
+   if (mysql_autocommit(mysql-mysql, (my_bool)automode)) {
RETURN_FALSE;
}
RETURN_TRUE;

http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/074.phpt?view=markuprev=1.1
Index: php-src/ext/mysqli/tests/074.phpt
+++ php-src/ext/mysqli/tests/074.phpt
--TEST--
mysqli_autocommit() tests
--SKIPIF--
?php 
require_once('skipif.inc'); 
?
--FILE--
?php

include connect.inc;

$mysqli = new mysqli($host, $user, $passwd, test);

var_dump($mysqli-autocommit(false));
$result = $mysqli-query(SELECT @@autocommit);
var_dump($result-fetch_row());

var_dump($mysqli-autocommit(true));
$result = $mysqli-query(SELECT @@autocommit);
var_dump($result-fetch_row());

?
--EXPECT--
bool(true)
array(1) {
  [0]=
  string(1) 0
}
bool(true)
array(1) {
  [0]=
  string(1) 1
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2006-06-04 Thread Ilia Alshanetsky
iliaa   Sun Jun  4 14:57:06 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB: Fixed bug #37671 (MySQLi extension fails to recognize BIT column).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.127r2=1.128diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.127 
php-src/ext/mysqli/mysqli_api.c:1.128
--- php-src/ext/mysqli/mysqli_api.c:1.127   Wed May 10 12:29:09 2006
+++ php-src/ext/mysqli/mysqli_api.c Sun Jun  4 14:57:06 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.127 2006/05/10 12:29:09 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.128 2006/06/04 14:57:06 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -294,6 +294,9 @@
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_YEAR:
+#if MYSQL_VERSION_ID  50002
+   case MYSQL_TYPE_BIT:
+#endif
convert_to_long_ex(args[i]);
stmt-result.buf[ofs].type = IS_LONG;
/* don't set stmt-result.buf[ofs].buflen to 0, 
we used ecalloc */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_report.c

2005-12-23 Thread Stefan Esser
sesser  Fri Dec 23 18:43:03 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_report.c 
  Log:
  MFB: format string fixes
  
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.123r2=1.124diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.123 
php-src/ext/mysqli/mysqli_api.c:1.124
--- php-src/ext/mysqli/mysqli_api.c:1.123   Mon Oct 10 20:16:35 2005
+++ php-src/ext/mysqli/mysqli_api.c Fri Dec 23 18:43:03 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.123 2005/10/10 20:16:35 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.124 2005/12/23 18:43:03 sesser Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1370,7 +1370,7 @@

php_mysqli_set_error(mysql_errno(mysql-mysql), (char *) 
mysql_error(mysql-mysql) TSRMLS_CC);
php_mysqli_throw_sql_exception( mysql-mysql-net.sqlstate, 
mysql-mysql-net.last_errno TSRMLS_CC,
-   
mysql-mysql-net.last_error);
+   
%s, mysql-mysql-net.last_error);
 
RETURN_FALSE;
}
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.57r2=1.58diff_format=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.57 
php-src/ext/mysqli/mysqli_nonapi.c:1.58
--- php-src/ext/mysqli/mysqli_nonapi.c:1.57 Thu Dec 22 14:56:29 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Fri Dec 23 18:43:03 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.57 2005/12/22 14:56:29 zeev Exp $ 
+  $Id: mysqli_nonapi.c,v 1.58 2005/12/23 18:43:03 sesser Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -91,7 +91,7 @@
/* Save error messages */
 
php_mysqli_throw_sql_exception( mysql-mysql-net.sqlstate, 
mysql-mysql-net.last_errno TSRMLS_CC,
-   
mysql-mysql-net.last_error);
+   
%s, mysql-mysql-net.last_error);
 
php_mysqli_set_error(mysql_errno(mysql-mysql), (char *) 
mysql_error(mysql-mysql) TSRMLS_CC);
 
@@ -249,7 +249,7 @@
 
if (!result) {
php_mysqli_throw_sql_exception(mysql-mysql-net.sqlstate, 
mysql-mysql-net.last_errno TSRMLS_CC,
-   
mysql-mysql-net.last_error); 
+   
%s, mysql-mysql-net.last_error); 
RETURN_FALSE;
}
 
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_report.c?r1=1.11r2=1.12diff_format=u
Index: php-src/ext/mysqli/mysqli_report.c
diff -u php-src/ext/mysqli/mysqli_report.c:1.11 
php-src/ext/mysqli/mysqli_report.c:1.12
--- php-src/ext/mysqli/mysqli_report.c:1.11 Wed Aug  3 14:07:31 2005
+++ php-src/ext/mysqli/mysqli_report.c  Fri Dec 23 18:43:03 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_report.c,v 1.11 2005/08/03 14:07:31 sniper Exp $ 
+  $Id: mysqli_report.c,v 1.12 2005/12/23 18:43:03 sesser Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -46,7 +46,7 @@
 
 /* {{{ void php_mysqli_report_error(char *sqlstate, int errorno, char *error) 
*/ 
 void php_mysqli_report_error(char *sqlstate, int errorno, char *error 
TSRMLS_DC) {
-   php_mysqli_throw_sql_exception(sqlstate, errorno TSRMLS_CC, error);
+   php_mysqli_throw_sql_exception(sqlstate, errorno TSRMLS_CC, %s, 
error);
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_warning.c php_mysqli.h /ext/mysqli/tests bug34810.phpt

2005-10-10 Thread Antony Dovgal
tony2001Mon Oct 10 08:59:47 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_warning.c 
php_mysqli.h 
/php-src/ext/mysqli/tests   bug34810.phpt 
  Log:
  MF51: fix #34810 (mysqli::init() and others use wrong $this pointer without 
checks)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.121r2=1.122ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.121 
php-src/ext/mysqli/mysqli_api.c:1.122
--- php-src/ext/mysqli/mysqli_api.c:1.121   Sun Oct  9 13:57:37 2005
+++ php-src/ext/mysqli/mysqli_api.c Mon Oct 10 08:59:47 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.121 2005/10/09 17:57:37 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.122 2005/10/10 12:59:47 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1033,7 +1033,7 @@
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)mysql;
 
-   if (!getThis()) {
+   if (!getThis() || !instanceof_function(Z_OBJCE_P(getThis()), 
mysqli_link_class_entry TSRMLS_CC)) {
MYSQLI_RETURN_RESOURCE(mysqli_resource, 
mysqli_link_class_entry);   
} else {
((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-ptr = mysqli_resource;
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.54r2=1.55ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.54 
php-src/ext/mysqli/mysqli_nonapi.c:1.55
--- php-src/ext/mysqli/mysqli_nonapi.c:1.54 Sat Aug  6 12:56:42 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Oct 10 08:59:47 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.54 2005/08/06 16:56:42 andrey Exp $ 
+  $Id: mysqli_nonapi.c,v 1.55 2005/10/10 12:59:47 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -112,7 +112,7 @@
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)mysql;
 
-   if (!object) {
+   if (!object || !instanceof_function(Z_OBJCE_P(object), 
mysqli_link_class_entry TSRMLS_CC)) {
MYSQLI_RETURN_RESOURCE(mysqli_resource, 
mysqli_link_class_entry);   
} else {
((mysqli_object *) zend_object_store_get_object(object 
TSRMLS_CC))-ptr = mysqli_resource;
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_warning.c?r1=1.5r2=1.6ty=u
Index: php-src/ext/mysqli/mysqli_warning.c
diff -u php-src/ext/mysqli/mysqli_warning.c:1.5 
php-src/ext/mysqli/mysqli_warning.c:1.6
--- php-src/ext/mysqli/mysqli_warning.c:1.5 Wed Aug  3 10:07:31 2005
+++ php-src/ext/mysqli/mysqli_warning.c Mon Oct 10 08:59:47 2005
@@ -201,8 +201,8 @@
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = mysqli_resource-info = (void *)w;
 
-   if (!getThis()) {
-   MYSQLI_RETURN_RESOURCE(mysqli_resource, 
mysqli_link_class_entry);   
+   if (!getThis() || !instanceof_function(Z_OBJCE_P(getThis()), 
mysqli_warning_class_entry TSRMLS_CC)) {
+   MYSQLI_RETURN_RESOURCE(mysqli_resource, 
mysqli_warning_class_entry);
} else {
((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-ptr = mysqli_resource;
((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-valid = 1;
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.54r2=1.55ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.54 
php-src/ext/mysqli/php_mysqli.h:1.55
--- php-src/ext/mysqli/php_mysqli.h:1.54Wed Aug  3 10:07:31 2005
+++ php-src/ext/mysqli/php_mysqli.h Mon Oct 10 08:59:47 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.54 2005/08/03 14:07:31 sniper Exp $ 
+  $Id: php_mysqli.h,v 1.55 2005/10/10 12:59:47 tony2001 Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -191,7 +191,7 @@
 #define MYSQLI_REGISTER_RESOURCE(__ptr, __ce) \
 {\
zval *object = getThis();\
-   if (!object) {\
+   if (!object || !instanceof_function(Z_OBJCE_P(object), 
mysqli_link_class_entry TSRMLS_CC)) {\
object = return_value;\
Z_TYPE_P(object) = IS_OBJECT;\
(object)-value.obj = mysqli_objects_new(__ce TSRMLS_CC);\
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/bug34810.phpt?r1=1.1r2=1.2ty=u
Index: 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2005-10-10 Thread Antony Dovgal
tony2001Mon Oct 10 16:16:35 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  MF51: use proper macros and vars instead of strlen()
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.122r2=1.123ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.122 
php-src/ext/mysqli/mysqli_api.c:1.123
--- php-src/ext/mysqli/mysqli_api.c:1.122   Mon Oct 10 08:59:47 2005
+++ php-src/ext/mysqli/mysqli_api.c Mon Oct 10 16:16:35 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.122 2005/10/10 12:59:47 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.123 2005/10/10 20:16:35 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -571,7 +571,7 @@
case MYSQL_TYPE_VAR_STRING:

convert_to_string_ex(stmt-param.vars[i]);
stmt-stmt-params[i].buffer = 
Z_STRVAL_PP(stmt-param.vars[i]);
-   
stmt-stmt-params[i].buffer_length = strlen(Z_STRVAL_PP(stmt-param.vars[i]));
+   
stmt-stmt-params[i].buffer_length = Z_STRLEN_PP(stmt-param.vars[i]);
break;
case MYSQL_TYPE_DOUBLE:

convert_to_double_ex(stmt-param.vars[i]);
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.55r2=1.56ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.55 
php-src/ext/mysqli/mysqli_nonapi.c:1.56
--- php-src/ext/mysqli/mysqli_nonapi.c:1.55 Mon Oct 10 08:59:47 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Oct 10 16:16:35 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.55 2005/10/10 12:59:47 tony2001 Exp $ 
+  $Id: mysqli_nonapi.c,v 1.56 2005/10/10 20:16:35 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -75,7 +75,7 @@
}
 
 #ifdef HAVE_EMBEDDED_MYSQLI
-   if (hostname  strlen(hostname)) {
+   if (hostname_len  hostname) {
unsigned int external=1;
mysql_options(mysql-mysql, MYSQL_OPT_USE_REMOTE_CONNECTION, 
(char *)external);
} else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-10-09 Thread Andrey Hristov
andrey  Sun Oct  9 13:57:39 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.120r2=1.121ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.120 
php-src/ext/mysqli/mysqli_api.c:1.121
--- php-src/ext/mysqli/mysqli_api.c:1.120   Thu Sep 22 16:14:15 2005
+++ php-src/ext/mysqli/mysqli_api.c Sun Oct  9 13:57:37 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.120 2005/09/22 20:14:15 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.121 2005/10/09 17:57:37 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -802,6 +802,8 @@
add_property_string(return_value, orgtable,(field-org_table ? 
field-org_table : ), 1);
add_property_string(return_value, def,(field-def ? field-def : ), 
1);
add_property_long(return_value, max_length, field-max_length);
+   add_property_long(return_value, length, field-length);
+   add_property_long(return_value, charsetnr, field-charsetnr);
add_property_long(return_value, flags, field-flags);
add_property_long(return_value, type, field-type);
add_property_long(return_value, decimals, field-decimals);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-09-22 Thread Antony Dovgal
tony2001Thu Sep 22 16:14:19 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fix #32081 (mysqli_real_connect(): mysqli.default_socket in php.ini has no 
effect) for real
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.119r2=1.120ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.119 
php-src/ext/mysqli/mysqli_api.c:1.120
--- php-src/ext/mysqli/mysqli_api.c:1.119   Mon Aug 22 08:22:09 2005
+++ php-src/ext/mysqli/mysqli_api.c Thu Sep 22 16:14:15 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.119 2005/08/22 12:22:09 dmitry Exp $ 
+  $Id: mysqli_api.c,v 1.120 2005/09/22 20:14:15 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1360,6 +1360,10 @@
flags ^= CLIENT_LOCAL_FILES;
}
 
+   if (!socket) {
+   socket = MyG(default_socket);
+   }
+
if 
(mysql_real_connect(mysql-mysql,hostname,username,passwd,dbname,port,socket,flags)
 == NULL) {

php_mysqli_set_error(mysql_errno(mysql-mysql), (char *) 
mysql_error(mysql-mysql) TSRMLS_CC);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/mysqli/tests bug33263.phpt

2005-06-17 Thread Georg Richter
georg   Fri Jun 17 12:32:43 2005 EDT

  Added files: 
/php-src/ext/mysqli/tests   bug33263.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fix for bug #33263 (mysqli_real_escape doesn't work in __construct)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.116r2=1.117ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.116 
php-src/ext/mysqli/mysqli_api.c:1.117
--- php-src/ext/mysqli/mysqli_api.c:1.116   Sat May 21 04:38:53 2005
+++ php-src/ext/mysqli/mysqli_api.c Fri Jun 17 12:32:40 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.116 2005/05/21 08:38:53 georg Exp $ 
+  $Id: mysqli_api.c,v 1.117 2005/06/17 16:32:40 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1030,7 +1030,13 @@
 
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)mysql;
-   MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);   
+
+   if (!getThis()) {
+   MYSQLI_RETURN_RESOURCE(mysqli_resource, 
mysqli_link_class_entry);   
+   } else {
+   ((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-ptr = mysqli_resource;
+   ((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-valid = 1;
+   }
 }
 /* }}} */
 
@@ -1743,7 +1749,7 @@
ulong   attr;
int rc;
 
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Olb, mysql_stmt, mysqli_stmt_class_entry, attr, mode) == FAILURE) {
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Oll, mysql_stmt, mysqli_stmt_class_entry, attr, mode) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt); 

http://cvs.php.net/co.php/php-src/ext/mysqli/tests/bug33263.phpt?r=1.1p=1
Index: php-src/ext/mysqli/tests/bug33263.phpt
+++ php-src/ext/mysqli/tests/bug33263.phpt
--TEST--
bug #33263 (mysqli_real_connect in __construct) 
--SKIPIF--
?php require_once('skipif.inc'); ?
--FILE--
?php

include connect.inc;

class test extends mysqli
{
public function __construct($host, $user, $passwd, $db) {
parent::init();
parent::real_connect($host, $user, $passwd, $db);
}
}

$mysql = new test($host, $user, $passwd, test);

$stmt = $mysql-prepare(SELECT DATABASE());
$stmt-execute();
$stmt-bind_result($db);
$stmt-fetch();
$stmt-close();

var_dump($db);

$mysql-close();
?
--EXPECT--
string(4) test

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-21 Thread Georg Richter
georg   Sat May 21 04:38:56 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fix for bug #33090 (mysql_prepare doesn't return error)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.115r2=1.116ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.115 
php-src/ext/mysqli/mysqli_api.c:1.116
--- php-src/ext/mysqli/mysqli_api.c:1.115   Mon May  9 18:29:54 2005
+++ php-src/ext/mysqli/mysqli_api.c Sat May 21 04:38:53 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.115 2005/05/09 22:29:54 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.116 2005/05/21 08:38:53 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1278,14 +1278,22 @@
 
if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) {
if (mysql_stmt_prepare(stmt-stmt, query, query_len)) {
-   if (stmt-stmt-last_errno) {
-   /* if we close the statement handle, we have to 
copy the errors to connection handle */
-   mysql-mysql-net.last_errno = 
stmt-stmt-last_errno;
-   strcpy(mysql-mysql-net.last_error, 
stmt-stmt-last_error);
-   strcpy(mysql-mysql-net.sqlstate, 
stmt-stmt-sqlstate);
-   }
+   char  last_error[MYSQL_ERRMSG_SIZE];
+   char  sqlstate[SQLSTATE_LENGTH+1];  
+   unsigned int last_errno;
+
+   /* mysql_stmt_close clears errors, so we have to store 
them temporarily */
+   last_errno = stmt-stmt-last_errno;
+   memcpy(last_error, stmt-stmt-last_error, 
MYSQL_ERRMSG_SIZE);
+   memcpy(sqlstate, mysql-mysql-net.sqlstate, 
SQLSTATE_LENGTH+1);
+
mysql_stmt_close(stmt-stmt);
stmt-stmt = NULL;
+
+   /* restore error messages */
+   mysql-mysql-net.last_errno = last_errno;
+   memcpy(mysql-mysql-net.last_error, last_error, 
MYSQL_ERRMSG_SIZE);
+   memcpy(mysql-mysql-net.sqlstate, sqlstate, 
SQLSTATE_LENGTH+1);
}
} 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-09 Thread Andrey Hristov
andrey  Mon May  9 17:48:04 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.113r2=1.114ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.113 
php-src/ext/mysqli/mysqli_api.c:1.114
--- php-src/ext/mysqli/mysqli_api.c:1.113   Sat May  7 08:46:29 2005
+++ php-src/ext/mysqli/mysqli_api.c Mon May  9 17:48:03 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.113 2005/05/07 12:46:29 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.114 2005/05/09 21:48:03 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1269,6 +1269,10 @@
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
+   if (mysql-mysql-status == MYSQL_STATUS_GET_RESULT) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, All data must be 
fetched before a new statement prepare takes place);
+   RETURN_FALSE;
+   }
 
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-09 Thread Andrey Hristov
andrey  Mon May  9 18:29:54 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  after throwing an warning bail out
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.114r2=1.115ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.114 
php-src/ext/mysqli/mysqli_api.c:1.115
--- php-src/ext/mysqli/mysqli_api.c:1.114   Mon May  9 17:48:03 2005
+++ php-src/ext/mysqli/mysqli_api.c Mon May  9 18:29:54 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.114 2005/05/09 21:48:03 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.115 2005/05/09 22:29:54 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1521,7 +1521,8 @@
return;
}
if (offset  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset must be 
positive); 
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset must be 
positive);
+   RETURN_FALSE;
}
 
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-07 Thread Andrey Hristov
andrey  Sat May  7 03:44:41 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  bail out when detecting incorrect number of parameters to be bound.
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.109r2=1.110ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.109 
php-src/ext/mysqli/mysqli_api.c:1.110
--- php-src/ext/mysqli/mysqli_api.c:1.109   Fri May  6 06:09:42 2005
+++ php-src/ext/mysqli/mysqli_api.c Sat May  7 03:44:41 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.109 2005/05/06 10:09:42 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.110 2005/05/07 07:44:41 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -109,12 +109,13 @@
start = 1;
}
 
-   if (strlen(types) != argc - start) {
+   if (typelen != argc - start) {
/* number of bind variables doesn't match number of elements in 
type definition string */
php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of elements 
in type definition string doesn't match number of bind variables);
+   RETURN_FALSE;
}
 
-   if (argc - start != stmt-stmt-param_count) {
+   if (typelen != stmt-stmt-param_count) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of 
variables doesn't match number of parameters in prepared statement);
RETURN_FALSE;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-07 Thread Andrey Hristov
andrey  Sat May  7 04:03:36 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  return directly
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.110r2=1.111ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.110 
php-src/ext/mysqli/mysqli_api.c:1.111
--- php-src/ext/mysqli/mysqli_api.c:1.110   Sat May  7 03:44:41 2005
+++ php-src/ext/mysqli/mysqli_api.c Sat May  7 04:03:35 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.110 2005/05/07 07:44:41 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.111 2005/05/07 08:03:35 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -405,7 +405,6 @@
 {
MY_MYSQL*mysql;
zval*mysql_link;
-   char*charsetname;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -413,9 +412,7 @@
 
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
 
-   charsetname = (char *)mysql_character_set_name(mysql-mysql);
-
-   RETURN_STRING(charsetname, 1);
+   RETURN_STRING((char *) mysql_character_set_name(mysql-mysql), 1);
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-07 Thread Andrey Hristov
andrey  Sat May  7 04:23:39 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  return MYSQLI_DATA_TRUNCATED if data happens to be truncated 
  #the manual has to be updated
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.111r2=1.112ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.111 
php-src/ext/mysqli/mysqli_api.c:1.112
--- php-src/ext/mysqli/mysqli_api.c:1.111   Sat May  7 04:03:35 2005
+++ php-src/ext/mysqli/mysqli_api.c Sat May  7 04:23:39 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.111 2005/05/07 08:03:35 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.112 2005/05/07 08:23:39 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -682,6 +682,11 @@
case 1:
RETURN_FALSE;
break;
+#ifdef MYSQL_DATA_TRUNCATED
+   case MYSQL_DATA_TRUNCATED:
+   RETURN_LONG(MYSQL_DATA_TRUNCATED);
+   break;
+#endif
default:
RETURN_NULL();
break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-05-07 Thread Andrey Hristov
andrey  Sat May  7 08:46:29 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  revert this one till we have a better way to inform the user where the
  truncation has occured
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.112r2=1.113ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.112 
php-src/ext/mysqli/mysqli_api.c:1.113
--- php-src/ext/mysqli/mysqli_api.c:1.112   Sat May  7 04:23:39 2005
+++ php-src/ext/mysqli/mysqli_api.c Sat May  7 08:46:29 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.112 2005/05/07 08:23:39 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.113 2005/05/07 12:46:29 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -682,11 +682,6 @@
case 1:
RETURN_FALSE;
break;
-#ifdef MYSQL_DATA_TRUNCATED
-   case MYSQL_DATA_TRUNCATED:
-   RETURN_LONG(MYSQL_DATA_TRUNCATED);
-   break;
-#endif
default:
RETURN_NULL();
break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2005-05-06 Thread Andrey Hristov
andrey  Fri May  6 06:09:45 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  initialize values because the call to zend_parse_parameters may not do it
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.108r2=1.109ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.108 
php-src/ext/mysqli/mysqli_api.c:1.109
--- php-src/ext/mysqli/mysqli_api.c:1.108   Thu May  5 09:02:31 2005
+++ php-src/ext/mysqli/mysqli_api.c Fri May  6 06:09:42 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.108 2005/05/05 13:02:31 georg Exp $ 
+  $Id: mysqli_api.c,v 1.109 2005/05/06 10:09:42 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1307,7 +1307,7 @@
 {
MY_MYSQL*mysql;
char*hostname = NULL, *username=NULL, *passwd=NULL, 
*dbname=NULL, *socket=NULL;
-   unsigned inthostname_len, username_len, passwd_len, dbname_len, 
socket_len;
+   unsigned inthostname_len = 0, username_len = 0, passwd_len = 0, 
dbname_len = 0, socket_len = 0;
unsigned long   port=0, flags=0;
zval*mysql_link;
zval*object = getThis();
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.41r2=1.42ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.41 
php-src/ext/mysqli/mysqli_nonapi.c:1.42
--- php-src/ext/mysqli/mysqli_nonapi.c:1.41 Wed Apr 27 08:12:58 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Fri May  6 06:09:42 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.41 2005/04/27 12:12:58 andrey Exp $ 
+  $Id: mysqli_nonapi.c,v 1.42 2005/05/06 10:09:42 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -37,7 +37,7 @@
MYSQLI_RESOURCE *mysqli_resource;
zval*object = getThis();
char*hostname = NULL, *username=NULL, 
*passwd=NULL, *dbname=NULL, *socket=NULL;
-   unsigned inthostname_len, username_len, passwd_len, 
dbname_len, socket_len;
+   unsigned inthostname_len = 0, username_len = 0, passwd_len 
= 0, dbname_len = 0, socket_len = 0;
longport=0;
 
if (getThis()  !ZEND_NUM_ARGS()) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-04-27 Thread Andrey Hristov
andrey  Wed Apr 27 13:53:19 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fix bug #32013(MySQLi bind_result causes fatal error: memory limit reached)
  #this is a partial fix but it cannot be better. the user has to call
  #$stmt-store_result() and for a BLOB/MEDIUTEXT (and larger) space will be
  #allocated as big as the biggest column value.
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.106r2=1.107ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.106 
php-src/ext/mysqli/mysqli_api.c:1.107
--- php-src/ext/mysqli/mysqli_api.c:1.106   Wed Apr 20 09:24:08 2005
+++ php-src/ext/mysqli/mysqli_api.c Wed Apr 27 13:53:15 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.106 2005/04/20 13:24:08 georg Exp $ 
+  $Id: mysqli_api.c,v 1.107 2005/04/27 17:53:15 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -313,9 +313,21 @@
 #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;
+   stmt-result.buf[ofs].type = IS_STRING;
+   /*
+   If the user has called 
$stmt-store_result() then we have asked
+   max_length to be updated. this is done 
only for BLOBS because we don't want to allocate
+   big chunkgs of memory 2^16 or 2^24 
+   */
+   if (stmt-stmt-fields[ofs].max_length == 0) {
+   stmt-result.buf[ofs].buflen =
+   (stmt-stmt-fields) ? 
(stmt-stmt-fields[ofs].length) ? stmt-stmt-fields[ofs].length + 1: 256: 256;
+   } else {
+   /*
+   the user has called 
store_result(). if he does not there is no way to determine the
+   */
+   stmt-result.buf[ofs].buflen = 
stmt-stmt-fields[ofs].max_length;
+   }
stmt-result.buf[ofs].val = (char 
*)emalloc(stmt-result.buf[ofs].buflen);
bind[ofs].buffer_type = MYSQL_TYPE_STRING;
bind[ofs].buffer = stmt-result.buf[ofs].val;
@@ -1858,12 +1870,28 @@
 {
MY_STMT *stmt;
zval*mysql_stmt;
+   int i=0;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt); 

+   /*
+ If the user wants to store the data and we have BLOBs/TEXTs we try to 
allocate
+ not the maximal length of the type (which is 16MB even for LONGBLOB) 
but
+ the maximal length of the field in the result set. If he/she has 
quite big
+ BLOB/TEXT columns after calling store_result() the memory usage of 
PHP will
+ double - but this is a known problem of the simple MySQL API ;)
+   */
+   for (i = mysql_stmt_field_count(stmt-stmt) - 1; i =0; --i) {
+   if (stmt-stmt-fields  stmt-stmt-fields[i].type == 
MYSQL_TYPE_BLOB) {
+   my_bool tmp=1;
+   mysql_stmt_attr_set(stmt-stmt, 
STMT_ATTR_UPDATE_MAX_LENGTH, tmp);
+   break;
+   }
+   }
+   
if (mysql_stmt_store_result(stmt-stmt)){
MYSQLI_REPORT_STMT_ERROR(stmt-stmt);
RETURN_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-04-20 Thread Georg Richter
georg   Wed Apr 20 09:24:09 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  another fix for last commit (committed from wrong tree) :(
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.105r2=1.106ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.105 
php-src/ext/mysqli/mysqli_api.c:1.106
--- php-src/ext/mysqli/mysqli_api.c:1.105   Wed Apr 20 08:50:13 2005
+++ php-src/ext/mysqli/mysqli_api.c Wed Apr 20 09:24:08 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.105 2005/04/20 12:50:13 georg Exp $ 
+  $Id: mysqli_api.c,v 1.106 2005/04/20 13:24:08 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -610,7 +610,7 @@
 #ifdef MYSQL_DATA_TRUNCATED
if (!ret || ret == MYSQL_DATA_TRUNCATED) {
 #else
-   if (!ret || ret == MYSQL_DATA_TRUNCATED) {
+   if (!ret) {
 #endif
for (i = 0; i  stmt-result.var_cnt; i++) {
if (stmt-result.vars[i]-type == IS_STRING  
stmt-result.vars[i]-value.str.len) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/mysqli/tests 014.phpt

2005-04-19 Thread Andrey Hristov
andrey  Tue Apr 19 08:59:16 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
/php-src/ext/mysqli/tests   014.phpt 
  Log:
  - fixing all long into int fetching problems (cause memory corruption
on 64 bit)
  - nail down a problem because of the new MYSQL_TYPE_NEWDECIMAL introduced
in MySQL 5.0+
  - Add more info to the autocommit test
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.102r2=1.103ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.102 
php-src/ext/mysqli/mysqli_api.c:1.103
--- php-src/ext/mysqli/mysqli_api.c:1.102   Thu Mar 17 13:12:06 2005
+++ php-src/ext/mysqli/mysqli_api.c Tue Apr 19 08:59:15 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.102 2005/03/17 18:12:06 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.103 2005/04/19 12:59:15 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -310,6 +310,9 @@
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;
@@ -749,7 +752,7 @@
MYSQL_RES   *result;
zval*mysql_result;
MYSQL_FIELD *field;
-   int offset;
+   longoffset;
 
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 @@
 {
MYSQL_RES   *result;
zval*mysql_result;
-   unsigned intfieldnr;
+   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 @@
 {
MY_MYSQL*mysql;
zval*mysql_link;
-   int processid;
+   longprocessid;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Ol, mysql_link, mysqli_link_class_entry, processid) == FAILURE) {
return;
@@ -1097,7 +1100,8 @@
 
 /* {{{ proto bool mysqli_more_results(object link)
check if there any more query results from a multi query */
-PHP_FUNCTION(mysqli_more_results) {
+PHP_FUNCTION(mysqli_more_results)
+{
MY_MYSQL*mysql;
zval*mysql_link;
 
@@ -1277,7 +1281,7 @@
MY_MYSQL*mysql;
char*hostname = NULL, *username=NULL, *passwd=NULL, 
*dbname=NULL, *socket=NULL;
unsigned inthostname_len, username_len, passwd_len, dbname_len, 
socket_len;
-   unsigned intport=0, flags=0;
+   unsigned long   port=0, flags=0;
zval*mysql_link;
zval*object = getThis();
 
@@ -1414,7 +1418,8 @@
MY_STMT *stmt;
zval*mysql_stmt;
char*data;
-   longparam_nr, data_len;
+   longparam_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) {
@@ -1693,7 +1698,7 @@
 {
MY_STMT *stmt;
zval*mysql_stmt;
-   ulong   mode;
+   zend_bool mode;
ulong   attr;
int rc;
 
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/014.phpt?r1=1.7r2=1.8ty=u
Index: php-src/ext/mysqli/tests/014.phpt
diff -u php-src/ext/mysqli/tests/014.phpt:1.7 
php-src/ext/mysqli/tests/014.phpt:1.8
--- php-src/ext/mysqli/tests/014.phpt:1.7   Fri Jan  7 09:59:59 2005
+++ php-src/ext/mysqli/tests/014.phpt   Tue Apr 19 08:59:16 2005
@@ -36,6 +36,7 @@
mysqli_rollback($link);
 
$result = mysqli_query($link, SELECT * FROM ac_01);
+   printf(Num_of_rows=%d\n, mysqli_num_rows($result));
$row = mysqli_fetch_row($result);
mysqli_free_result($result);
 
@@ -54,6 +55,7 @@
mysqli_close($link);
 ?
 --EXPECT--
+Num_of_rows=1
 array(2) {
   [0]=
   string(1) 1

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-04-19 Thread Andrey Hristov
andrey  Tue Apr 19 09:28:44 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  - nail down another 64bit problem. this will fix about 14 failing tests
on amd64 (probably other 64 bit arch).
  - use ulong for this boolean variable, as it was before
  - throw an warning if offset passed to mysqli_stmt_data_seek is negative
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.103r2=1.104ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.103 
php-src/ext/mysqli/mysqli_api.c:1.104
--- php-src/ext/mysqli/mysqli_api.c:1.103   Tue Apr 19 08:59:15 2005
+++ php-src/ext/mysqli/mysqli_api.c Tue Apr 19 09:28:41 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.103 2005/04/19 12:59:15 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.104 2005/04/19 13:28:41 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -588,7 +588,7 @@
zval*mysql_stmt;
unsigned inti;
ulong   ret;
-   longlval;
+   int lval;
double  dval;
my_ulonglongllval;

@@ -614,11 +614,11 @@
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:
@@ -1491,6 +1491,9 @@
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);
 
@@ -1698,7 +1701,7 @@
 {
MY_STMT *stmt;
zval*mysql_stmt;
-   zend_bool mode;
+   ulong   mode;
ulong   attr;
int rc;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-01-27 Thread Georg Richter
georg   Thu Jan 27 05:18:30 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fix for bug #31710 (return value for mysql_rollback is reverted)
  fixed also same behaviour for mysql_commit and mysql_autocommit
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.99r2=1.100ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.99 
php-src/ext/mysqli/mysqli_api.c:1.100
--- php-src/ext/mysqli/mysqli_api.c:1.99Wed Jan 26 20:14:43 2005
+++ php-src/ext/mysqli/mysqli_api.c Thu Jan 27 05:18:28 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.99 2005/01/27 01:14:43 tony2001 Exp $ 
+  $Id: mysqli_api.c,v 1.100 2005/01/27 10:18:28 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -54,7 +54,6 @@
 {
MY_MYSQL*mysql;
zval*mysql_link;
-   unsigned long   rc;
unsigned long   automode;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
Ob, mysql_link, mysqli_link_class_entry, automode) == FAILURE) {
@@ -62,9 +61,10 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
 
-   rc = (long) mysql_autocommit(mysql-mysql, automode);
-
-   RETURN_BOOL(rc);
+   if (mysql_autocommit(mysql-mysql, automode)) {
+   RETURN_FALSE;
+   }
+   RETURN_TRUE;
 }
 /* }}} */
 
@@ -417,14 +417,15 @@
 {
MY_MYSQL*mysql;
zval*mysql_link;
-   ulong   rc;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
-   rc = mysql_commit(mysql-mysql);
-   RETURN_BOOL(rc);
+   if (mysql_commit(mysql-mysql)) {
+   RETURN_FALSE;
+   }
+   RETURN_TRUE;
 }
 /* }}} */
 
@@ -1396,7 +1397,10 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
 
-   RETURN_BOOL(mysql_rollback(mysql-mysql));
+   if (mysql_rollback(mysql-mysql)) {
+   RETURN_FALSE;
+   }
+   RETURN_TRUE;
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2005-01-26 Thread Antony Dovgal
tony2001Wed Jan 26 20:14:44 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  MFB: fix segfault when invalid field offset is passed to 
mysqli_fetch_field_direct()
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.98r2=1.99ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.98 
php-src/ext/mysqli/mysqli_api.c:1.99
--- php-src/ext/mysqli/mysqli_api.c:1.98Fri Jan  7 09:59:59 2005
+++ php-src/ext/mysqli/mysqli_api.c Wed Jan 26 20:14:43 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.98 2005/01/07 14:59:59 georg Exp $ 
+  $Id: mysqli_api.c,v 1.99 2005/01/27 01:14:43 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -752,6 +752,11 @@
}
 
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, 
mysqli_result); 
+   
+   if (offset  0 || offset = mysql_num_fields(result)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Field offset is 
invalid for resultset);
+   RETURN_FALSE; 
+   }
 
if (!(field = mysql_fetch_field_direct(result,offset))) {
RETURN_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-12-27 Thread Georg Richter
georg   Mon Dec 27 06:48:58 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  Fix for feature request #31015: added length for field length
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.95r2=1.96ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.95 
php-src/ext/mysqli/mysqli_api.c:1.96
--- php-src/ext/mysqli/mysqli_api.c:1.95Mon Dec 20 11:39:14 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Dec 27 06:48:57 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.95 2004/12/20 16:39:14 georg Exp $ 
+  $Id: mysqli_api.c,v 1.96 2004/12/27 11:48:57 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -682,6 +682,8 @@
add_property_string(return_value, orgtable,(field-org_table ? 
field-org_table : ), 1);
add_property_string(return_value, def,(field-def ? field-def : ), 
1);
add_property_long(return_value, max_length, field-max_length);
+   add_property_long(return_value, length, field-length);
+   add_property_long(return_value, charsetnr, field-charsetnr);
add_property_long(return_value, flags, field-flags);
add_property_long(return_value, type, field-type);
add_property_long(return_value, decimals, field-decimals);
@@ -724,6 +726,8 @@
add_property_string(obj, orgtable,(field-org_table ? 
field-org_table : ), 1);
add_property_string(obj, def,(field-def ? field-def : ), 
1);
add_property_long(obj, max_length, field-max_length);
+   add_property_long(obj, length, field-length);
+   add_property_long(obj, charsetnr, field-charsetnr);
add_property_long(obj, flags, field-flags);
add_property_long(obj, type, field-type);
add_property_long(obj, decimals, field-decimals);
@@ -980,12 +984,12 @@
 {
MY_MYSQL *mysql = (MY_MYSQL *)calloc(1, sizeof(MY_MYSQL));
 
-   MYSQLI_RESOURCE *mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
-
if (!(mysql-mysql = mysql_init(NULL))) {
efree(mysql);
RETURN_FALSE;
}
+
+   MYSQLI_RESOURCE *mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)mysql;
MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);   
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c /ext/mysqli/tests 047.phpt

2004-12-27 Thread Georg Richter
georg   Mon Dec 27 10:39:35 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
/php-src/ext/mysqli/tests   047.phpt 
  Log:
  fixed testcase 047
  fixed windows compile error 
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.96r2=1.97ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.96 
php-src/ext/mysqli/mysqli_api.c:1.97
--- php-src/ext/mysqli/mysqli_api.c:1.96Mon Dec 27 06:48:57 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Dec 27 10:39:34 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.96 2004/12/27 11:48:57 georg Exp $ 
+  $Id: mysqli_api.c,v 1.97 2004/12/27 15:39:34 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -982,6 +982,7 @@
Initialize mysqli and return a resource for use with mysql_real_connect */
 PHP_FUNCTION(mysqli_init)
 {
+   MYSQLI_RESOURCE *mysqli_resource;
MY_MYSQL *mysql = (MY_MYSQL *)calloc(1, sizeof(MY_MYSQL));
 
if (!(mysql-mysql = mysql_init(NULL))) {
@@ -989,7 +990,7 @@
RETURN_FALSE;
}
 
-   MYSQLI_RESOURCE *mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
+   mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)mysql;
MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);   
 }
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/047.phpt?r1=1.6r2=1.7ty=u
Index: php-src/ext/mysqli/tests/047.phpt
diff -u php-src/ext/mysqli/tests/047.phpt:1.6 
php-src/ext/mysqli/tests/047.phpt:1.7
--- php-src/ext/mysqli/tests/047.phpt:1.6   Sat Dec  4 03:50:33 2004
+++ php-src/ext/mysqli/tests/047.phpt   Mon Dec 27 10:39:35 2004
@@ -12,7 +12,7 @@
mysqli_select_db($link, test);
 
mysqli_query($link, DROP TABLE IF EXISTS test_affected);
-   mysqli_query($link, CREATE TABLE test_affected (foo int, bar 
varchar(10)));
+   mysqli_query($link, CREATE TABLE test_affected (foo int, bar 
varchar(10) character set latin1));
 
mysqli_query($link, INSERT INTO test_affected VALUES (1, 'Zak'),(2, 
'Greant'));
 
@@ -31,7 +31,7 @@
 --EXPECTF--
 array(2) {
   [0]=
-  object(stdClass)#%d (9) {
+  object(stdClass)#4 (11) {
 [name]=
 string(3) foo
 [orgname]=
@@ -44,6 +44,10 @@
 string(0) 
 [max_length]=
 int(0)
+[length]=
+int(11)
+[charsetnr]=
+int(63)
 [flags]=
 int(32768)
 [type]=
@@ -52,7 +56,7 @@
 int(0)
   }
   [1]=
-  object(stdClass)#%d (9) {
+  object(stdClass)#5 (11) {
 [name]=
 string(3) bar
 [orgname]=
@@ -65,6 +69,10 @@
 string(0) 
 [max_length]=
 int(0)
+[length]=
+int(10)
+[charsetnr]=
+int(8)
 [flags]=
 int(0)
 [type]=

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-12-20 Thread Georg Richter
georg   Mon Dec 20 11:39:15 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  prevent type conversion during mysql_stmt_execute for NULL variables
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.94r2=1.95ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.94 
php-src/ext/mysqli/mysqli_api.c:1.95
--- php-src/ext/mysqli/mysqli_api.c:1.94Mon Nov  1 02:19:23 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Dec 20 11:39:14 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.94 2004/11/01 07:19:23 georg Exp $ 
+  $Id: mysqli_api.c,v 1.95 2004/12/20 16:39:14 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -539,24 +539,24 @@

for (i = 0; i  stmt-param.var_cnt; i++) { 
if (stmt-param.vars[i]) {
-   stmt-param.is_null[i] = (stmt-param.vars[i]-type == 
IS_NULL);
-
-   switch (stmt-stmt-params[i].buffer_type) {
-   case MYSQL_TYPE_VAR_STRING:
-   
convert_to_string_ex(stmt-param.vars[i]);
-   stmt-stmt-params[i].buffer = 
Z_STRVAL_PP(stmt-param.vars[i]);
-   stmt-stmt-params[i].buffer_length = 
strlen(Z_STRVAL_PP(stmt-param.vars[i]));
-   break;
-   case MYSQL_TYPE_DOUBLE:
-   
convert_to_double_ex(stmt-param.vars[i]);
-   stmt-stmt-params[i].buffer = 
(gptr)Z_LVAL_PP(stmt-param.vars[i]);
-   break;
-   case MYSQL_TYPE_LONG:
-   
convert_to_long_ex(stmt-param.vars[i]);
-   stmt-stmt-params[i].buffer = 
(gptr)Z_LVAL_PP(stmt-param.vars[i]);
-   break;
-   default:
-   break;
+   if ( !(stmt-param.is_null[i] = 
(stmt-param.vars[i]-type == IS_NULL)) ) {
+   switch (stmt-stmt-params[i].buffer_type) {
+   case MYSQL_TYPE_VAR_STRING:
+   
convert_to_string_ex(stmt-param.vars[i]);
+   stmt-stmt-params[i].buffer = 
Z_STRVAL_PP(stmt-param.vars[i]);
+   
stmt-stmt-params[i].buffer_length = strlen(Z_STRVAL_PP(stmt-param.vars[i]));
+   break;
+   case MYSQL_TYPE_DOUBLE:
+   
convert_to_double_ex(stmt-param.vars[i]);
+   stmt-stmt-params[i].buffer = 
(gptr)Z_LVAL_PP(stmt-param.vars[i]);
+   break;
+   case MYSQL_TYPE_LONG:
+   
convert_to_long_ex(stmt-param.vars[i]);
+   stmt-stmt-params[i].buffer = 
(gptr)Z_LVAL_PP(stmt-param.vars[i]);
+   break;
+   default:
+   break;
+   }
}   
}
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c /ext/mysqli/tests 003.phpt 020.phpt

2004-10-31 Thread Georg Richter
georg   Mon Nov  1 02:19:26 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
/php-src/ext/mysqli/tests   003.phpt 020.phpt 
  Log:
  Fixed tests for empty dates (see http://bugs.mysql.com/?id=6058)
  Fixed memleak in mysqli_stmt_bind_result
  Fixed error handling for mysqli_multi_query
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.93r2=1.94ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.93 php-src/ext/mysqli/mysqli_api.c:1.94
--- php-src/ext/mysqli/mysqli_api.c:1.93Sat Sep  4 10:16:52 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Nov  1 02:19:23 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.93 2004/09/04 14:16:52 georg Exp $ 
+  $Id: mysqli_api.c,v 1.94 2004/11/01 07:19:23 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -217,6 +217,16 @@
zval*mysql_stmt;
MYSQL_BIND  *bind;
 
+   if (getThis()) {
+   start = 0;
+   }
+
+   if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), O, 
mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+   return; 
+   }
+
+   MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt); 
+
if (argc  (getThis() ? 1 : 2))  {
WRONG_PARAM_COUNT;
}
@@ -228,16 +238,6 @@
WRONG_PARAM_COUNT;
}
 
-   if (getThis()) {
-   start = 0;
-   }
-
-   if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), O, 
mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
-   return; 
-   }
-
-   MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt); 
-   
var_cnt = argc - start;
 
if (var_cnt != mysql_stmt_field_count(stmt-stmt)) {
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.36r2=1.37ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.36 php-src/ext/mysqli/mysqli_nonapi.c:1.37
--- php-src/ext/mysqli/mysqli_nonapi.c:1.36 Tue Oct 19 01:14:09 2004
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Nov  1 02:19:24 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.36 2004/10/19 05:14:09 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.37 2004/11/01 07:19:24 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -222,8 +222,23 @@
 
MYSQLI_ENABLE_MQ;   
if (mysql_real_query(mysql-mysql, query, query_len)) {
-   MYSQLI_DISABLE_MQ;
+   char s_error[MYSQL_ERRMSG_SIZE], s_sqlstate[SQLSTATE_LENGTH+1];
+   unsigned int s_errno;
MYSQLI_REPORT_MYSQL_ERROR(mysql-mysql);
+
+   /* we have to save error information, cause 
+   MYSQLI_DISABLE_MQ will reset error information */
+   strcpy(s_error, mysql_error(mysql-mysql));
+   strcpy(s_sqlstate, mysql_sqlstate(mysql-mysql));
+   s_errno = mysql_errno(mysql-mysql);
+
+   MYSQLI_DISABLE_MQ;
+
+   /* restore error information */
+   strcpy(mysql-mysql-net.last_error, s_error);
+   strcpy(mysql-mysql-net.sqlstate, s_sqlstate);
+   mysql-mysql-net.last_errno = s_errno; 
+
RETURN_FALSE;
}   
RETURN_TRUE;
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/003.phpt?r1=1.2r2=1.3ty=u
Index: php-src/ext/mysqli/tests/003.phpt
diff -u php-src/ext/mysqli/tests/003.phpt:1.2 php-src/ext/mysqli/tests/003.phpt:1.3
--- php-src/ext/mysqli/tests/003.phpt:1.2   Sat Jun 28 17:30:58 2003
+++ php-src/ext/mysqli/tests/003.phpt   Mon Nov  1 02:19:26 2004
@@ -50,7 +50,7 @@
   [4]=
   string(19) 2010-07-10 00:00:00
   [5]=
-  string(0) 
+  string(19) -00-00 00:00:00
   [6]=
   string(19) 1999-12-29 00:00:00
 }
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/020.phpt?r1=1.3r2=1.4ty=u
Index: php-src/ext/mysqli/tests/020.phpt
diff -u php-src/ext/mysqli/tests/020.phpt:1.3 php-src/ext/mysqli/tests/020.phpt:1.4
--- php-src/ext/mysqli/tests/020.phpt:1.3   Wed Feb 11 02:39:28 2004
+++ php-src/ext/mysqli/tests/020.phpt   Mon Nov  1 02:19:26 2004
@@ -58,7 +58,7 @@
   [4]=
   string(19) 2010-07-10 00:00:00
   [5]=
-  string(0) 
+  string(19) -00-00 00:00:00
   [6]=
   string(19) 1999-12-29 00:00:00
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-09-04 Thread Georg Richter
georg   Sat Sep  4 10:16:53 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  forgot to remove comment in last commit
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.92r2=1.93ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.92 php-src/ext/mysqli/mysqli_api.c:1.93
--- php-src/ext/mysqli/mysqli_api.c:1.92Wed Aug 25 09:57:35 2004
+++ php-src/ext/mysqli/mysqli_api.c Sat Sep  4 10:16:52 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.92 2004/08/25 13:57:35 georg Exp $ 
+  $Id: mysqli_api.c,v 1.93 2004/09/04 14:16:52 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -258,7 +258,6 @@
for (i=start; i  var_cnt + start ; i++) {
ofs = i - start;
stmt-result.is_null[ofs] = 0;
-   //bind[ofs].truncated = NULL;
col_type = (stmt-stmt-fields) ? stmt-stmt-fields[ofs].type : 
MYSQL_TYPE_STRING;
 
switch (col_type) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-08-12 Thread Georg Richter
georg   Thu Aug 12 18:14:06 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  minor fix in mysqli_prepare: copying stmt errormessag to mysql structure
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.90r2=1.91ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.90 php-src/ext/mysqli/mysqli_api.c:1.91
--- php-src/ext/mysqli/mysqli_api.c:1.90Wed Jul 21 23:23:33 2004
+++ php-src/ext/mysqli/mysqli_api.c Thu Aug 12 18:14:06 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.90 2004/07/22 03:23:33 pollita Exp $ 
+  $Id: mysqli_api.c,v 1.91 2004/08/12 22:14:06 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1243,6 +1243,12 @@
 
if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) {
if (mysql_stmt_prepare(stmt-stmt, query, query_len)) {
+   if (stmt-stmt-last_errno) {
+   /* if we close the statement handle, we have to copy 
the errors to connection handle */
+   mysql-mysql-net.last_errno = stmt-stmt-last_errno;
+   strcpy(mysql-mysql-net.last_error, 
stmt-stmt-last_error);
+   strcpy(mysql-mysql-net.sqlstate, 
stmt-stmt-sqlstate);
+   }
mysql_stmt_close(stmt-stmt);
stmt-stmt = NULL;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-07-21 Thread Sara Golemon
pollita Wed Jul 21 23:23:33 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  This should fix binary safety for bound results or may coogle strike me down.
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.89r2=1.90ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.89 php-src/ext/mysqli/mysqli_api.c:1.90
--- php-src/ext/mysqli/mysqli_api.c:1.89Mon Jul 19 03:19:40 2004
+++ php-src/ext/mysqli/mysqli_api.c Wed Jul 21 23:23:33 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.89 2004/07/19 07:19:40 andi Exp $ 
+  $Id: mysqli_api.c,v 1.90 2004/07/22 03:23:33 pollita Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -629,7 +629,7 @@

ZVAL_LONG(stmt-result.vars[i], llval);
}
} else {
-   
ZVAL_STRING(stmt-result.vars[i], stmt-result.buf[i].val, 1); 
+   
ZVAL_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, 
stmt-result.buf[i].buflen, 1); 
}
break;
default:

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-07-17 Thread Georg Richter
georg   Sat Jul 17 06:48:28 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed paraenthesis warning in mysql_stmt_attr_set/get
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.87r2=1.88ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.87 php-src/ext/mysqli/mysqli_api.c:1.88
--- php-src/ext/mysqli/mysqli_api.c:1.87Tue Jul 13 13:04:16 2004
+++ php-src/ext/mysqli/mysqli_api.c Sat Jul 17 06:48:28 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.87 2004/07/13 17:04:16 georg Exp $ 
+  $Id: mysqli_api.c,v 1.88 2004/07/17 10:48:28 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1720,7 +1720,7 @@
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt); 
 
-   if (rc = mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) {
+   if ((rc = mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode))) {
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1742,7 +1742,7 @@
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt); 
 
-   if (rc = mysql_stmt_attr_get(stmt-stmt, attr, value)) {
+   if ((rc = mysql_stmt_attr_get(stmt-stmt, attr, value))) {
RETURN_FALSE;
}
RETURN_LONG(value);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-07-13 Thread Georg Richter
georg   Tue Jul 13 12:12:30 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  changed mysqli_stmt_reset (returns now bool instead of void)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.85r2=1.86ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.85 php-src/ext/mysqli/mysqli_api.c:1.86
--- php-src/ext/mysqli/mysqli_api.c:1.85Wed Jul  7 04:02:27 2004
+++ php-src/ext/mysqli/mysqli_api.c Tue Jul 13 12:12:28 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.85 2004/07/07 08:02:27 georg Exp $ 
+  $Id: mysqli_api.c,v 1.86 2004/07/13 16:12:28 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1580,7 +1580,7 @@
 }
 /* }}} */
 
-/* {{{ proto void mysqli_stmt_reset(object stmt)
+/* {{{ proto bool mysqli_stmt_reset(object stmt)
reset a prepared statement */
 PHP_FUNCTION(mysqli_stmt_reset) 
 {
@@ -1593,9 +1593,10 @@
 
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt);
 
-   mysql_stmt_reset(stmt-stmt);
-
-   return;
+   if (mysql_stmt_reset(stmt-stmt)) {
+   RETURN_FALSE;
+   }
+   RETURN_TRUE;
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-07-13 Thread Georg Richter
georg   Tue Jul 13 13:04:16 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  prototype fixes
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.86r2=1.87ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.86 php-src/ext/mysqli/mysqli_api.c:1.87
--- php-src/ext/mysqli/mysqli_api.c:1.86Tue Jul 13 12:12:28 2004
+++ php-src/ext/mysqli/mysqli_api.c Tue Jul 13 13:04:16 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.86 2004/07/13 16:12:28 georg Exp $ 
+  $Id: mysqli_api.c,v 1.87 2004/07/13 17:04:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1241,7 +1241,7 @@
 
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
 
-if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) {
+   if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) {
if (mysql_stmt_prepare(stmt-stmt, query, query_len)) {
mysql_stmt_close(stmt-stmt);
stmt-stmt = NULL;
@@ -1781,7 +1781,7 @@
 }
 /* }}} */
 
-/* {{{ proto object mysqli_stmt_init(object link)
+/* {{{ proto mixed mysqli_stmt_init(object link)
Initialize statement object
 */
 PHP_FUNCTION(mysqli_stmt_init)
@@ -1809,7 +1809,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_stmt_prepare(object link, string query)
+/* {{{ proto bool mysqli_stmt_prepare(object stmt, string query)
prepare server side statement with query
 */
 PHP_FUNCTION(mysqli_stmt_prepare)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-06-08 Thread Georg Richter
georg   Tue Jun  8 02:20:58 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed crash (changed MYSQL TO MY_MYSQL in mysql_stmt_init)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.83r2=1.84ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.83 php-src/ext/mysqli/mysqli_api.c:1.84
--- php-src/ext/mysqli/mysqli_api.c:1.83Sun Jun  6 04:52:19 2004
+++ php-src/ext/mysqli/mysqli_api.c Tue Jun  8 02:20:58 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.83 2004/06/06 08:52:19 georg Exp $ 
+  $Id: mysqli_api.c,v 1.84 2004/06/08 06:20:58 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1748,7 +1748,7 @@
 */
 PHP_FUNCTION(mysqli_stmt_init)
 {
-   MYSQL   *mysql;
+   MY_MYSQL*mysql;
MY_STMT *stmt;
zval*mysql_link;
MYSQLI_RESOURCE *mysqli_resource; 
@@ -1756,11 +1756,11 @@
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O,mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
}
-   MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
+   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
 
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
 
-   if (!(stmt-stmt = mysql_stmt_init(mysql))) {
+   if (!(stmt-stmt = mysql_stmt_init(mysql-mysql))) {
efree(stmt);
RETURN_FALSE;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-06-08 Thread Steph
win32 build's failing now only on one export:

mysqli_prop.obj : error LNK2001: unresolved external symbol
_mysql_stmt_insert_id
Release_TS\php5ts.dll : fatal error LNK1120: 1 unresolved externals

I'm a tad confused by this - mysql_stmt_insert_id is already listed in the
libmysql defs exports, but that only seems to cover the declaration in
mysqli_api.c, and not the mapping in mysqli_prop.c

Clues would be good :)



 -Original Message-
 From: Georg Richter [mailto:[EMAIL PROTECTED]
 Sent: 08 June 2004 07:21
 To: [EMAIL PROTECTED]
 Subject: [PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c


 georg Tue Jun  8 02:20:58 2004 EDT

   Modified files:
 /php-src/ext/mysqli   mysqli_api.c
   Log:
   fixed crash (changed MYSQL TO MY_MYSQL in mysql_stmt_init)


 http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.8
 3r2=1.84ty=u
 Index: php-src/ext/mysqli/mysqli_api.c
 diff -u php-src/ext/mysqli/mysqli_api.c:1.83
 php-src/ext/mysqli/mysqli_api.c:1.84
 --- php-src/ext/mysqli/mysqli_api.c:1.83  Sun Jun  6 04:52:19 2004
 +++ php-src/ext/mysqli/mysqli_api.c   Tue Jun  8 02:20:58 2004
 @@ -15,7 +15,7 @@
| Author: Georg Richter [EMAIL PROTECTED]
 |

 +--+

 -  $Id: mysqli_api.c,v 1.83 2004/06/06 08:52:19 georg Exp $
 +  $Id: mysqli_api.c,v 1.84 2004/06/08 06:20:58 georg Exp $
  */

  #ifdef HAVE_CONFIG_H
 @@ -1748,7 +1748,7 @@
  */
  PHP_FUNCTION(mysqli_stmt_init)
  {
 - MYSQL   *mysql;
 + MY_MYSQL*mysql;
   MY_STMT *stmt;
   zval*mysql_link;
   MYSQLI_RESOURCE *mysqli_resource;
 @@ -1756,11 +1756,11 @@
   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
 getThis(), O,mysql_link, mysqli_link_class_entry) == FAILURE) {
   return;
   }
 - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
 + MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link,
 mysqli_link);

   stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));

 - if (!(stmt-stmt = mysql_stmt_init(mysql))) {
 + if (!(stmt-stmt = mysql_stmt_init(mysql-mysql))) {
   efree(stmt);
   RETURN_FALSE;
   }

 --
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h

2004-06-06 Thread Georg Richter
georg   Sun Jun  6 04:52:19 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h 
  Log:
  removed conditional defines for load_data_infile_handlers on windows
  (4.1.2 windows build is fixed now on mysql.com)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.82r2=1.83ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.82 php-src/ext/mysqli/mysqli_api.c:1.83
--- php-src/ext/mysqli/mysqli_api.c:1.82Sat Jun  5 14:31:56 2004
+++ php-src/ext/mysqli/mysqli_api.c Sun Jun  6 04:52:19 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.82 2004/06/05 18:31:56 georg Exp $ 
+  $Id: mysqli_api.c,v 1.83 2004/06/06 08:52:19 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1042,7 +1042,6 @@
 }
 /* }}} */
 
-#ifndef PHP_WIN32
 /* {{{ proto mysqli_set_local_infile_default(object link)
unsets user defined handler for load local infile command */
 PHP_FUNCTION(mysqli_set_local_infile_default)
@@ -1105,7 +1104,6 @@
php_local_infile_end, php_local_infile_error, (void 
*)mysql); 
 }
 /* }}} */
-#endif
 
 /* {{{ proto bool mysqli_more_results(object link)
check if there any more query results from a multi query */
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.36r2=1.37ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.36 php-src/ext/mysqli/mysqli_fe.c:1.37
--- php-src/ext/mysqli/mysqli_fe.c:1.36 Sat Jun  5 14:31:56 2004
+++ php-src/ext/mysqli/mysqli_fe.c  Sun Jun  6 04:52:19 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.36 2004/06/05 18:31:56 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.37 2004/06/06 08:52:19 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -96,10 +96,8 @@
PHP_FE(mysqli_info,
 NULL)
PHP_FE(mysqli_insert_id,   
 NULL)
PHP_FE(mysqli_kill,
 NULL)
-#ifndef PHP_WIN32
PHP_FE(mysqli_set_local_infile_default, NULL)
PHP_FE(mysqli_set_local_infile_handler, NULL)
-#endif
PHP_FE(mysqli_master_query,
 NULL)
PHP_FE(mysqli_more_results,
 NULL)
PHP_FE(mysqli_multi_query, 
 NULL)
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.36r2=1.37ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.36 php-src/ext/mysqli/php_mysqli.h:1.37
--- php-src/ext/mysqli/php_mysqli.h:1.36Sat Jun  5 14:31:56 2004
+++ php-src/ext/mysqli/php_mysqli.h Sun Jun  6 04:52:19 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.36 2004/06/05 18:31:56 georg Exp $ 
+  $Id: php_mysqli.h,v 1.37 2004/06/06 08:52:19 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -310,10 +310,8 @@
 PHP_FUNCTION(mysqli_insert_id);
 PHP_FUNCTION(mysqli_init);
 PHP_FUNCTION(mysqli_kill);
-#ifndef PHP_WIN32
 PHP_FUNCTION(mysqli_set_local_infile_default);
 PHP_FUNCTION(mysqli_set_local_infile_handler);
-#endif
 PHP_FUNCTION(mysqli_master_query);
 PHP_FUNCTION(mysqli_more_results);
 PHP_FUNCTION(mysqli_multi_query);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-03-18 Thread Georg Richter
georg   Thu Mar 18 08:04:56 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed problems in mysql_stmt_init (missing alloc from stmt)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.80r2=1.81ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.80 php-src/ext/mysqli/mysqli_api.c:1.81
--- php-src/ext/mysqli/mysqli_api.c:1.80Tue Mar 16 16:43:25 2004
+++ php-src/ext/mysqli/mysqli_api.c Thu Mar 18 08:04:55 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.80 2004/03/16 21:43:25 georg Exp $ 
+  $Id: mysqli_api.c,v 1.81 2004/03/18 13:04:55 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1675,7 +1675,10 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
 
+   stmt = (STMT *)ecalloc(1,sizeof(STMT));
+
if (!(stmt-stmt = mysql_stmt_init(mysql))) {
+   efree(stmt);
RETURN_FALSE;
}
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h

2004-03-10 Thread Georg Richter
georg   Wed Mar 10 04:50:07 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c php_mysqli.h mysqli_fe.c 
  Log:
  added new function mysql_stmt_free_result
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.78r2=1.79ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.78 php-src/ext/mysqli/mysqli_api.c:1.79
--- php-src/ext/mysqli/mysqli_api.c:1.78Tue Mar  9 07:01:23 2004
+++ php-src/ext/mysqli/mysqli_api.c Wed Mar 10 04:50:05 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.78 2004/03/09 12:01:23 georg Exp $ 
+  $Id: mysqli_api.c,v 1.79 2004/03/10 09:50:05 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1483,6 +1483,27 @@
 }
 /* }}} */
 
+#ifndef HAVE_MYSQLI_OLDAPI
+/* {{{ proto void mysqli_stmt_free_result(object stmt)
+   Free stored result memory for the given statement handle */
+PHP_FUNCTION(mysqli_stmt_free_result) 
+{
+   STMT*stmt;
+   zval*mysql_stmt;
+
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, 
mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+   return;
+   }
+
+   MYSQLI_FETCH_RESOURCE(stmt, STMT *, mysql_stmt, mysqli_stmt);
+
+   mysql_stmt_free_result(stmt-stmt);
+
+   return;
+}
+/* }}} */
+#endif
+
 /* {{{ proto mixed mysqli_stmt_num_rows(object stmt)
Return the number of rows in statements result set */
 PHP_FUNCTION(mysqli_stmt_num_rows)
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.33r2=1.34ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.33 php-src/ext/mysqli/php_mysqli.h:1.34
--- php-src/ext/mysqli/php_mysqli.h:1.33Tue Mar  9 07:01:23 2004
+++ php-src/ext/mysqli/php_mysqli.h Wed Mar 10 04:50:05 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.33 2004/03/09 12:01:23 georg Exp $ 
+  $Id: php_mysqli.h,v 1.34 2004/03/10 09:50:05 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -347,6 +347,9 @@
 PHP_FUNCTION(mysqli_stmt_data_seek);
 PHP_FUNCTION(mysqli_stmt_errno);
 PHP_FUNCTION(mysqli_stmt_error);
+#ifndef HAVE_MYSQLI_OLDAPI
+PHP_FUNCTION(mysqli_stmt_free_result);
+#endif
 PHP_FUNCTION(mysqli_stmt_num_rows);
 #if MYSQL_VERSION_ID = 40101
 PHP_FUNCTION(mysqli_stmt_sqlstate);
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.32r2=1.33ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.32 php-src/ext/mysqli/mysqli_fe.c:1.33
--- php-src/ext/mysqli/mysqli_fe.c:1.32 Tue Mar  9 07:01:23 2004
+++ php-src/ext/mysqli/mysqli_fe.c  Wed Mar 10 04:50:05 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.32 2004/03/09 12:01:23 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.33 2004/03/10 09:50:05 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -124,6 +124,9 @@
PHP_FE(mysqli_stmt_bind_param,  
third_arg_force_by_ref_rest)
PHP_FE(mysqli_stmt_bind_result, 
second_arg_force_by_ref_rest)
PHP_FE(mysqli_stmt_fetch,  
 NULL)
+#ifndef HAVE_MYSQLI_OLDAPI
+   PHP_FE(mysqli_stmt_free_result, NULL)
+#endif
PHP_FE(mysqli_stmt_param_count, NULL)
PHP_FE(mysqli_send_query,  
 NULL)
 #ifdef HAVE_EMBEDDED_MYSQLI
@@ -267,6 +270,7 @@
PHP_FALIAS(send_long_data,mysqli_stmt_send_long_data,NULL)
PHP_FALIAS(stmt,mysqli_prepare,NULL)
 #ifndef HAVE_MYSQLI_OLDAPI
+   PHP_FALIAS(free_result,mysqli_stmt_free_result,NULL)
PHP_FALIAS(prepare,mysqli_stmt_prepare, NULL)
 #endif
PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c mysqli_prop.c

2004-02-26 Thread Georg Richter
georg   Thu Feb 26 03:27:26 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_fe.c mysqli_api.c mysqli_prop.c 
  Log:
  removed blocking calls to mysql_set_server_option (MYSQLI_DISABLE_MQ)
  added mysqli_multi_query to function table
  changed stmt-affected_rows property (http://bugs.mysql.com/?id=2247) for 4.1.2
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.29r2=1.30ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.29 php-src/ext/mysqli/mysqli_fe.c:1.30
--- php-src/ext/mysqli/mysqli_fe.c:1.29 Sat Feb 21 02:37:41 2004
+++ php-src/ext/mysqli/mysqli_fe.c  Thu Feb 26 03:27:24 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.29 2004/02/21 07:37:41 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.30 2004/02/26 08:27:24 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -98,6 +98,7 @@
PHP_FE(mysqli_kill,
 NULL)
PHP_FE(mysqli_master_query,
 NULL)
PHP_FE(mysqli_more_results,
 NULL)
+   PHP_FE(mysqli_multi_query, 
 NULL)
PHP_FE(mysqli_next_result, 
 NULL)
PHP_FE(mysqli_num_fields,  
 NULL)
PHP_FE(mysqli_num_rows,
 NULL)
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.74r2=1.75ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.74 php-src/ext/mysqli/mysqli_api.c:1.75
--- php-src/ext/mysqli/mysqli_api.c:1.74Mon Feb 23 01:35:18 2004
+++ php-src/ext/mysqli/mysqli_api.c Thu Feb 26 03:27:24 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.74 2004/02/23 06:35:18 georg Exp $ 
+  $Id: mysqli_api.c,v 1.75 2004/02/26 08:27:24 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1656,13 +1656,11 @@
 
if (!(result = mysql_store_result(mysql))) {
MYSQLI_REPORT_MYSQL_ERROR(mysql);
-   MYSQLI_DISABLE_MQ;
RETURN_FALSE;
}
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
php_mysqli_report_index(from previous query, mysql-server_status 
TSRMLS_CC);
}
-   MYSQLI_DISABLE_MQ;
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)result;
MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry); 
@@ -1710,7 +1708,6 @@
 
if (!(result = mysql_use_result(mysql))) {
MYSQLI_REPORT_MYSQL_ERROR(mysql);
-   MYSQLI_DISABLE_MQ;
RETURN_FALSE;
}
 
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_prop.c?r1=1.9r2=1.10ty=u
Index: php-src/ext/mysqli/mysqli_prop.c
diff -u php-src/ext/mysqli/mysqli_prop.c:1.9 php-src/ext/mysqli/mysqli_prop.c:1.10
--- php-src/ext/mysqli/mysqli_prop.c:1.9Fri Jan 30 17:45:19 2004
+++ php-src/ext/mysqli/mysqli_prop.cThu Feb 26 03:27:24 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_prop.c,v 1.9 2004/01/30 22:45:19 georg Exp $ 
+  $Id: mysqli_prop.c,v 1.10 2004/02/26 08:27:24 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -177,7 +177,11 @@
 
 /* statement properties */
 
+#if MYSQL_VERSION_ID  40102
 MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_affected_rows_read, STMT, 
stmt-mysql-last_used_con-affected_rows);
+#else
+MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_affected_rows_read, STMT, stmt-affected_rows);
+#endif
 MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_num_rows_read, STMT, stmt-result-row_count);
 MYSQLI_MAP_PROPERTY_STRING(stmt_query_read, STMT, stmt-query);
 MYSQLI_MAP_PROPERTY_LONG(stmt_param_count_read, STMT, stmt-param_count);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-02-26 Thread Georg Richter
georg   Thu Feb 26 07:24:22 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  prototype fix for mysqli_ping
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.76r2=1.77ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.76 php-src/ext/mysqli/mysqli_api.c:1.77
--- php-src/ext/mysqli/mysqli_api.c:1.76Thu Feb 26 06:40:35 2004
+++ php-src/ext/mysqli/mysqli_api.c Thu Feb 26 07:24:21 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.76 2004/02/26 11:40:35 georg Exp $ 
+  $Id: mysqli_api.c,v 1.77 2004/02/26 12:24:21 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1142,7 +1142,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_ping(object link)
+/* {{{ proto bool mysqli_ping(object link)
Ping a server connection or reconnect if there is no connection */
 PHP_FUNCTION(mysqli_ping)
 {
@@ -1156,7 +1156,10 @@
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
rc = mysql_ping(mysql);
MYSQLI_REPORT_MYSQL_ERROR(mysql);
-   RETURN_LONG(rc);
+   if (rc) {
+   RETURN_FALSE;
+   }
+   RETURN_TRUE;
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2004-02-22 Thread Georg Richter
georg   Mon Feb 23 01:35:18 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  fixed report message
  Disabled reconnect option
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.73r2=1.74ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.73 php-src/ext/mysqli/mysqli_api.c:1.74
--- php-src/ext/mysqli/mysqli_api.c:1.73Fri Feb 20 08:09:14 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Feb 23 01:35:18 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.73 2004/02/20 13:09:14 georg Exp $ 
+  $Id: mysqli_api.c,v 1.74 2004/02/23 06:35:18 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1271,6 +1271,8 @@
RETURN_FALSE;
}
php_mysqli_set_error(mysql_errno(mysql), (char *)mysql_error(mysql) TSRMLS_CC);
+
+   mysql-reconnect = 0;

if (object) {
((mysqli_object *) zend_object_store_get_object(object 
TSRMLS_CC))-valid = 1;
@@ -1658,7 +1660,7 @@
RETURN_FALSE;
}
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(from previous mysql_real_connect, 
mysql-server_status TSRMLS_CC);
+   php_mysqli_report_index(from previous query, mysql-server_status 
TSRMLS_CC);
}
MYSQLI_DISABLE_MQ;
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
@@ -1713,7 +1715,7 @@
}
 
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(from previous mysql_real_connect, 
mysql-server_status TSRMLS_CC);
+   php_mysqli_report_index(from previous query, mysql-server_status 
TSRMLS_CC);
}
 
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.29r2=1.30ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.29 php-src/ext/mysqli/mysqli_nonapi.c:1.30
--- php-src/ext/mysqli/mysqli_nonapi.c:1.29 Wed Jan 28 17:51:54 2004
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Feb 23 01:35:18 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.29 2004/01/28 22:51:54 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.30 2004/02/23 06:35:18 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -83,6 +83,8 @@
/* clear error */
php_mysqli_set_error(mysql_errno(mysql), (char *) mysql_error(mysql) 
TSRMLS_CC);
 
+   mysql-reconnect = 0;
+
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource-ptr = (void *)mysql;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-02-18 Thread Georg Richter
georg   Wed Feb 18 08:26:57 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  changed return value of mysql_fetch
- instead of MYSQL_NO_DATA mysql_fetch will now return NULL
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.71r2=1.72ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.71 php-src/ext/mysqli/mysqli_api.c:1.72
--- php-src/ext/mysqli/mysqli_api.c:1.71Sun Feb 15 15:23:05 2004
+++ php-src/ext/mysqli/mysqli_api.c Wed Feb 18 08:26:57 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.71 2004/02/15 20:23:05 georg Exp $ 
+  $Id: mysqli_api.c,v 1.72 2004/02/18 13:26:57 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -711,7 +711,7 @@
RETURN_FALSE;
break;
default:
-   RETURN_LONG(ret);
+   RETURN_NULL();
break;
}
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-02-15 Thread Georg Richter
georg   Sun Feb 15 15:23:05 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed several binding problems
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.70r2=1.71ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.70 php-src/ext/mysqli/mysqli_api.c:1.71
--- php-src/ext/mysqli/mysqli_api.c:1.70Wed Feb 11 03:34:07 2004
+++ php-src/ext/mysqli/mysqli_api.c Sun Feb 15 15:23:05 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.70 2004/02/11 08:34:07 georg Exp $ 
+  $Id: mysqli_api.c,v 1.71 2004/02/15 20:23:05 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -111,6 +111,11 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of elements in 
type definition string doesn't match number of bind variables);
}
 
+   if (argc - start != stmt-stmt-param_count) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of variables 
doesn't match number of parameters in prepared statement);
+   RETURN_FALSE;
+   }
+
/* prevent leak if variables are already bound */
if (stmt-param.var_cnt) {
php_free_stmt_bind_buffer(stmt-param, FETCH_SIMPLE);
@@ -236,6 +241,11 @@

var_cnt = argc - start;
 
+   if (var_cnt != stmt-stmt-field_count) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of bind variables 
doesn't match number of fields in prepared statmement.);
+   RETURN_FALSE;
+   }
+
/* prevent leak if variables are already bound */
if (stmt-result.var_cnt) {
php_free_stmt_bind_buffer(stmt-result, FETCH_RESULT);
@@ -295,7 +305,8 @@
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DECIMAL:
stmt-result.buf[ofs].type = IS_STRING; 
-   stmt-result.buf[ofs].buflen = (stmt-stmt-fields) ? 
stmt-stmt-fields[ofs].length + 1: 256;
+   stmt-result.buf[ofs].buflen =
+   (stmt-stmt-fields) ? 
(stmt-stmt-fields[ofs].length) ? stmt-stmt-fields[ofs].length + 1: 256: 256;
stmt-result.buf[ofs].buffer = (char 
*)emalloc(stmt-result.buf[ofs].buflen);
bind[ofs].buffer_type = MYSQL_TYPE_STRING;
bind[ofs].buffer = stmt-result.buf[ofs].buffer;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-01-31 Thread Georg Richter
georg   Sat Jan 31 02:51:04 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  Corrected binding:
if column has type DECIMAL it will converted to string now.
Thanks to Brian Aker for pointing this out.
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.67r2=1.68ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.67 php-src/ext/mysqli/mysqli_api.c:1.68
--- php-src/ext/mysqli/mysqli_api.c:1.67Wed Jan 28 17:51:54 2004
+++ php-src/ext/mysqli/mysqli_api.c Sat Jan 31 02:51:03 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.67 2004/01/28 22:51:54 georg Exp $ 
+  $Id: mysqli_api.c,v 1.68 2004/01/31 07:51:03 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -258,7 +258,6 @@
col_type = (stmt-stmt-fields) ? stmt-stmt-fields[ofs].type : 
MYSQL_TYPE_STRING;
 
switch (col_type) {
-   case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT:
convert_to_double_ex(args[i]);
@@ -300,6 +299,7 @@
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_TIMESTAMP:
+   case MYSQL_TYPE_DECIMAL:
stmt-result.buf[ofs].type = IS_STRING; 
stmt-result.buf[ofs].buflen = (stmt-stmt-fields) ? 
stmt-stmt-fields[ofs].length + 1: 256;
stmt-result.buf[ofs].buffer = (char 
*)emalloc(stmt-result.buf[ofs].buflen);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c

2004-01-27 Thread Georg Richter
georg   Tue Jan 27 08:23:55 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_fe.c 
  Log:
  prototype fixes
  removed method field_tell (which is already property current_field)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.64r2=1.65ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.64 php-src/ext/mysqli/mysqli_api.c:1.65
--- php-src/ext/mysqli/mysqli_api.c:1.64Mon Jan 26 15:08:16 2004
+++ php-src/ext/mysqli/mysqli_api.c Tue Jan 27 08:23:54 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.64 2004/01/26 20:08:16 georg Exp $ 
+  $Id: mysqli_api.c,v 1.65 2004/01/27 13:23:54 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1229,7 +1229,7 @@
 }
 /* }}} */
 
-/* {{{ proto resource mysqli_prepare(object link, string query)
+/* {{{ proto mixed mysqli_prepare(object link, string query)
Prepare a SQL statement for execution */
 PHP_FUNCTION(mysqli_prepare)
 {
@@ -1261,7 +1261,7 @@
 }
 /* }}} */
 
-/* {{{ proto resource mysqli_get_metadata(object stmt)
+/* {{{ proto mixed mysqli_get_metadata(object stmt)
return result set from statement */
 PHP_FUNCTION(mysqli_get_metadata)
 {
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.26r2=1.27ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.26 php-src/ext/mysqli/mysqli_fe.c:1.27
--- php-src/ext/mysqli/mysqli_fe.c:1.26 Mon Jan 26 08:38:13 2004
+++ php-src/ext/mysqli/mysqli_fe.c  Tue Jan 27 08:23:54 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.26 2004/01/26 13:38:13 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.27 2004/01/27 13:23:54 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -218,7 +218,6 @@
PHP_FALIAS(fetch_row,mysqli_fetch_row,NULL)
PHP_FALIAS(field_count,mysqli_field_count,NULL)
PHP_FALIAS(field_seek,mysqli_field_seek,NULL)
-   PHP_FALIAS(field_tell,mysqli_field_tell,NULL)
PHP_FALIAS(free_result,mysqli_free_result,NULL)
{NULL, NULL, NULL}
 };

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-01-27 Thread Georg Richter
georg   Tue Jan 27 08:56:04 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  changed prototype mysql_dataseek from void to bool
add check for specified offset
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.65r2=1.66ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.65 php-src/ext/mysqli/mysqli_api.c:1.66
--- php-src/ext/mysqli/mysqli_api.c:1.65Tue Jan 27 08:23:54 2004
+++ php-src/ext/mysqli/mysqli_api.c Tue Jan 27 08:56:03 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.65 2004/01/27 13:23:54 georg Exp $ 
+  $Id: mysqli_api.c,v 1.66 2004/01/27 13:56:03 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -420,7 +420,7 @@
 }
 /* }}} */
 
-/* {{{ proto void mysqli_data_seek(object result, int offset)
+/* {{{ proto bool mysqli_data_seek(object result, int offset)
Move internal result pointer */
 PHP_FUNCTION(mysqli_data_seek)
 {
@@ -436,11 +436,15 @@
 
if (result-handle  result-handle-status == MYSQL_STATUS_USE_RESULT) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Function cannot be used 
with MYSQL_USE_RESULT);
-   RETURN_LONG(0);
+   RETURN_FALSE;
+   }
+
+   if (!offset || offset = result-row_count) {
+  RETURN_FALSE;
}
 
mysql_data_seek(result, offset);
-   return;
+   RETURN_TRUE;
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2004-01-26 Thread Georg Richter
georg   Mon Jan 26 02:39:58 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  more prototype fixes.
  fixed a bug in mysqli_send_long_data
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.61r2=1.62ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.61 php-src/ext/mysqli/mysqli_api.c:1.62
--- php-src/ext/mysqli/mysqli_api.c:1.61Sun Jan 25 07:01:36 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Jan 26 02:39:57 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.61 2004/01/25 12:01:36 georg Exp $ 
+  $Id: mysqli_api.c,v 1.62 2004/01/26 07:39:57 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -29,7 +29,6 @@
 #include ext/standard/info.h
 #include php_mysqli.h
 
-
 /* {{{ proto mixed mysqli_affected_rows(object link)
Get number of affected rows in previous MySQL operation */
 PHP_FUNCTION(mysqli_affected_rows)
@@ -709,7 +708,7 @@
 }
 /* }}} */
 
-/* {{{ proto object mysqli_fetch_field (object result)
+/* {{{ proto mixed mysqli_fetch_field (object result)
Get column information from a result and return as an object */
 PHP_FUNCTION(mysqli_fetch_field) 
 {
@@ -741,7 +740,7 @@
 }
 /* }}} */
 
-/* {{{ proto array mysqli_fetch_fields (object result)
+/* {{{ proto mixed mysqli_fetch_fields (object result)
Return array of objects containing field meta-data */
 PHP_FUNCTION(mysqli_fetch_fields) 
 {
@@ -786,7 +785,7 @@
 }
 /* }}} */
 
-/* {{{ proto array mysqli_fetch_field_direct (object result, int offset)
+/* {{{ proto mixed mysqli_fetch_field_direct (object result, int offset)
Fetch meta-data for a single field */
 PHP_FUNCTION(mysqli_fetch_field_direct) 
 {
@@ -819,7 +818,7 @@
 }
 /* }}} */
 
-/* {{{ proto array mysqli_fetch_lengths (object result)
+/* {{{ proto mixed mysqli_fetch_lengths (object result)
Get the length of each output in a result */
 PHP_FUNCTION(mysqli_fetch_lengths) 
 {
@@ -1507,11 +1506,10 @@
}
MYSQLI_FETCH_RESOURCE(stmt, STMT *, mysql_stmt, mysqli_stmt); 
 
-   if (!param_nr) {
+   if (param_nr  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid parameter 
number);
RETURN_FALSE;
}
-   param_nr--;
 
if (mysql_send_long_data(stmt-stmt, param_nr, data, data_len)) {
RETURN_FALSE;
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.27r2=1.28ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.27 php-src/ext/mysqli/mysqli_nonapi.c:1.28
--- php-src/ext/mysqli/mysqli_nonapi.c:1.27 Sun Jan 11 19:34:37 2004
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Jan 26 02:39:57 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.27 2004/01/12 00:34:37 helly Exp $ 
+  $Id: mysqli_nonapi.c,v 1.28 2004/01/26 07:39:57 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -163,7 +163,7 @@
 }
 /* }}} */
 
-/* {{{ proto array mysqli_fetch_array (object result [,int resulttype])
+/* {{{ proto mixed mysqli_fetch_array (object result [,int resulttype])
Fetch a result row as an associative array, a numeric array, or both */
 PHP_FUNCTION(mysqli_fetch_array) 
 {
@@ -171,7 +171,7 @@
 }
 /* }}} */
 
-/* {{{ proto array mysqli_fetch_assoc (object result)
+/* {{{ proto mixed mysqli_fetch_assoc (object result)
Fetch a result row as an associative array */
 PHP_FUNCTION(mysqli_fetch_assoc) 
 {
@@ -179,7 +179,7 @@
 }
 /* }}} */
 
-/* {{{ proto object mysqli_fetch_object (object result [, string class_name [, 
NULL|array ctor_params]])
+/* {{{ proto mixed mysqli_fetch_object (object result [, string class_name [, 
NULL|array ctor_params]])
Fetch a result row as an object */
 PHP_FUNCTION(mysqli_fetch_object) 
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c

2004-01-26 Thread Georg Richter
georg   Mon Jan 26 08:38:14 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_fe.c mysqli_api.c 
  Log:
  proto fixes
  removed mysqli_read_query_result (will be removed in libmysql)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.25r2=1.26ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.25 php-src/ext/mysqli/mysqli_fe.c:1.26
--- php-src/ext/mysqli/mysqli_fe.c:1.25 Thu Jan  8 12:32:31 2004
+++ php-src/ext/mysqli/mysqli_fe.c  Mon Jan 26 08:38:13 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.25 2004/01/08 17:32:31 sniper Exp $ 
+  $Id: mysqli_fe.c,v 1.26 2004/01/26 13:38:13 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -106,7 +106,6 @@
PHP_FE(mysqli_prepare, 
 NULL)
PHP_FE(mysqli_report,  
 NULL)
PHP_FE(mysqli_query,   
 NULL)
-   PHP_FE(mysqli_read_query_result,NULL)
PHP_FE(mysqli_real_connect,
 NULL)
PHP_FE(mysqli_real_escape_string,   NULL)
PHP_FALIAS(mysqli_escape_string, 
@@ -182,7 +181,6 @@
PHP_FALIAS(ping,mysqli_ping,NULL)
PHP_FALIAS(prepare,mysqli_prepare,NULL)
PHP_FALIAS(query,mysqli_query,NULL)
-   PHP_FALIAS(read_query_result,mysqli_read_query_result,NULL)
PHP_FALIAS(real_connect,mysqli_real_connect,NULL)
PHP_FALIAS(real_escape_string,mysqli_real_escape_string,NULL)
PHP_FALIAS(escape_string, mysqli_real_escape_string,NULL)
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.62r2=1.63ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.62 php-src/ext/mysqli/mysqli_api.c:1.63
--- php-src/ext/mysqli/mysqli_api.c:1.62Mon Jan 26 02:39:57 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Jan 26 08:38:13 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.62 2004/01/26 07:39:57 georg Exp $ 
+  $Id: mysqli_api.c,v 1.63 2004/01/26 13:38:13 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1286,26 +1286,6 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_read_query_result(object link)
-*/
-PHP_FUNCTION(mysqli_read_query_result)
-{
-   MYSQL   *mysql;
-   zval*mysql_link;
-
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, 
mysql_link, mysqli_link_class_entry) == FAILURE) {
-   return;
-   }
-   MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
-
-   if (mysql_read_query_result(mysql)) {
-   RETURN_FALSE;
-   }
-
-   RETURN_TRUE;
-}
-/* }}} */
-
 /* {{{ proto bool mysqli_real_connect(object link [,string hostname [,string username 
[,string passwd [,string dbname [,int port [,string socket [,int flags]]])
Open a connection to a mysql server */ 
 PHP_FUNCTION(mysqli_real_connect)
@@ -1732,19 +1712,23 @@
 }
 /* }}} */
   
-/* {{{ proto string mysqli_stat(object link) 
+/* {{{ proto mixed mysqli_stat(object link) 
Get current system status */
 PHP_FUNCTION(mysqli_stat)
 {
MYSQL   *mysql;
zval*mysql_link;
+   char*stat;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, 
mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
 
-   RETURN_STRING((char *)mysql_stat(mysql), 1);
+   if (stat = (char *)mysql_stat(mysql)) {
+   RETURN_STRING(stat, 1);
+   }
+   RETURN_FALSE;
 }
 
 /* }}} */
@@ -1781,7 +1765,7 @@
 }
 /* }}} */
 
-/* {{{ proto object mysqli_stmt_store_result(stmt)
+/* {{{ proto bool mysqli_stmt_store_result(stmt)
 */
 PHP_FUNCTION(mysqli_stmt_store_result)
 {
@@ -1873,7 +1857,7 @@
 
 /* }}} */
 
-/* {{{ proto object mysqli_use_result(object link)
+/* {{{ proto mixed mysqli_use_result(object link)
Directly retrieve query results - do not buffer results on client side */
 PHP_FUNCTION(mysqli_use_result)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-01-26 Thread Georg Richter
georg   Mon Jan 26 15:08:17 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed compiler warning (thx to Marcus Boerger)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.63r2=1.64ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.63 php-src/ext/mysqli/mysqli_api.c:1.64
--- php-src/ext/mysqli/mysqli_api.c:1.63Mon Jan 26 08:38:13 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Jan 26 15:08:16 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.63 2004/01/26 13:38:13 georg Exp $ 
+  $Id: mysqli_api.c,v 1.64 2004/01/26 20:08:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1725,7 +1725,7 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
 
-   if (stat = (char *)mysql_stat(mysql)) {
+   if ((stat = (char *)mysql_stat(mysql))) {
RETURN_STRING(stat, 1);
}
RETURN_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-01-25 Thread Georg Richter
georg   Sun Jan 25 07:01:37 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  prototype fix for mysqli_fetch
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.60r2=1.61ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.60 php-src/ext/mysqli/mysqli_api.c:1.61
--- php-src/ext/mysqli/mysqli_api.c:1.60Sat Jan 24 09:38:16 2004
+++ php-src/ext/mysqli/mysqli_api.c Sun Jan 25 07:01:36 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.60 2004/01/24 14:38:16 georg Exp $ 
+  $Id: mysqli_api.c,v 1.61 2004/01/25 12:01:36 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -628,7 +628,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_fetch(object stmt)
+/* {{{ proto mixed mysqli_fetch(object stmt)
Fetch results from a prepared statement into the bound variables */
 PHP_FUNCTION(mysqli_fetch)
 {
@@ -670,7 +670,7 @@
if (lval != (long)lval) {
/* even though lval is 
declared as unsigned, the value
 * may be negative. 
Therefor we cannot use %llu and must
-* user %lld.
+* use %lld.
 */
sprintf((char *)tmp, 
%lld, lval);

ZVAL_STRING(stmt-result.vars[i], tmp, 1);
@@ -695,7 +695,17 @@
MYSQLI_REPORT_STMT_ERROR(stmt-stmt);
}
 
-   RETURN_LONG(ret);
+   switch (ret) {
+   case 0:
+   RETURN_TRUE;
+   break;
+   case 1:
+   RETURN_FALSE;
+   break;
+   default:
+   RETURN_LONG(ret);
+   break;
+   }
 }
 /* }}} */
 
@@ -861,7 +871,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_field_seek(object link, int fieldnr)
+/* {{{ proto int mysqli_field_seek(object result, int fieldnr)
Set result pointer to a specified field offset
 */
 PHP_FUNCTION(mysqli_field_seek)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2004-01-24 Thread Georg Richter
georg   Sat Jan 24 09:38:17 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  prototype fixes
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.59r2=1.60ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.59 php-src/ext/mysqli/mysqli_api.c:1.60
--- php-src/ext/mysqli/mysqli_api.c:1.59Thu Jan  8 03:16:25 2004
+++ php-src/ext/mysqli/mysqli_api.c Sat Jan 24 09:38:16 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.59 2004/01/08 08:16:25 andi Exp $ 
+  $Id: mysqli_api.c,v 1.60 2004/01/24 14:38:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -699,7 +699,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_fetch_field (object result)
+/* {{{ proto object mysqli_fetch_field (object result)
Get column information from a result and return as an object */
 PHP_FUNCTION(mysqli_fetch_field) 
 {
@@ -731,7 +731,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_fetch_fields (object result)
+/* {{{ proto array mysqli_fetch_fields (object result)
Return array of objects containing field meta-data */
 PHP_FUNCTION(mysqli_fetch_fields) 
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2003-12-30 Thread Georg Richter
georg   Tue Dec 30 14:19:14 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed a bug in mysqli_num_rows (added support for longlong values)
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.56 php-src/ext/mysqli/mysqli_api.c:1.57
--- php-src/ext/mysqli/mysqli_api.c:1.56Sun Dec 28 17:26:59 2003
+++ php-src/ext/mysqli/mysqli_api.c Tue Dec 30 14:19:13 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.56 2003/12/28 22:26:59 georg Exp $ 
+  $Id: mysqli_api.c,v 1.57 2003/12/30 19:19:13 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -776,7 +776,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_fetch_field_direct (object result, int offset)
+/* {{{ proto array mysqli_fetch_field_direct (object result, int offset)
Fetch meta-data for a single field */
 PHP_FUNCTION(mysqli_fetch_field_direct) 
 {
@@ -1130,7 +1130,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_num_rows(object result)
+/* {{{ proto mixed mysqli_num_rows(object result)
Get number of rows in result */
 PHP_FUNCTION(mysqli_num_rows)
 {
@@ -1148,8 +1148,7 @@
RETURN_LONG(0);
}
 
-   rc = mysql_num_rows(result);
-   RETURN_LONG(rc);
+   MYSQLI_RETURN_LONG_LONG(mysql_num_rows(result));
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2003-12-28 Thread Georg Richter
georg   Sun Dec 28 17:27:00 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  fixed prototype for mysqli_bind_result
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.55 php-src/ext/mysqli/mysqli_api.c:1.56
--- php-src/ext/mysqli/mysqli_api.c:1.55Tue Dec 16 03:18:31 2003
+++ php-src/ext/mysqli/mysqli_api.c Sun Dec 28 17:26:59 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.55 2003/12/16 08:18:31 georg Exp $ 
+  $Id: mysqli_api.c,v 1.56 2003/12/28 22:26:59 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -199,7 +199,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_bind_result(object stmt, mixed var, int len [,mixed,int])
+/* {{{ proto bool mysqli_bind_result(object stmt, mixed var, [,mixed, ...])
Bind variables to a prepared statement for result storage */
 
 /* TODO:

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c mysqli_prop.c

2003-12-16 Thread Georg Richter
georg   Tue Dec 16 03:18:32 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_fe.c mysqli_prop.c 
  Log:
  added properties
- insert_id
- server_status
  fixed bug in mysqli_execute (report func)
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.54 php-src/ext/mysqli/mysqli_api.c:1.55
--- php-src/ext/mysqli/mysqli_api.c:1.54Sat Dec 13 11:08:13 2003
+++ php-src/ext/mysqli/mysqli_api.c Tue Dec 16 03:18:31 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.54 2003/12/13 16:08:13 georg Exp $ 
+  $Id: mysqli_api.c,v 1.55 2003/12/16 08:18:31 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -620,6 +620,10 @@
MYSQLI_REPORT_STMT_ERROR(stmt-stmt);
RETURN_FALSE;
}
+   if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
+   php_mysqli_report_index(stmt-stmt-query, 
stmt-stmt-mysql-server_status TSRMLS_CC);
+   }
+   
RETURN_TRUE;
 }
 /* }}} */
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.22 php-src/ext/mysqli/mysqli_fe.c:1.23
--- php-src/ext/mysqli/mysqli_fe.c:1.22 Fri Dec 12 19:28:20 2003
+++ php-src/ext/mysqli/mysqli_fe.c  Tue Dec 16 03:18:31 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.22 2003/12/13 00:28:20 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.23 2003/12/16 08:18:31 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -172,7 +172,6 @@
PHP_FALIAS(get_server_info,mysqli_get_server_info,NULL)
PHP_FALIAS(init,mysqli_init,NULL)
PHP_FALIAS(info,mysqli_info,NULL)
-   PHP_FALIAS(insert_id,mysqli_insert_id,NULL)
PHP_FALIAS(kill,mysqli_kill,NULL)
PHP_FALIAS(master_query,mysqli_master_query,NULL)
PHP_FALIAS(mysqli, mysqli_connect, NULL)
@@ -242,6 +241,7 @@
PHP_FALIAS(get_metadata, mysqli_get_metadata,NULL)
PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL)
PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL)
+   PHP_FALIAS(stmt,mysqli_prepare,NULL)
PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
{NULL, NULL, NULL}
 };
Index: php-src/ext/mysqli/mysqli_prop.c
diff -u php-src/ext/mysqli/mysqli_prop.c:1.1 php-src/ext/mysqli/mysqli_prop.c:1.2
--- php-src/ext/mysqli/mysqli_prop.c:1.1Sat Nov 22 16:20:07 2003
+++ php-src/ext/mysqli/mysqli_prop.cTue Dec 16 03:18:31 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_prop.c,v 1.1 2003/11/22 21:20:07 georg Exp $ 
+  $Id: mysqli_prop.c,v 1.2 2003/12/16 08:18:31 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -76,10 +76,12 @@
 MYSQLI_MAP_PROPERTY_STRING(link_host_read, MYSQL, host);
 MYSQLI_MAP_PROPERTY_STRING(link_host_info_read, MYSQL, host_info);
 MYSQLI_MAP_PROPERTY_STRING(link_info_read, MYSQL, info);
+MYSQLI_MAP_PROPERTY_LONG(link_insert_id_read, MYSQL, last_used_con-insert_id);
 MYSQLI_MAP_PROPERTY_LONG(link_port_read, MYSQL, port);
 MYSQLI_MAP_PROPERTY_LONG(link_protocol_version_read, MYSQL, protocol_version);
 MYSQLI_MAP_PROPERTY_LONG(link_server_capabilities_read, MYSQL, server_capabilities);
 MYSQLI_MAP_PROPERTY_LONG(link_server_language_read, MYSQL, server_language);
+MYSQLI_MAP_PROPERTY_LONG(link_server_status_read, MYSQL, server_status);
 MYSQLI_MAP_PROPERTY_STRING(link_server_version_read, MYSQL, server_version);
 MYSQLI_MAP_PROPERTY_STRING(link_sqlstate_read, MYSQL, net.sqlstate);
 MYSQLI_MAP_PROPERTY_LONG(link_thread_id_read, MYSQL, thread_id);
@@ -148,7 +150,9 @@
{host, link_host_read, NULL},
{host_info, link_host_info_read, NULL},
{info, link_info_read, NULL},
+   {insert_id, link_insert_id_read, NULL},
{server_capabilities, link_server_capabilities_read, NULL},
+   {server_status, link_server_status_read, NULL},
{server_version, link_server_version_read, NULL},
{sqlstate, link_sqlstate_read, NULL},
{port, link_port_read, NULL},

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_report.c php_mysqli.h

2003-12-13 Thread Marcus Boerger
helly   Sat Dec 13 08:44:57 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_report.c 
php_mysqli.h 
  Log:
  ZTS fixes
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.52 php-src/ext/mysqli/mysqli_api.c:1.53
--- php-src/ext/mysqli/mysqli_api.c:1.52Fri Dec 12 19:28:20 2003
+++ php-src/ext/mysqli/mysqli_api.c Sat Dec 13 08:44:56 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.52 2003/12/13 00:28:20 georg Exp $ 
+  $Id: mysqli_api.c,v 1.53 2003/12/13 13:44:56 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1381,7 +1381,7 @@
 
if (!mysql_field_count(mysql)) {
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(query, mysql-server_status);
+   php_mysqli_report_index(query, mysql-server_status TSRMLS_CC);
}
}
 
@@ -1829,7 +1829,7 @@
RETURN_FALSE;
}
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(from previous mysql_real_connect, 
mysql-server_status);
+   php_mysqli_report_index(from previous mysql_real_connect, 
mysql-server_status TSRMLS_CC);
}
MYSQLI_DISABLE_MQ;
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
@@ -1884,7 +1884,7 @@
}
 
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(from previous mysql_real_connect, 
mysql-server_status);
+   php_mysqli_report_index(from previous mysql_real_connect, 
mysql-server_status TSRMLS_CC);
}
 
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.22 php-src/ext/mysqli/mysqli_nonapi.c:1.23
--- php-src/ext/mysqli/mysqli_nonapi.c:1.22 Sat Dec 13 05:15:45 2003
+++ php-src/ext/mysqli/mysqli_nonapi.c  Sat Dec 13 08:44:56 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.22 2003/12/13 10:15:45 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.23 2003/12/13 13:44:56 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -230,7 +230,7 @@
 
if (!mysql_field_count(mysql)) {
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(query, mysql-server_status);
+   php_mysqli_report_index(query, mysql-server_status TSRMLS_CC);
}
RETURN_TRUE;
}
@@ -242,7 +242,7 @@
}
 
if (MyG(report_mode)  MYSQLI_REPORT_INDEX) {
-   php_mysqli_report_index(query, mysql-server_status);
+   php_mysqli_report_index(query, mysql-server_status TSRMLS_CC);
}
 
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
Index: php-src/ext/mysqli/mysqli_report.c
diff -u php-src/ext/mysqli/mysqli_report.c:1.1 php-src/ext/mysqli/mysqli_report.c:1.2
--- php-src/ext/mysqli/mysqli_report.c:1.1  Fri Dec 12 19:28:20 2003
+++ php-src/ext/mysqli/mysqli_report.c  Sat Dec 13 08:44:56 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_report.c,v 1.1 2003/12/13 00:28:20 georg Exp $ 
+  $Id: mysqli_report.c,v 1.2 2003/12/13 13:44:56 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -52,13 +52,13 @@
 /* }}} */
 
 /* {{{ void php_mysqli_report_error(char *sqlstate, int errorno, char *error) */ 
-void php_mysqli_report_error(char *sqlstate, int errorno, char *error) {
+void php_mysqli_report_error(char *sqlstate, int errorno, char *error TSRMLS_DC) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Error (%s/%d): %s, sqlstate, 
errorno, error);
 }
 /* }}} */
 
 /* {{{ void php_mysqli_report_index() */ 
-void php_mysqli_report_index(char *query, unsigned int status) {
+void php_mysqli_report_index(char *query, unsigned int status TSRMLS_DC) {
char index[15];
 
if (status  SERVER_QUERY_NO_GOOD_INDEX_USED) {
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.25 php-src/ext/mysqli/php_mysqli.h:1.26
--- php-src/ext/mysqli/php_mysqli.h:1.25Fri Dec 12 19:28:20 2003
+++ php-src/ext/mysqli/php_mysqli.h Sat Dec 13 08:44:56 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.25 2003/12/13 00:28:20 georg Exp $ 
+  $Id: php_mysqli.h,v 1.26 2003/12/13 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2003-12-13 Thread Georg Richter
georg   Sat Dec 13 11:08:14 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  minor fixes for embedded
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.53 php-src/ext/mysqli/mysqli_api.c:1.54
--- php-src/ext/mysqli/mysqli_api.c:1.53Sat Dec 13 08:44:56 2003
+++ php-src/ext/mysqli/mysqli_api.c Sat Dec 13 11:08:13 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.53 2003/12/13 13:44:56 helly Exp $ 
+  $Id: mysqli_api.c,v 1.54 2003/12/13 16:08:13 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -936,7 +936,7 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
 
-   RETURN_STRING((char *)mysql_get_host_info(mysql), 1);
+   RETURN_STRING((mysql-host_info) ? mysql-host_info : empty_string, 1);
 }
 /* }}} */
 
@@ -995,7 +995,6 @@
 PHP_FUNCTION(mysqli_info)
 {
MYSQL   *mysql;
-   char*info = NULL;
zval*mysql_link = NULL;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, 
mysql_link, mysqli_link_class_entry) == FAILURE) {
@@ -1003,11 +1002,7 @@
}
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link);
 
-   if (!(info = (char *)mysql_info(mysql))) {
-   RETURN_FALSE;
-   }
-
-   RETURN_STRING(info, 1);
+   RETURN_STRING((mysql-info) ? mysql-info : empty_string, 1);
 }
 /* }}} */
 
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.23 php-src/ext/mysqli/mysqli_nonapi.c:1.24
--- php-src/ext/mysqli/mysqli_nonapi.c:1.23 Sat Dec 13 08:44:56 2003
+++ php-src/ext/mysqli/mysqli_nonapi.c  Sat Dec 13 11:08:13 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.23 2003/12/13 13:44:56 helly Exp $ 
+  $Id: mysqli_nonapi.c,v 1.24 2003/12/13 16:08:13 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -116,8 +116,12 @@
mysql = mysql_init(NULL);
 
if (mysql_real_connect(mysql, NULL, NULL, NULL, dbname, 0, NULL, 0) == NULL) {
+   MYSQLI_REPORT_MYSQL_ERROR(mysql);
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));
+
+   if (!(MyG(report_mode)  MYSQLI_REPORT_ERROR)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
mysql_error(mysql));
+   }
/* free mysql structure */
mysql_close(mysql);
RETURN_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2003-11-30 Thread Georg Richter
georg   Sun Nov 30 05:56:56 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  prototype fix for mysqli_ssl_set
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.50 php-src/ext/mysqli/mysqli_api.c:1.51
--- php-src/ext/mysqli/mysqli_api.c:1.50Sat Nov 22 16:20:06 2003
+++ php-src/ext/mysqli/mysqli_api.c Sun Nov 30 05:56:55 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.50 2003/11/22 21:20:06 georg Exp $ 
+  $Id: mysqli_api.c,v 1.51 2003/11/30 10:56:55 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1836,7 +1836,7 @@
 #endif
 /* }}} */
 
-/* {{{ proto string mysqli_ssl_set(object link [,string key [,string cert [,string ca 
[,string capath [,string cipher])
+/* {{{ proto bool mysqli_ssl_set(object link ,string key ,string cert ,string ca 
,string capath ,string cipher])
 */
 PHP_FUNCTION(mysqli_ssl_set)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c

2003-10-30 Thread Georg Richter
georg   Thu Oct 30 07:35:16 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c 
  Log:
  changed return value from long to boolean for mysql_execute
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.47 php-src/ext/mysqli/mysqli_api.c:1.48
--- php-src/ext/mysqli/mysqli_api.c:1.47Wed Oct 29 15:48:47 2003
+++ php-src/ext/mysqli/mysqli_api.c Thu Oct 30 07:35:16 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.47 2003/10/29 20:48:47 georg Exp $ 
+  $Id: mysqli_api.c,v 1.48 2003/10/30 12:35:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -641,7 +641,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_execute(object stmt)
+/* {{{ proto bool mysqli_execute(object stmt)
Execute a prepared statement */
 PHP_FUNCTION(mysqli_execute)
 {
@@ -679,7 +679,10 @@
}
}
 
-   RETURN_LONG(mysql_execute(stmt-stmt));
+   if (mysql_execute(stmt-stmt)) {
+   RETURN_FALSE;
+   }
+   RETURN_TRUE;
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h

2003-09-25 Thread Georg Richter
georg   Thu Sep 25 07:19:26 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h 
  Log:
  mysql_prepare_result - mysqli_get_metadata
  This function was renamed in libmysql (changeset 1.607 by monty)
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.45 php-src/ext/mysqli/mysqli_api.c:1.46
--- php-src/ext/mysqli/mysqli_api.c:1.45Tue Sep 16 15:45:22 2003
+++ php-src/ext/mysqli/mysqli_api.c Thu Sep 25 07:19:25 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.45 2003/09/16 19:45:22 hholzgra Exp $ 
+  $Id: mysqli_api.c,v 1.46 2003/09/25 11:19:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1325,9 +1325,9 @@
 }
 /* }}} */
 
-/* {{{ proto resource mysqli_prepare_result(object stmt)
+/* {{{ proto resource mysqli_get_metadata(object stmt)
  */
-PHP_FUNCTION(mysqli_prepare_result)
+PHP_FUNCTION(mysqli_get_metadata)
 {
STMT*stmt;
MYSQL_RES   *result;
@@ -1340,7 +1340,7 @@
}
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt); 

-   if (!(result = mysql_prepare_result(stmt-stmt))){
+   if (!(result = mysql_get_metadata(stmt-stmt))){
RETURN_FALSE;
}
 
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.18 php-src/ext/mysqli/mysqli_fe.c:1.19
--- php-src/ext/mysqli/mysqli_fe.c:1.18 Sun Aug  3 14:51:26 2003
+++ php-src/ext/mysqli/mysqli_fe.c  Thu Sep 25 07:19:25 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.18 2003/08/03 18:51:26 helly Exp $ 
+  $Id: mysqli_fe.c,v 1.19 2003/09/25 11:19:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -98,7 +98,7 @@
PHP_FE(mysqli_param_count, 
 NULL)
PHP_FE(mysqli_ping,
 NULL)
PHP_FE(mysqli_prepare, 
 NULL)
-   PHP_FE(mysqli_prepare_result,   NULL)
+   PHP_FE(mysqli_get_metadata,
 NULL)
PHP_FE(mysqli_profiler,
 NULL)
PHP_FE(mysqli_query,   
 NULL)
PHP_FE(mysqli_read_query_result,NULL)
@@ -238,16 +238,17 @@
PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL)
PHP_FALIAS(bind_param,mysqli_bind_param,second_arg_force_by_ref_rest)
PHP_FALIAS(bind_result,mysqli_bind_result, all_args_by_ref)
-   PHP_FALIAS(execute,mysqli_execute,NULL)
-   PHP_FALIAS(fetch,mysqli_fetch,NULL)
-   PHP_FALIAS(param_count,mysqli_param_count,NULL)
-   PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL)
-   PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
PHP_FALIAS(close,mysqli_stmt_close,NULL)
PHP_FALIAS(data_seek,mysqli_stmt_data_seek,NULL)
PHP_FALIAS(errno,mysqli_stmt_errno,NULL)
PHP_FALIAS(error,mysqli_stmt_error,NULL)
+   PHP_FALIAS(execute,mysqli_execute,NULL)
+   PHP_FALIAS(fetch,mysqli_fetch,NULL)
+   PHP_FALIAS(get_metadata, mysqli_get_metadata,NULL)
PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL)
+   PHP_FALIAS(param_count,mysqli_param_count,NULL)
+   PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL)
+   PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
 #if MYSQL_VERSION_ID = 40101
PHP_FALIAS(sqlstate, mysqli_stmt_sqlstate,NULL)
 #endif
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.21 php-src/ext/mysqli/php_mysqli.h:1.22
--- php-src/ext/mysqli/php_mysqli.h:1.21Sat Sep  6 15:34:48 2003
+++ php-src/ext/mysqli/php_mysqli.h Thu Sep 25 07:19:25 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.21 2003/09/06 19:34:48 helly Exp $ 
+  $Id: php_mysqli.h,v 1.22 2003/09/25 11:19:25 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -245,7 +245,7 @@
 PHP_FUNCTION(mysqli_ping);
 PHP_FUNCTION(mysqli_prepare);
 PHP_FUNCTION(mysqli_query);
-PHP_FUNCTION(mysqli_prepare_result);
+PHP_FUNCTION(mysqli_get_metadata);
 PHP_FUNCTION(mysqli_profiler);
 PHP_FUNCTION(mysqli_read_query_result);
 PHP_FUNCTION(mysqli_real_connect);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2003-09-16 Thread Hartmut Holzgraefe
hholzgraTue Sep 16 15:45:23 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  proto fix
  
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.44 php-src/ext/mysqli/mysqli_api.c:1.45
--- php-src/ext/mysqli/mysqli_api.c:1.44Sat Sep  6 15:34:48 2003
+++ php-src/ext/mysqli/mysqli_api.c Tue Sep 16 15:45:22 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.44 2003/09/06 19:34:48 helly Exp $ 
+  $Id: mysqli_api.c,v 1.45 2003/09/16 19:45:22 hholzgra Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1852,7 +1852,7 @@
 }
 /* }}} */
 
-/* {{{ proto string mysqli_stmt_error(object stmt)
+/* {{{ proto string mysqli_stmt_sqlstate(object stmt)
 */
 #if MYSQL_VERSION_ID = 40101
 PHP_FUNCTION(mysqli_stmt_sqlstate) 
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.16 php-src/ext/mysqli/mysqli_nonapi.c:1.17
--- php-src/ext/mysqli/mysqli_nonapi.c:1.16 Sat Sep  6 15:34:48 2003
+++ php-src/ext/mysqli/mysqli_nonapi.c  Tue Sep 16 15:45:22 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.16 2003/09/06 19:34:48 helly Exp $ 
+  $Id: mysqli_nonapi.c,v 1.17 2003/09/16 19:45:22 hholzgra Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -100,7 +100,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mysqli_connct_errno()
+/* {{{ proto int mysqli_connect_errno()
Returns the numerical value of the error message from last connect command */
 PHP_FUNCTION(mysqli_connect_errno)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c ZendEngine2 zend.c

2003-08-31 Thread Marcus Boerger
helly   Sun Aug 31 06:52:24 2003 EDT

  Modified files:  
/ZendEngine2zend.c 
/php-src/ext/mysqli mysqli_api.c 
  Log:
  Revisited: Replace the non portable code by spprintf
  
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.246 ZendEngine2/zend.c:1.247
--- ZendEngine2/zend.c:1.246Sun Aug 31 05:35:54 2003
+++ ZendEngine2/zend.c  Sun Aug 31 06:52:22 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: zend.c,v 1.246 2003/08/31 09:35:54 helly Exp $ */
+/* $Id: zend.c,v 1.247 2003/08/31 10:52:22 helly Exp $ */
 
 #include zend.h
 #include zend_extensions.h
@@ -841,8 +841,6 @@
 }
 
 
-#define ZEND_ERROR_BUFFER_SIZE 1024
-
 ZEND_API void zend_error(int type, const char *format, ...)
 {
va_list args;
@@ -890,7 +888,6 @@
error_filename = Unknown;
}
 
-
va_start(args, format);
 
/* if we don't have a user defined error handler */
@@ -913,22 +910,9 @@
ALLOC_INIT_ZVAL(z_error_filename);
ALLOC_INIT_ZVAL(z_error_lineno);
ALLOC_INIT_ZVAL(z_context);
-   z_error_message-value.str.val = (char *) 
emalloc(ZEND_ERROR_BUFFER_SIZE);
 
-#ifdef HAVE_VSNPRINTF
-   vsnprintf(z_error_message-value.str.val, 
ZEND_ERROR_BUFFER_SIZE, format, args);
-   /* this MUST be revisited, but for now handle ALL 
implementation 
-* out there correct. Since this is inside an error handler 
the 
-* performance loss by strlne is irrelevant. */
-   z_error_message-value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = 
'\0';
-   z_error_message-value.str.len = 
strlen(z_error_message-value.str.val);
-#else
-   strncpy(z_error_message-value.str.val, format, 
ZEND_ERROR_BUFFER_SIZE);
-   z_error_message-value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = 
'\0';
-   z_error_message-value.str.len = 
strlen(z_error_message-value.str.val);
-   /* This is risky... */
-   /* z_error_message-value.str.len = 
vsprintf(z_error_message-value.str.val, format, args); */
-#endif
+   z_error_message-value.str.len = 
zend_vspprintf(z_error_message-value.str.val, 0, format, args);
+
z_error_message-type = IS_STRING;
 
z_error_type-value.lval = type;
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.41 php-src/ext/mysqli/mysqli_api.c:1.42
--- php-src/ext/mysqli/mysqli_api.c:1.41Thu Aug 28 17:00:19 2003
+++ php-src/ext/mysqli/mysqli_api.c Sun Aug 31 06:52:23 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.41 2003/08/28 21:00:19 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.42 2003/08/31 10:52:23 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1691,7 +1691,7 @@
 
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt);
 
-   mysql_stmt_data_seek(stmt-stmt, offset);
+// mysql_stmt_data_seek(stmt-stmt, offset);
return;
 }
 /* }}} */
@@ -1711,7 +1711,7 @@
 
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt);
 
-   rc = mysql_stmt_num_rows(stmt-stmt);
+// rc = mysql_stmt_num_rows(stmt-stmt);
MYSQLI_RETURN_LONG_LONG(rc)
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_nonapi.c

2003-07-28 Thread Jani Taskinen
sniper  Mon Jul 28 06:23:36 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
  Log:
  ws fix
  
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.37 php-src/ext/mysqli/mysqli_api.c:1.38
--- php-src/ext/mysqli/mysqli_api.c:1.37Fri Jul 18 02:17:39 2003
+++ php-src/ext/mysqli/mysqli_api.c Mon Jul 28 06:23:36 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.37 2003/07/18 06:17:39 georg Exp $ 
+  $Id: mysqli_api.c,v 1.38 2003/07/28 10:23:36 sniper Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -120,7 +120,7 @@
if (zend_hash_num_elements(Z_ARRVAL_P(types)) != argc - start) {
/* number of bind variables doesn't match number of elements in array 
*/
php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of elements in 
type array doesn't match number of bind variables);
-}
+   }
 
/* prevent leak if variables are already bound */
if (stmt-param.var_cnt) {
@@ -1677,23 +1677,22 @@
 /* }}} */
 
 /* {{{ proto void mysqli_stmt_data_seek(object stmt, int offset)
-Move internal result pointer */
+   Move internal result pointer */
 PHP_FUNCTION(mysqli_stmt_data_seek)
 {
-STMT   *stmt;
-zval   *mysql_stmt;
-PR_STMT*prstmt;  
-long   offset;
-
-if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Ol, 
mysql_stmt, mysqli_stmt_class_entry, offset) == FAILURE) {
-   return;
-}
+   STMT*stmt;
+   zval*mysql_stmt;
+   PR_STMT *prstmt;  
+   longoffset;
 
-MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, mysqli_stmt);
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Ol, 
mysql_stmt, mysqli_stmt_class_entry, offset) == FAILURE) {
+   return;
+   }
 
+   MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt);
 
-mysql_stmt_data_seek(stmt-stmt, offset);
-return;
+   mysql_stmt_data_seek(stmt-stmt, offset);
+   return;
 }
 /* }}} */
 
@@ -1709,6 +1708,7 @@
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, 
mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
}
+
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt);
 
rc = mysql_stmt_num_rows(stmt-stmt);
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.13 php-src/ext/mysqli/mysqli_nonapi.c:1.14
--- php-src/ext/mysqli/mysqli_nonapi.c:1.13 Fri Jul 18 02:17:39 2003
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Jul 28 06:23:36 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.13 2003/07/18 06:17:39 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.14 2003/07/28 10:23:36 sniper Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -146,7 +146,8 @@
 
 /* {{{ proto resource mysqli_query(object link, string query [,int resultmode])
Send a MySQL query */
-PHP_FUNCTION(mysqli_query) {
+PHP_FUNCTION(mysqli_query)
+{
MYSQL   *mysql;
zval*mysql_link;
MYSQLI_RESOURCE *mysqli_resource;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c mysqli_nonapi.c php_mysqli.h

2003-07-18 Thread Georg Richter
georg   Fri Jul 18 02:17:39 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_nonapi.c mysqli_fe.c php_mysqli.h 
mysqli_api.c 
  Log:
  added new functions:
mysqli_connect_error
mysqli_connect_errno
  
which return possible errors for the last connect
  
  
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.12 php-src/ext/mysqli/mysqli_nonapi.c:1.13
--- php-src/ext/mysqli/mysqli_nonapi.c:1.12 Sun Jun 22 02:16:47 2003
+++ php-src/ext/mysqli/mysqli_nonapi.c  Fri Jul 18 02:17:39 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.12 2003/06/22 06:16:47 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.13 2003/07/18 06:17:39 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -76,6 +76,7 @@
mysql_close(mysql);
RETURN_FALSE;
}
+   php_mysqli_set_error(mysql_errno(mysql), (char *) mysql_error(mysql) 
TSRMLS_CC);
 
if (MyG(profiler)) {
prmysql = (PR_MYSQL *)MYSQLI_PROFILER_NEW(prmain, MYSQLI_PR_MYSQL, 0);
@@ -96,6 +97,22 @@
} else {
((mysqli_object *) zend_object_store_get_object(object 
TSRMLS_CC))-ptr = mysqli_resource;
}
+}
+/* }}} */
+
+/* {{{ proto int mysqli_connct_errno()
+   Returns the numerical value of the error message from last connect command */
+PHP_FUNCTION(mysqli_connect_errno)
+{
+   RETURN_LONG(MyG(error_no));
+}
+/* }}} */
+
+/* {{{ proto string mysqli_connect_error()
+   Returns the text of the error message from previous MySQL operation */
+PHP_FUNCTION(mysqli_connect_error) 
+{
+   RETURN_STRING(MyG(error_msg),1);
 }
 /* }}} */
 
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.15 php-src/ext/mysqli/mysqli_fe.c:1.16
--- php-src/ext/mysqli/mysqli_fe.c:1.15 Tue Jul 15 10:00:19 2003
+++ php-src/ext/mysqli/mysqli_fe.c  Fri Jul 18 02:17:39 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.15 2003/07/15 14:00:19 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.16 2003/07/18 06:17:39 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -50,6 +50,8 @@
PHP_FE(mysqli_close,   
 NULL)
PHP_FE(mysqli_commit,  
 NULL)
PHP_FE(mysqli_connect, 
 NULL)
+   PHP_FE(mysqli_connect_errno,NULL)
+   PHP_FE(mysqli_connect_error,NULL)
PHP_FE(mysqli_data_seek,   
 NULL)
PHP_FE(mysqli_debug,   
 NULL)
PHP_FE(mysqli_disable_reads_from_master,NULL)
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.19 php-src/ext/mysqli/php_mysqli.h:1.20
--- php-src/ext/mysqli/php_mysqli.h:1.19Tue Jul 15 10:00:18 2003
+++ php-src/ext/mysqli/php_mysqli.h Fri Jul 18 02:17:39 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.19 2003/07/15 14:00:18 georg Exp $ 
+  $Id: php_mysqli.h,v 1.20 2003/07/18 06:17:39 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -203,6 +203,8 @@
 PHP_FUNCTION(mysqli_close);
 PHP_FUNCTION(mysqli_commit);
 PHP_FUNCTION(mysqli_connect);
+PHP_FUNCTION(mysqli_connect_errno);
+PHP_FUNCTION(mysqli_connect_error);
 PHP_FUNCTION(mysqli_data_seek);
 PHP_FUNCTION(mysqli_debug);
 PHP_FUNCTION(mysqli_disable_reads_from_master);
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.36 php-src/ext/mysqli/mysqli_api.c:1.37
--- php-src/ext/mysqli/mysqli_api.c:1.36Tue Jul 15 10:00:18 2003
+++ php-src/ext/mysqli/mysqli_api.c Fri Jul 18 02:17:39 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.36 2003/07/15 14:00:18 georg Exp $ 
+  $Id: mysqli_api.c,v 1.37 2003/07/18 06:17:39 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1422,6 +1422,8 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, mysql_error(mysql));
RETURN_FALSE;
}
+   php_mysqli_set_error(mysql_errno(mysql), (char *)mysql_error(mysql) TSRMLS_CC);
+   
RETURN_TRUE;
 }
 /* }}} */
@@ -1675,23 +1677,23 @@
 /* }}} */
 
 /* {{{ proto void 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h

2003-07-15 Thread Georg Richter
georg   Tue Jul 15 10:00:19 2003 EDT

  Modified files:  
/php-src/ext/mysqli php_mysqli.h mysqli_api.c mysqli_fe.c 
  Log:
  added new function mysqli_stmt_data_seek
  
  
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.18 php-src/ext/mysqli/php_mysqli.h:1.19
--- php-src/ext/mysqli/php_mysqli.h:1.18Tue Jul 15 06:37:19 2003
+++ php-src/ext/mysqli/php_mysqli.h Tue Jul 15 10:00:18 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.18 2003/07/15 10:37:19 georg Exp $ 
+  $Id: php_mysqli.h,v 1.19 2003/07/15 14:00:18 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -266,6 +266,7 @@
 PHP_FUNCTION(mysqli_stat);
 PHP_FUNCTION(mysqli_stmt_affected_rows);
 PHP_FUNCTION(mysqli_stmt_close);
+PHP_FUNCTION(mysqli_stmt_data_seek);
 PHP_FUNCTION(mysqli_stmt_errno);
 PHP_FUNCTION(mysqli_stmt_error);
 PHP_FUNCTION(mysqli_stmt_num_rows);
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.35 php-src/ext/mysqli/mysqli_api.c:1.36
--- php-src/ext/mysqli/mysqli_api.c:1.35Tue Jul 15 06:37:19 2003
+++ php-src/ext/mysqli/mysqli_api.c Tue Jul 15 10:00:18 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.35 2003/07/15 10:37:19 georg Exp $ 
+  $Id: mysqli_api.c,v 1.36 2003/07/15 14:00:18 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -454,7 +454,7 @@
 }
 /* }}} */
 
-/* {{{ proto void mysqli_data_seek(object result)
+/* {{{ proto void mysqli_data_seek(object result, int offset)
Move internal result pointer */
 PHP_FUNCTION(mysqli_data_seek)
 {
@@ -464,7 +464,7 @@
PR_COMMAND  *prcommand;
longoffset;
 
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Orl, 
mysql_result, mysqli_result_class_entry, mysql_result, offset) == FAILURE) {
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Ol, 
mysql_result, mysqli_result_class_entry, offset) == FAILURE) {
return;
}
 
@@ -1671,6 +1671,27 @@
MYSQLI_CLEAR_RESOURCE(mysql_stmt);
RETURN_TRUE;
 
+}
+/* }}} */
+
+/* {{{ proto void mysqli_stmt_data_seek(object stmt, int offset)
+   Move internal result pointer */
+PHP_FUNCTION(mysqli_stmt_data_seek)
+{
+   STMT*stmt;
+   zval*mysql_stmt;
+   PR_STMT *prstmt;  
+   longoffset;
+
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Ol, 
mysql_stmt, mysqli_stmt_class_entry, offset) == FAILURE) {
+   return;
+   }
+
+   MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt);
+
+
+   mysql_stmt_data_seek(stmt-stmt, offset);
+   return;
 }
 /* }}} */
 
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.14 php-src/ext/mysqli/mysqli_fe.c:1.15
--- php-src/ext/mysqli/mysqli_fe.c:1.14 Sat Jun 28 17:27:08 2003
+++ php-src/ext/mysqli/mysqli_fe.c  Tue Jul 15 10:00:19 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.14 2003/06/28 21:27:08 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.15 2003/07/15 14:00:19 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -116,6 +116,7 @@
PHP_FE(mysqli_stat,
 NULL)
PHP_FE(mysqli_stmt_affected_rows,   NULL)
PHP_FE(mysqli_stmt_close,  
 NULL)
+   PHP_FE(mysqli_stmt_data_seek,   NULL)
PHP_FE(mysqli_stmt_errno,  
 NULL)
PHP_FE(mysqli_stmt_error,  
 NULL)
PHP_FE(mysqli_stmt_num_rows,NULL)
@@ -234,6 +235,7 @@
PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL)
PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
PHP_FALIAS(close,mysqli_stmt_close,NULL)
+   PHP_FALIAS(data_seek,mysqli_stmt_data_seek,NULL)
PHP_FALIAS(errno,mysqli_stmt_errno,NULL)
PHP_FALIAS(error,mysqli_stmt_error,NULL)
PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mysqli mysqli_api.c mysqli_fe.c

2003-06-28 Thread Georg Richter
georg   Sat Jun 28 17:27:08 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_api.c mysqli_fe.c 
  Log:
  added BYREF_FORCE for bind parameters in msqli_bind_param and mysqli_bind_result
  changed function parameters in mysqli_bind_param
from (object statement, mixed var1, long type1, ...)
to   (object statement, array tyoes, mixed var1, mixed var2, ...)
  
  Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.33 php-src/ext/mysqli/mysqli_api.c:1.34
--- php-src/ext/mysqli/mysqli_api.c:1.33Sun Jun 22 04:46:39 2003
+++ php-src/ext/mysqli/mysqli_api.c Sat Jun 28 17:27:08 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.33 2003/06/22 08:46:39 georg Exp $ 
+  $Id: mysqli_api.c,v 1.34 2003/06/28 21:27:08 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -77,7 +77,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_bind_param(object stmt, mixed variable, int type 
[,mixed,])
+/* {{{ proto bool mysqli_bind_param(object stmt, array types, mixed variable 
[,mixed,])
Bind variables to a prepared statement as parameters */
 PHP_FUNCTION(mysqli_bind_param)
 {
@@ -85,52 +85,43 @@
int argc = ZEND_NUM_ARGS();
int i;
int num_vars;
-   int start = 0;
+   int start = 2;
int ofs;
STMT*stmt;
+   zval*mysql_stmt;
MYSQL_BIND  *bind;
-   zval**object;
+   zval*types;
PR_STMT *prstmt;
PR_COMMAND  *prcommand;
+   HashPositionhpos;
unsigned long   rc;
 
/* calculate and check number of parameters */
-   num_vars = argc;
+   num_vars = argc - 1;
if (!getThis()) {
/* ignore handle parameter in procedural interface*/
--num_vars; 
}
-   if (num_vars % 2) {
-   /* we need variable/type pairs */
-   WRONG_PARAM_COUNT;
-   }
-   if (num_vars  2) {
+   if (argc  2) {
/* there has to be at least one pair */
WRONG_PARAM_COUNT;
}
-   num_vars /= 2;
-  
-
-   args = (zval ***)emalloc(argc * sizeof(zval **));
 
-   if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
-   efree(args);
-   WRONG_PARAM_COUNT;
+   if (zend_parse_method_parameters((getThis()) ? 1:2 TSRMLS_CC, getThis(), Oa, 
mysql_stmt, mysqli_stmt_class_entry, types) == FAILURE) {
+   return; 
}
 
-   if (!getThis()) {
-   if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
-   efree(args);
-   RETURN_FALSE;
-   }
-   MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, args[0], 
mysqli_stmt); 
+   MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, 
mysqli_stmt); 
+
+   if (getThis()) {
start = 1;
-   } else {
-   object = (getThis());  
-   MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, object, 
mysqli_stmt); 
}
 
-
+   if (zend_hash_num_elements(Z_ARRVAL_P(types)) != argc - start) {
+   /* number of bind variables doesn't match number of elements in array 
*/
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of elements in 
type array doesn't match number of bind variables);
+}   
+   
/* prevent leak if variables are already bound */
 #if HHOLZGRA_0
/* this would prevent using both bind_param and bind_result on SELECT
@@ -141,21 +132,26 @@
RETURN_FALSE;
}
 #endif
+   args = (zval ***)emalloc(argc * sizeof(zval **));
+
+   if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
+   efree(args);
+   WRONG_PARAM_COUNT;
+   }
 
stmt-is_null = ecalloc(num_vars, sizeof(char));
bind = (MYSQL_BIND *)ecalloc(num_vars, sizeof(MYSQL_BIND));
 
-   for (i=start; i  num_vars * 2 + start; i+=2) {
-   ofs = (i - start) / 2;
-   if (!PZVAL_IS_REF(*args[i])  Z_LVAL_PP(args[i+1]) != 
MYSQLI_BIND_SEND_DATA) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Parameter %d 
wasn't passed by reference, i+1);
-   efree(bind);
-   efree(args);
-   RETURN_FALSE;
-   }
+   zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(types), hpos);
+
+   ofs = 0;
+   for (i=start; i  argc; i++) {
+   zval **ctype;
+
+   zend_hash_get_current_data_ex(Z_ARRVAL_P(types), (void **)ctype,