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

2005-07-12 Thread Georg Richter
georg   Tue Jul 12 05:35:17 2005 EDT

  Modified files:  
/php-src/ext/mysqli php_mysqli.h mysqli_nonapi.c 
  Log:
  removed charset structure. libmysql now provides a function 
  mysqli_get_character_set_info (Vers. 5.0.10) 
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.50r2=1.51ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.50 
php-src/ext/mysqli/php_mysqli.h:1.51
--- php-src/ext/mysqli/php_mysqli.h:1.50Wed Jun 22 05:12:43 2005
+++ php-src/ext/mysqli/php_mysqli.h Tue Jul 12 05:35:16 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.50 2005/06/22 09:12:43 georg Exp $ 
+  $Id: php_mysqli.h,v 1.51 2005/07/12 09:35:16 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -26,6 +26,12 @@
 #endif
 
 #include mysql.h
+
+/* character set support */
+#if MYSQL_VERSION_ID  50009
+#define HAVE_MYSQLI_SET_CHARSET
+#endif
+
 #include errmsg.h
 
 #ifndef PHP_MYSQLI_H
@@ -96,32 +102,6 @@
void*userdata;
 } mysqli_local_infile;
 
-typedef struct {
-  uint number;
-  uint primary_number;
-  uint binary_number;
-  uint state;
-  const char   *csname;
-  const char   *name;
-  const char   *comment;
-  const char   *tailoring;
-  unsigned char*ctype;
-  unsigned char*to_lower;
-  unsigned char*to_upper;
-  unsigned char*sort_order;
-  unsigned short   *contractions;
-  unsigned short   **sort_order_big;
-  unsigned short   *tab_to_uni;
-  void *tab_from_uni;
-  unsigned char*state_map;
-  unsigned char*ident_map;
-  uint strxfrm_multiply;
-  uint mbminlen;
-  uint mbmaxlen;
-  unsigned short   min_sort_char;
-  unsigned short   max_sort_char; /* For LIKE optimization */
-} CHARSET_INFO;
-
 #define phpext_mysqli_ptr mysqli_module_entry
 
 #ifdef PHP_WIN32
@@ -130,10 +110,6 @@
 #define PHP_MYSQLI_API
 #endif
 
-#if (MYSQL_VERSION_ID  40112  MYSQL_VERSION_ID  5) || MYSQL_VERSION_ID 
 50005
-#define HAVE_MYSQLI_SET_CHARSET
-#endif
-
 #ifdef ZTS
 #include TSRM.h
 #endif
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.48r2=1.49ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.48 
php-src/ext/mysqli/mysqli_nonapi.c:1.49
--- php-src/ext/mysqli/mysqli_nonapi.c:1.48 Mon Jun 27 13:33:56 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Tue Jul 12 05:35:16 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.48 2005/06/27 17:33:56 tony2001 Exp $ 
+  $Id: mysqli_nonapi.c,v 1.49 2005/07/12 09:35:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -329,7 +329,7 @@
 {
MY_MYSQL*mysql;
zval*mysql_link;
-   CHARSET_INFO*cs;
+   MY_CHARSET_INFO cs;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -338,13 +338,16 @@
 
object_init(return_value);
 
-   cs = (CHARSET_INFO *)mysql-mysql-charset;
+   mysql_get_character_set_info(mysql-mysql, cs);
 
-   add_property_string(return_value, charset, (cs-name) ? (char 
*)cs-csname : , 1);
-   add_property_string(return_value, collation,(cs-name) ? (char 
*)cs-name : , 1);
-   add_property_string(return_value, comment, (cs-comment) ? (char 
*)cs-comment : , 1);
-   add_property_long(return_value, min_length, cs-mbminlen);
-   add_property_long(return_value, max_length, cs-mbmaxlen);
+   add_property_string(return_value, charset, (cs.name) ? (char 
*)cs.csname : , 1);
+   add_property_string(return_value, collation,(cs.name) ? (char 
*)cs.name : , 1);
+   add_property_string(return_value, comment, (cs.comment) ? (char 
*)cs.comment : , 1);
+   add_property_string(return_value, dir, (cs.dir) ? (char *)cs.dir : 
, 1);
+   add_property_long(return_value, min_length, cs.mbminlen);
+   add_property_long(return_value, max_length, cs.mbmaxlen);
+   add_property_long(return_value, number, cs.number);
+   add_property_long(return_value, state, cs.state);
 }
 /* }}} */
 

-- 
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_nonapi.c php_mysqli.h

2005-07-12 Thread Georg Richter
georg   Tue Jul 12 11:45:12 2005 EDT

  Modified files:  
/php-src/ext/mysqli php_mysqli.h mysqli_nonapi.c 
  Log:
  changed version dependency for charset functions
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.51r2=1.52ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.51 
php-src/ext/mysqli/php_mysqli.h:1.52
--- php-src/ext/mysqli/php_mysqli.h:1.51Tue Jul 12 05:35:16 2005
+++ php-src/ext/mysqli/php_mysqli.h Tue Jul 12 11:45:07 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.51 2005/07/12 09:35:16 georg Exp $ 
+  $Id: php_mysqli.h,v 1.52 2005/07/12 15:45:07 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -29,6 +29,10 @@
 
 /* character set support */
 #if MYSQL_VERSION_ID  50009
