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.19        Tue 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.36        Tue 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 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;
+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;
-       }
+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");
+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;
 }
 /* }}} */
 



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

Reply via email to