~ubuntu-branches/ubuntu/lucid/php5/lucid

« back to all changes in this revision

Viewing changes to ext/mysql/php_mysql.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-03-16 09:09:50 UTC
  • mfrom: (1.1.18 upstream) (0.3.10 sid)
  • Revision ID: james.westby@ubuntu.com-20100316090950-e36m0pzranoixifd
Tags: 5.3.2-1ubuntu1
* Merge from debian unstable: 
  - debian/control:
    * Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
    * Dropped libmysqlclient15-dev, build against mysql 5.1.
    * Dropped libcurl-dev not in the archive.
    * Suggest php5-suhosin rather than recommends.
    * Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions already in
      universe.
    * Dropped libonig-dev and libqgdbm since its in universe. (will be re-added in lucid+1)
    * Dropped locales-all.
  - modulelist: Drop imap, interbase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
  - Dropped debian/patches/libedit_is_editline.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
   +----------------------------------------------------------------------+
3
3
   | PHP Version 5                                                        |
4
4
   +----------------------------------------------------------------------+
5
 
   | Copyright (c) 1997-2009 The PHP Group                                |
 
5
   | Copyright (c) 1997-2010 The PHP Group                                |
6
6
   +----------------------------------------------------------------------+
7
7
   | This source file is subject to version 3.01 of the PHP license,      |
8
8
   | that is bundled with this package in the file LICENSE, and is        |
18
18
   +----------------------------------------------------------------------+
19
19
*/
20
20
 
21
 
/* $Id: php_mysql.c 289630 2009-10-14 13:51:25Z johannes $ */
 
21
/* $Id: php_mysql.c 294891 2010-02-11 17:14:44Z johannes $ */
22
22
 
23
23
/* TODO:
24
24
 *
125
125
        int multi_query;
126
126
} php_mysql_conn;
127
127
 
128
 
#ifdef MYSQL_USE_MYSQLND
129
 
static MYSQLND_ZVAL_PCACHE *mysql_mysqlnd_zval_cache;
130
 
static MYSQLND_QCACHE           *mysql_mysqlnd_qcache;
131
 
#endif
132
128
 
133
129
#if MYSQL_VERSION_ID >= 40101
134
130
#define MYSQL_DISABLE_MQ if (mysql->multi_query) { \
411
407
        STD_PHP_INI_ENTRY("mysql.connect_timeout",              "60",   PHP_INI_ALL,            OnUpdateLong,           connect_timeout,        zend_mysql_globals,             mysql_globals)
412
408
        STD_PHP_INI_BOOLEAN("mysql.trace_mode",                 "0",    PHP_INI_ALL,            OnUpdateLong,           trace_mode,             zend_mysql_globals,             mysql_globals)
413
409
        STD_PHP_INI_BOOLEAN("mysql.allow_local_infile", "1",    PHP_INI_SYSTEM,         OnUpdateLong,           allow_local_infile, zend_mysql_globals,         mysql_globals)
414
 
#ifdef MYSQL_USE_MYSQLND
415
 
        STD_PHP_INI_ENTRY("mysql.cache_size",                   "2000", PHP_INI_SYSTEM,         OnUpdateLong,           cache_size,                     zend_mysql_globals,             mysql_globals)
416
 
#endif
417
410
PHP_INI_END()
418
411
/* }}} */
419
412
 
432
425
        mysql_globals->trace_mode = 0;
433
426
        mysql_globals->allow_local_infile = 1;
434
427
        mysql_globals->result_allocated = 0;
435
 
#ifdef MYSQL_USE_MYSQLND
436
 
        mysql_globals->cache_size = 0;
437
 
        mysql_globals->mysqlnd_thd_zval_cache = NULL;
438
 
#endif
439
428
}
440
429
/* }}} */
441
430
 
465
454
                return FAILURE;
466
455
        }
467
456
#endif
468
 
#else
469
 
        mysql_mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MySG(cache_size));
470
 
        mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache();
471
457
#endif
472
458
 
473
459
        return SUCCESS;
493
479
        mysql_server_end();
494
480
#endif
495
481
#endif
496
 
#else
497
 
        mysqlnd_palloc_free_cache(mysql_mysqlnd_zval_cache);