+#define HAVE_MYSQLI_GET_CHARSET
+#endif
+
+#if (MYSQL_VERSION_ID  40112  MYSQL_VERSION_ID  5) || MYSQL_VERSION_ID 
 50005
 #define HAVE_MYSQLI_SET_CHARSET
 #endif
 
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.49r2=1.50ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.49 
php-src/ext/mysqli/mysqli_nonapi.c:1.50
--- php-src/ext/mysqli/mysqli_nonapi.c:1.49 Tue Jul 12 05:35:16 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Tue Jul 12 11:45:07 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.49 2005/07/12 09:35:16 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.50 2005/07/12 15:45:07 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -323,6 +323,7 @@
 /* }}} */
 #endif
 
+#ifdef HAVE_MYSQLI_GET_CHARSET 
 /* {{{ object mysqli_get_charset(object link) 
returns a character set object */
 PHP_FUNCTION(mysqli_get_charset)
@@ -350,6 +351,7 @@
add_property_long(return_value, state, cs.state);
 }
 /* }}} */
+#endif
 
 /*
  * Local variables:

-- 
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_nonapi.c php_mysqli.h /ext/mysqli/tests bug31668.phpt

2005-04-27 Thread Andrey Hristov
andrey  Wed Apr 27 08:12:58 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_nonapi.c php_mysqli.h 
/php-src/ext/mysqli/tests   bug31668.phpt 
  Log:
  MFB (fixing bug 31668)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.40r2=1.41ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.40 
php-src/ext/mysqli/mysqli_nonapi.c:1.41
--- php-src/ext/mysqli/mysqli_nonapi.c:1.40 Thu Feb 24 18:58:59 2005
+++ php-src/ext/mysqli/mysqli_nonapi.c  Wed Apr 27 08:12:58 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.40 2005/02/24 23:58:59 iliaa Exp $ 
+  $Id: mysqli_nonapi.c,v 1.41 2005/04/27 12:12:58 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -67,7 +67,7 @@
}
}
 
-   mysql = (MY_MYSQL *)calloc(1, sizeof(MY_MYSQL));
+   mysql = (MY_MYSQL *) ecalloc(1, sizeof(MY_MYSQL));
 
if (!(mysql-mysql = mysql_init(NULL))) {
efree(mysql);
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.43r2=1.44ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.43 
php-src/ext/mysqli/php_mysqli.h:1.44
--- php-src/ext/mysqli/php_mysqli.h:1.43Sun Jan 16 14:28:55 2005
+++ php-src/ext/mysqli/php_mysqli.h Wed Apr 27 08:12:58 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.43 2005/01/16 19:28:55 zak Exp $ 
+  $Id: php_mysqli.h,v 1.44 2005/04/27 12:12:58 andrey Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -57,6 +57,7 @@
MYSQL   *mysql;
zval*li_read;
php_stream  *li_stream;
+   unsigned int multi_query;   
 } MY_MYSQL;
 
 typedef struct {
@@ -149,14 +150,14 @@
 
 PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry * 
TSRMLS_DC);
 
-#define MYSQLI_DISABLE_MQ if (MyG(multi_query)) { \
+#define MYSQLI_DISABLE_MQ if (mysql-multi_query) { \
mysql_set_server_option(mysql-mysql, 
MYSQL_OPTION_MULTI_STATEMENTS_OFF); \
-   MyG(multi_query) = 0; \
+   mysql-multi_query = 0; \
 } 
 
-#define MYSQLI_ENABLE_MQ if (!MyG(multi_query)) { \
+#define MYSQLI_ENABLE_MQ if (!mysql-multi_query) { \
mysql_set_server_option(mysql-mysql, 
MYSQL_OPTION_MULTI_STATEMENTS_ON); \
-   MyG(multi_query) = 1; \
+   mysql-multi_query = 1; \
 } 
 
 #define REGISTER_MYSQLI_CLASS_ENTRY(name, mysqli_entry, class_functions) { \
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/bug31668.phpt?r1=1.1r2=1.2ty=u
Index: php-src/ext/mysqli/tests/bug31668.phpt
diff -u /dev/null php-src/ext/mysqli/tests/bug31668.phpt:1.2
--- /dev/null   Wed Apr 27 08:12:58 2005
+++ php-src/ext/mysqli/tests/bug31668.phpt  Wed Apr 27 08:12:58 2005
@@ -0,0 +1,56 @@
+--TEST--
+Bug #31668 multi_query works exactly every other time (multi_query was global, 
now per connection)
+--SKIPIF--
+?php require_once('skipif.inc'); ?
+--FILE--
+?php
+   include connect.inc;
+
+   $mysql = new mysqli($host, $user, $passwd, test);
+   $mysql-multi_query('SELECT 1;SELECT 2');
+   do {
+   $res = $mysql-store_result();  
+   if ($mysql-errno == 0) {
+   while ($arr = $res-fetch_assoc()) {
+   var_dump($arr);
+   }
+   $res-free();
+   }
+   } while ($mysql-next_result());
+   var_dump($mysql-error, __LINE__);
+   $mysql-close();
+
+   $mysql = new mysqli($host, $user, $passwd, test);
+   $mysql-multi_query('SELECT 1;SELECT 2');
+   do {
+   $res = $mysql-store_result();  
+   if ($mysql-errno == 0) {
+   while ($arr = $res-fetch_assoc()) {
+   var_dump($arr);
+   }
+   $res-free();
+   }
+   } while ($mysql-next_result());
+   var_dump($mysql-error, __LINE__);
+?
+--EXPECTF--
+array(1) {
+  [1]=
+  string(1) 1
+}
+array(1) {
+  [2]=
+  string(1) 2
+}
+string(0) 
+int(%d)
+array(1) {
+  [1]=
+  string(1) 1
+}
+array(1) {
+  [2]=
+  string(1) 2
+}
+string(0) 
+int(%d)

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