@@ -530,8 +530,6 @@ static PHP_GINIT_FUNCTION(mysqli)
530
530
/* {{{ PHP_MINIT_FUNCTION */
531
531
PHP_MINIT_FUNCTION (mysqli )
532
532
{
533
- zend_class_entry * ce ,cex ;
534
-
535
533
REGISTER_INI_ENTRIES ();
536
534
#ifndef MYSQLI_USE_MYSQLND
537
535
if (mysql_server_init (0 , NULL , NULL )) {
@@ -564,86 +562,38 @@ PHP_MINIT_FUNCTION(mysqli)
564
562
le_pmysqli = zend_register_list_destructors_ex (NULL , php_mysqli_dtor ,
565
563
"MySqli persistent connection" , module_number );
566
564
567
- INIT_CLASS_ENTRY (cex , "mysqli_sql_exception" , class_mysqli_sql_exception_methods );
568
- mysqli_exception_class_entry = zend_register_internal_class_ex (& cex , spl_ce_RuntimeException );
569
- mysqli_exception_class_entry -> ce_flags |= ZEND_ACC_FINAL ;
570
- zend_declare_property_long (mysqli_exception_class_entry , "code" , sizeof ("code" )- 1 , 0 , ZEND_ACC_PROTECTED );
571
- zend_declare_property_string (mysqli_exception_class_entry , "sqlstate" , sizeof ("sqlstate" )- 1 , "00000" , ZEND_ACC_PROTECTED );
565
+ mysqli_exception_class_entry = register_class_mysqli_sql_exception (spl_ce_RuntimeException );
572
566
573
- REGISTER_MYSQLI_CLASS_ENTRY ( "mysqli_driver" , mysqli_driver_class_entry , class_mysqli_driver_methods );
574
- ce = mysqli_driver_class_entry ;
567
+ mysqli_driver_class_entry = register_class_mysqli_driver ( );
568
+ mysqli_driver_class_entry -> create_object = mysqli_objects_new ;
575
569
zend_hash_init (& mysqli_driver_properties , 0 , NULL , free_prop_handler , 1 );
576
570
MYSQLI_ADD_PROPERTIES (& mysqli_driver_properties , mysqli_driver_property_entries );
577
- zend_declare_property_null (ce , "client_info" , sizeof ("client_info" ) - 1 , ZEND_ACC_PUBLIC );
578
- zend_declare_property_null (ce , "client_version" , sizeof ("client_version" ) - 1 , ZEND_ACC_PUBLIC );
579
- zend_declare_property_null (ce , "driver_version" , sizeof ("driver_version" ) - 1 , ZEND_ACC_PUBLIC );
580
- zend_declare_property_null (ce , "reconnect" , sizeof ("reconnect" ) - 1 , ZEND_ACC_PUBLIC );
581
- zend_declare_property_null (ce , "report_mode" , sizeof ("report_mode" ) - 1 , ZEND_ACC_PUBLIC );
582
- ce -> ce_flags |= ZEND_ACC_FINAL ;
583
- zend_hash_add_ptr (& classes , ce -> name , & mysqli_driver_properties );
584
-
585
- REGISTER_MYSQLI_CLASS_ENTRY ("mysqli" , mysqli_link_class_entry , class_mysqli_methods );
586
- ce = mysqli_link_class_entry ;
571
+ zend_hash_add_ptr (& classes , mysqli_driver_class_entry -> name , & mysqli_driver_properties );
572
+
573
+ mysqli_link_class_entry = register_class_mysqli ();
574
+ mysqli_link_class_entry -> create_object = mysqli_objects_new ;
587
575
zend_hash_init (& mysqli_link_properties , 0 , NULL , free_prop_handler , 1 );
588
576
MYSQLI_ADD_PROPERTIES (& mysqli_link_properties , mysqli_link_property_entries );
589
- zend_declare_property_null (ce , "affected_rows" , sizeof ("affected_rows" ) - 1 , ZEND_ACC_PUBLIC );
590
- zend_declare_property_null (ce , "client_info" , sizeof ("client_info" ) - 1 , ZEND_ACC_PUBLIC );
591
- zend_declare_property_null (ce , "client_version" , sizeof ("client_version" ) - 1 , ZEND_ACC_PUBLIC );
592
- zend_declare_property_null (ce , "connect_errno" , sizeof ("connect_errno" ) - 1 , ZEND_ACC_PUBLIC );
593
- zend_declare_property_null (ce , "connect_error" , sizeof ("connect_error" ) - 1 , ZEND_ACC_PUBLIC );
594
- zend_declare_property_null (ce , "errno" , sizeof ("errno" ) - 1 , ZEND_ACC_PUBLIC );
595
- zend_declare_property_null (ce , "error" , sizeof ("error" ) - 1 , ZEND_ACC_PUBLIC );
596
- zend_declare_property_null (ce , "error_list" , sizeof ("error_list" ) - 1 , ZEND_ACC_PUBLIC );
597
- zend_declare_property_null (ce , "field_count" , sizeof ("field_count" ) - 1 , ZEND_ACC_PUBLIC );
598
- zend_declare_property_null (ce , "host_info" , sizeof ("host_info" ) - 1 , ZEND_ACC_PUBLIC );
599
- zend_declare_property_null (ce , "info" , sizeof ("info" ) - 1 , ZEND_ACC_PUBLIC );
600
- zend_declare_property_null (ce , "insert_id" , sizeof ("insert_id" ) - 1 , ZEND_ACC_PUBLIC );
601
- zend_declare_property_null (ce , "server_info" , sizeof ("server_info" ) - 1 , ZEND_ACC_PUBLIC );
602
- zend_declare_property_null (ce , "server_version" , sizeof ("server_version" ) - 1 , ZEND_ACC_PUBLIC );
603
- zend_declare_property_null (ce , "sqlstate" , sizeof ("sqlstate" ) - 1 , ZEND_ACC_PUBLIC );
604
- zend_declare_property_null (ce , "protocol_version" , sizeof ("protocol_version" ) - 1 , ZEND_ACC_PUBLIC );
605
- zend_declare_property_null (ce , "thread_id" , sizeof ("thread_id" ) - 1 , ZEND_ACC_PUBLIC );
606
- zend_declare_property_null (ce , "warning_count" , sizeof ("warning_count" ) - 1 , ZEND_ACC_PUBLIC );
607
- zend_hash_add_ptr (& classes , ce -> name , & mysqli_link_properties );
608
-
609
- REGISTER_MYSQLI_CLASS_ENTRY ("mysqli_warning" , mysqli_warning_class_entry , class_mysqli_warning_methods );
610
- ce = mysqli_warning_class_entry ;
611
- ce -> ce_flags |= ZEND_ACC_FINAL ;
577
+ zend_hash_add_ptr (& classes , mysqli_link_class_entry -> name , & mysqli_link_properties );
578
+
579
+ mysqli_warning_class_entry = register_class_mysqli_warning ();
580
+ mysqli_warning_class_entry -> create_object = mysqli_objects_new ;
612
581
zend_hash_init (& mysqli_warning_properties , 0 , NULL , free_prop_handler , 1 );
613
582
MYSQLI_ADD_PROPERTIES (& mysqli_warning_properties , mysqli_warning_property_entries );
614
- zend_declare_property_null (ce , "message" , sizeof ("message" ) - 1 , ZEND_ACC_PUBLIC );
615
- zend_declare_property_null (ce , "sqlstate" , sizeof ("sqlstate" ) - 1 , ZEND_ACC_PUBLIC );
616
- zend_declare_property_null (ce , "errno" , sizeof ("errno" ) - 1 , ZEND_ACC_PUBLIC );
617
- zend_hash_add_ptr (& classes , ce -> name , & mysqli_warning_properties );
583
+ zend_hash_add_ptr (& classes , mysqli_warning_class_entry -> name , & mysqli_warning_properties );
618
584
619
- REGISTER_MYSQLI_CLASS_ENTRY ("mysqli_result" , mysqli_result_class_entry , class_mysqli_result_methods );
620
- ce = mysqli_result_class_entry ;
585
+ mysqli_result_class_entry = register_class_mysqli_result (zend_ce_aggregate );
586
+ mysqli_result_class_entry -> create_object = mysqli_objects_new ;
587
+ mysqli_result_class_entry -> get_iterator = php_mysqli_result_get_iterator ;
621
588
zend_hash_init (& mysqli_result_properties , 0 , NULL , free_prop_handler , 1 );
622
589
MYSQLI_ADD_PROPERTIES (& mysqli_result_properties , mysqli_result_property_entries );
623
- zend_declare_property_null (ce , "current_field" , sizeof ("current_field" ) - 1 ,ZEND_ACC_PUBLIC );
624
- zend_declare_property_null (ce , "field_count" , sizeof ("field_count" ) - 1 , ZEND_ACC_PUBLIC );
625
- zend_declare_property_null (ce , "lengths" , sizeof ("lengths" ) - 1 , ZEND_ACC_PUBLIC );
626
- zend_declare_property_null (ce , "num_rows" , sizeof ("num_rows" ) - 1 , ZEND_ACC_PUBLIC );
627
- zend_declare_property_null (ce , "type" , sizeof ("type" ) - 1 , ZEND_ACC_PUBLIC );
628
- mysqli_result_class_entry -> get_iterator = php_mysqli_result_get_iterator ;
629
- zend_class_implements (mysqli_result_class_entry , 1 , zend_ce_aggregate );
630
- zend_hash_add_ptr (& classes , ce -> name , & mysqli_result_properties );
590
+ zend_hash_add_ptr (& classes , mysqli_result_class_entry -> name , & mysqli_result_properties );
631
591
632
- REGISTER_MYSQLI_CLASS_ENTRY ( "mysqli_stmt" , mysqli_stmt_class_entry , class_mysqli_stmt_methods );
633
- ce = mysqli_stmt_class_entry ;
592
+ mysqli_stmt_class_entry = register_class_mysqli_stmt ( );
593
+ mysqli_stmt_class_entry -> create_object = mysqli_objects_new ;
634
594
zend_hash_init (& mysqli_stmt_properties , 0 , NULL , free_prop_handler , 1 );
635
595
MYSQLI_ADD_PROPERTIES (& mysqli_stmt_properties , mysqli_stmt_property_entries );
636
- zend_declare_property_null (ce , "affected_rows" , sizeof ("affected_rows" ) - 1 , ZEND_ACC_PUBLIC );
637
- zend_declare_property_null (ce , "insert_id" , sizeof ("insert_id" ) - 1 , ZEND_ACC_PUBLIC );
638
- zend_declare_property_null (ce , "num_rows" , sizeof ("num_rows" ) - 1 , ZEND_ACC_PUBLIC );
639
- zend_declare_property_null (ce , "param_count" , sizeof ("param_count" ) - 1 , ZEND_ACC_PUBLIC );
640
- zend_declare_property_null (ce , "field_count" , sizeof ("field_count" ) - 1 , ZEND_ACC_PUBLIC );
641
- zend_declare_property_null (ce , "errno" , sizeof ("errno" ) - 1 , ZEND_ACC_PUBLIC );
642
- zend_declare_property_null (ce , "error" , sizeof ("error" ) - 1 , ZEND_ACC_PUBLIC );
643
- zend_declare_property_null (ce , "error_list" , sizeof ("error_list" ) - 1 , ZEND_ACC_PUBLIC );
644
- zend_declare_property_null (ce , "sqlstate" , sizeof ("sqlstate" ) - 1 , ZEND_ACC_PUBLIC );
645
- zend_declare_property_null (ce , "id" , sizeof ("id" ) - 1 , ZEND_ACC_PUBLIC );
646
- zend_hash_add_ptr (& classes , ce -> name , & mysqli_stmt_properties );
596
+ zend_hash_add_ptr (& classes , mysqli_stmt_class_entry -> name , & mysqli_stmt_properties );
647
597
648
598
/* mysqli_options */
649
599
REGISTER_LONG_CONSTANT ("MYSQLI_READ_DEFAULT_GROUP" , MYSQL_READ_DEFAULT_GROUP , CONST_CS | CONST_PERSISTENT );
0 commit comments