498
 
        mysqlnd_qcache_free_cache_reference(&mysql_mysqlnd_qcache);
499
482
#endif
500
483
 
501
484
        UNREGISTER_INI_ENTRIES();
519
502
        MySG(connect_errno) =0;
520
503
        MySG(result_allocated) = 0;
521
504
 
522
 
#ifdef MYSQL_USE_MYSQLND
523
 
        MySG(mysqlnd_thd_zval_cache) = mysqlnd_palloc_rinit(mysql_mysqlnd_zval_cache);
524
 
#endif
525
 
 
526
505
        return SUCCESS;
527
506
}
528
507
/* }}} */
559
538
 
560
539
#ifdef MYSQL_USE_MYSQLND
561
540
        zend_hash_apply(&EG(persistent_list), (apply_func_t) php_mysql_persistent_helper TSRMLS_CC);
562
 
        mysqlnd_palloc_rshutdown(MySG(mysqlnd_thd_zval_cache));
563
541
#endif
564
542
 
565
543
        return SUCCESS;
585
563
        php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE);
586
564
        php_info_print_table_row(2, "MYSQL_LIBS", PHP_MYSQL_LIBS);
587
565
#endif
588
 
#if defined(MYSQL_USE_MYSQLND)
589
 
        {
590
 
                zval values;
591
 
 
592
 
                php_info_print_table_header(2, "Persistent cache", mysql_mysqlnd_zval_cache? "enabled":"disabled");
593
 
                
594
 
                if (mysql_mysqlnd_zval_cache) {
595
 
                        /* Now report cache status */
596
 
                        mysqlnd_palloc_stats(mysql_mysqlnd_zval_cache, &values);
597
 
                        mysqlnd_minfo_print_hash(&values);
598
 
                        zval_dtor(&values);
599
 
                }
600
 
        }
601
 
#endif
602
566
 
603
567
        php_info_print_table_end();
604
568
 
704
668
                        client_flags ^= CLIENT_LOCAL_FILES;
705
669
                }
706
670
 
 
671
#ifdef CLIENT_MULTI_RESULTS
 
672
                client_flags |= CLIENT_MULTI_RESULTS; /* compatibility with 5.2, see bug#50416 */
 
673
#endif
707
674
#ifdef CLIENT_MULTI_STATEMENTS
708
675
                client_flags &= ~CLIENT_MULTI_STATEMENTS;   /* don't allow multi_queries via connect parameter */
709
676
#endif
776
743
#ifndef MYSQL_USE_MYSQLND
777
744
                        if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
778
745
#else
779
 
                        if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, 
780
 
                                                                port, socket, client_flags, MySG(mysqlnd_thd_zval_cache) TSRMLS_CC) == NULL)
 
746
                        if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, port, socket, client_flags TSRMLS_CC) == NULL)
781
747
#endif
782
748
                        {
783
749
                                /* Populate connect error globals so that the error functions can read them */
825
791
#ifndef MYSQL_USE_MYSQLND
826
792
                                        if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
827
793
#else
828
 
                                        if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, 
829
 
                                                                                port, socket, client_flags, MySG(mysqlnd_thd_zval_cache) TSRMLS_CC) == NULL)
 
794
                                        if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, port, socket, client_flags TSRMLS_CC) == NULL)
830
795
#endif
831
796
                                        {
832
797
                                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect");
838
803
                                }
839
804
                        } else {
840
805
#ifdef MYSQL_USE_MYSQLND
841
 
                                mysqlnd_restart_psession(mysql->conn, MySG(mysqlnd_thd_zval_cache));
 
806
                                mysqlnd_restart_psession(mysql->conn);
842
807
#endif
843
808
                        }
844
809
                }
897
862
#ifndef MYSQL_USE_MYSQLND
898
863
                if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) 
899
864
#else
900
 
                if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, 
901
 
                                                        port, socket, client_flags, MySG(mysqlnd_thd_zval_cache) TSRMLS_CC) == NULL)
 
865
                if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, port, socket, client_flags TSRMLS_CC) == NULL)
902
866
#endif
903
867
                {
904
868
                        /* Populate connect error globals so that the error functions can read them */