├── .gitignore
├── CREDITS
├── LICENSE
├── Makefile.frag
├── Makefile.frag.w32
├── README
├── config.m4
├── config.w32
├── docbook
├── book.xml
├── constants.xml
├── examples.xml
├── functions
│ ├── mysql-xdevapi.expression.xml
│ └── mysql-xdevapi.getsession.xml
├── index.sqlite
├── ini.xml
├── mysql-xdevapi.baseresult.xml
├── mysql-xdevapi.client.xml
├── mysql-xdevapi.collection.xml
├── mysql-xdevapi.collectionadd.xml
├── mysql-xdevapi.collectionfind.xml
├── mysql-xdevapi.collectionmodify.xml
├── mysql-xdevapi.collectionremove.xml
├── mysql-xdevapi.columnresult.xml
├── mysql-xdevapi.crudoperationbindable.xml
├── mysql-xdevapi.crudoperationlimitable.xml
├── mysql-xdevapi.crudoperationskippable.xml
├── mysql-xdevapi.crudoperationsortable.xml
├── mysql-xdevapi.databaseobject.xml
├── mysql-xdevapi.docresult.xml
├── mysql-xdevapi.driver.xml
├── mysql-xdevapi.exception.xml
├── mysql-xdevapi.executable.xml
├── mysql-xdevapi.executionstatus.xml
├── mysql-xdevapi.expression.xml
├── mysql-xdevapi.fieldmetadata.xml
├── mysql-xdevapi.result.xml
├── mysql-xdevapi.rowresult.xml
├── mysql-xdevapi.schema.xml
├── mysql-xdevapi.schemaobject.xml
├── mysql-xdevapi.session.xml
├── mysql-xdevapi.sqlstatement.xml
├── mysql-xdevapi.sqlstatementresult.xml
├── mysql-xdevapi.statement.xml
├── mysql-xdevapi.table.xml
├── mysql-xdevapi.tabledelete.xml
├── mysql-xdevapi.tableinsert.xml
├── mysql-xdevapi.tableselect.xml
├── mysql-xdevapi.tableupdate.xml
├── mysql-xdevapi.warning.xml
├── mysql_xdevapi
│ ├── baseresult
│ │ ├── getwarningcount.xml
│ │ ├── getwarnings.xml
│ │ └── getwarningscount.xml
│ ├── client
│ │ ├── close.xml
│ │ ├── construct.xml
│ │ └── getsession.xml
│ ├── collection
│ │ ├── add.xml
│ │ ├── addorreplaceone.xml
│ │ ├── construct.xml
│ │ ├── count.xml
│ │ ├── createindex.xml
│ │ ├── dropindex.xml
│ │ ├── existsindatabase.xml
│ │ ├── find.xml
│ │ ├── getname.xml
│ │ ├── getone.xml
│ │ ├── getschema.xml
│ │ ├── getsession.xml
│ │ ├── modify.xml
│ │ ├── remove.xml
│ │ ├── removeone.xml
│ │ └── replaceone.xml
│ ├── collectionadd
│ │ ├── construct.xml
│ │ └── execute.xml
│ ├── collectionfind
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── fields.xml
│ │ ├── groupby.xml
│ │ ├── having.xml
│ │ ├── limit.xml
│ │ ├── lockexclusive.xml
│ │ ├── lockshared.xml
│ │ ├── offset.xml
│ │ ├── skip.xml
│ │ └── sort.xml
│ ├── collectionmodify
│ │ ├── arrayappend.xml
│ │ ├── arraydelete.xml
│ │ ├── arrayinsert.xml
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── limit.xml
│ │ ├── merge.xml
│ │ ├── patch.xml
│ │ ├── replace.xml
│ │ ├── set.xml
│ │ ├── skip.xml
│ │ ├── sort.xml
│ │ └── unset.xml
│ ├── collectionremove
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── limit.xml
│ │ └── sort.xml
│ ├── columnresult
│ │ ├── construct.xml
│ │ ├── getcharactersetname.xml
│ │ ├── getcollationname.xml
│ │ ├── getcolumnlabel.xml
│ │ ├── getcolumnname.xml
│ │ ├── getfractionaldigits.xml
│ │ ├── getlength.xml
│ │ ├── getschemaname.xml
│ │ ├── gettablelabel.xml
│ │ ├── gettablename.xml
│ │ ├── gettype.xml
│ │ ├── isnumbersigned.xml
│ │ └── ispadded.xml
│ ├── crudoperationbindable
│ │ └── bind.xml
│ ├── crudoperationlimitable
│ │ └── limit.xml
│ ├── crudoperationskippable
│ │ └── skip.xml
│ ├── crudoperationsortable
│ │ └── sort.xml
│ ├── databaseobject
│ │ ├── existsindatabase.xml
│ │ ├── getname.xml
│ │ └── getsession.xml
│ ├── docresult
│ │ ├── construct.xml
│ │ ├── fetchall.xml
│ │ ├── fetchone.xml
│ │ ├── getwarningcount.xml
│ │ ├── getwarnings.xml
│ │ └── getwarningscount.xml
│ ├── executable
│ │ └── execute.xml
│ ├── executionstatus
│ │ └── construct.xml
│ ├── expression
│ │ └── construct.xml
│ ├── result
│ │ ├── construct.xml
│ │ ├── getaffecteditemscount.xml
│ │ ├── getautoincrementvalue.xml
│ │ ├── getgeneratedids.xml
│ │ ├── getwarningcount.xml
│ │ ├── getwarnings.xml
│ │ └── getwarningscount.xml
│ ├── rowresult
│ │ ├── construct.xml
│ │ ├── fetchall.xml
│ │ ├── fetchone.xml
│ │ ├── getcolumncount.xml
│ │ ├── getcolumnnames.xml
│ │ ├── getcolumns.xml
│ │ ├── getwarningcount.xml
│ │ ├── getwarnings.xml
│ │ └── getwarningscount.xml
│ ├── schema
│ │ ├── construct.xml
│ │ ├── createcollection.xml
│ │ ├── dropcollection.xml
│ │ ├── existsindatabase.xml
│ │ ├── getcollection.xml
│ │ ├── getcollectionastable.xml
│ │ ├── getcollections.xml
│ │ ├── getname.xml
│ │ ├── getsession.xml
│ │ ├── gettable.xml
│ │ └── gettables.xml
│ ├── schemaobject
│ │ └── getschema.xml
│ ├── session
│ │ ├── close.xml
│ │ ├── commit.xml
│ │ ├── construct.xml
│ │ ├── createschema.xml
│ │ ├── dropschema.xml
│ │ ├── generateuuid.xml
│ │ ├── getdefaultschema.xml
│ │ ├── getschema.xml
│ │ ├── getschemas.xml
│ │ ├── getserverversion.xml
│ │ ├── listclients.xml
│ │ ├── quotename.xml
│ │ ├── releasesavepoint.xml
│ │ ├── rollback.xml
│ │ ├── rollbackto.xml
│ │ ├── setsavepoint.xml
│ │ ├── sql.xml
│ │ └── starttransaction.xml
│ ├── sqlstatement
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── getnextresult.xml
│ │ ├── getresult.xml
│ │ └── hasmoreresults.xml
│ ├── sqlstatementresult
│ │ ├── construct.xml
│ │ ├── fetchall.xml
│ │ ├── fetchone.xml
│ │ ├── getaffecteditemscount.xml
│ │ ├── getcolumncount.xml
│ │ ├── getcolumnnames.xml
│ │ ├── getcolumns.xml
│ │ ├── getgeneratedids.xml
│ │ ├── getlastinsertid.xml
│ │ ├── getwarningcount.xml
│ │ ├── getwarnings.xml
│ │ ├── getwarningscount.xml
│ │ ├── hasdata.xml
│ │ └── nextresult.xml
│ ├── statement
│ │ ├── construct.xml
│ │ ├── getnextresult.xml
│ │ ├── getresult.xml
│ │ └── hasmoreresults.xml
│ ├── table
│ │ ├── construct.xml
│ │ ├── count.xml
│ │ ├── delete.xml
│ │ ├── existsindatabase.xml
│ │ ├── getname.xml
│ │ ├── getschema.xml
│ │ ├── getsession.xml
│ │ ├── insert.xml
│ │ ├── isview.xml
│ │ ├── select.xml
│ │ └── update.xml
│ ├── tabledelete
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── limit.xml
│ │ ├── orderby.xml
│ │ └── where.xml
│ ├── tableinsert
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ └── values.xml
│ ├── tableselect
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── groupby.xml
│ │ ├── having.xml
│ │ ├── limit.xml
│ │ ├── lockexclusive.xml
│ │ ├── lockshared.xml
│ │ ├── offset.xml
│ │ ├── orderby.xml
│ │ └── where.xml
│ ├── tableupdate
│ │ ├── bind.xml
│ │ ├── construct.xml
│ │ ├── execute.xml
│ │ ├── limit.xml
│ │ ├── orderby.xml
│ │ ├── set.xml
│ │ └── where.xml
│ └── warning
│ │ └── construct.xml
├── reference.xml
├── setup.xml
└── versions.xml
├── examples.php
├── json_api.h
├── mysqlnd_api.h
├── mysqlx_base_result.cc
├── mysqlx_base_result.h
├── mysqlx_class_properties.cc
├── mysqlx_class_properties.h
├── mysqlx_client.cc
├── mysqlx_client.h
├── mysqlx_collection.cc
├── mysqlx_collection.h
├── mysqlx_collection__add.cc
├── mysqlx_collection__add.h
├── mysqlx_collection__find.cc
├── mysqlx_collection__find.h
├── mysqlx_collection__modify.cc
├── mysqlx_collection__modify.h
├── mysqlx_collection__remove.cc
├── mysqlx_collection__remove.h
├── mysqlx_collection_index.cc
├── mysqlx_collection_index.h
├── mysqlx_column_result.cc
├── mysqlx_column_result.h
├── mysqlx_crud_operation_bindable.cc
├── mysqlx_crud_operation_bindable.h
├── mysqlx_crud_operation_limitable.cc
├── mysqlx_crud_operation_limitable.h
├── mysqlx_crud_operation_skippable.cc
├── mysqlx_crud_operation_skippable.h
├── mysqlx_crud_operation_sortable.cc
├── mysqlx_crud_operation_sortable.h
├── mysqlx_database_object.cc
├── mysqlx_database_object.h
├── mysqlx_doc_result.cc
├── mysqlx_doc_result.h
├── mysqlx_doc_result_iterator.cc
├── mysqlx_doc_result_iterator.h
├── mysqlx_enum_n_def.h
├── mysqlx_exception.cc
├── mysqlx_exception.h
├── mysqlx_executable.cc
├── mysqlx_executable.h
├── mysqlx_execution_status.cc
├── mysqlx_execution_status.h
├── mysqlx_expression.cc
├── mysqlx_expression.h
├── mysqlx_object.cc
├── mysqlx_object.h
├── mysqlx_result.cc
├── mysqlx_result.h
├── mysqlx_result_iterator.cc
├── mysqlx_result_iterator.h
├── mysqlx_row_result.cc
├── mysqlx_row_result.h
├── mysqlx_row_result_iterator.cc
├── mysqlx_row_result_iterator.h
├── mysqlx_schema.cc
├── mysqlx_schema.h
├── mysqlx_schema_object.cc
├── mysqlx_schema_object.h
├── mysqlx_session.cc
├── mysqlx_session.h
├── mysqlx_sql_statement.cc
├── mysqlx_sql_statement.h
├── mysqlx_sql_statement_result.cc
├── mysqlx_sql_statement_result.h
├── mysqlx_sql_statement_result_iterator.cc
├── mysqlx_sql_statement_result_iterator.h
├── mysqlx_table.cc
├── mysqlx_table.h
├── mysqlx_table__delete.cc
├── mysqlx_table__delete.h
├── mysqlx_table__insert.cc
├── mysqlx_table__insert.h
├── mysqlx_table__select.cc
├── mysqlx_table__select.h
├── mysqlx_table__update.cc
├── mysqlx_table__update.h
├── mysqlx_warning.cc
├── mysqlx_warning.h
├── package.xml
├── php_api.h
├── php_mysql_xdevapi.h
├── php_mysqlx.cc
├── php_mysqlx.h
├── php_mysqlx_ex.cc
├── php_mysqlx_ex.h
├── product_data.txt
├── protobuf_api.h
├── tests
├── 000.phpt
├── add_with_empty_arg_is_noop.phpt
├── array_or_object_contains_operator.phpt
├── auth
│ ├── auth_utils.inc
│ ├── incorrect_ssl_query.phpt
│ ├── secure_connection_options.phpt
│ ├── secure_native.phpt
│ ├── secure_sha256_mem.phpt
│ ├── sha256_mem.phpt
│ ├── timeout
│ │ ├── default_timeout.phpt
│ │ ├── disabled_timeout.phpt
│ │ ├── elapsed_timeout.phpt
│ │ ├── incorrect_timeout.phpt
│ │ ├── successful_no_timeout.phpt
│ │ └── timeout_utils.inc
│ ├── tls
│ │ ├── ciphers.phpt
│ │ ├── ciphersuites.phpt
│ │ ├── ciphersuites_tlsv13.phpt
│ │ ├── incorrect_ciphers.phpt
│ │ ├── incorrect_ciphersuites.phpt
│ │ ├── incorrect_ciphersuites_tlsv13.phpt
│ │ ├── incorrect_tls_versions.phpt
│ │ ├── tls_utils.inc
│ │ ├── tls_versions.phpt
│ │ └── tls_versions_tlsv13.phpt
│ ├── unsecure_native.phpt
│ ├── unsecure_sha256_mem.phpt
│ ├── warnings_secure_caching_sha2.phpt
│ ├── warnings_secure_native.phpt
│ ├── warnings_unsecure_caching_sha2.phpt
│ └── warnings_unsecure_native.phpt
├── basic_collection_operations.phpt
├── basic_execute_sql.phpt
├── basic_transactions.phpt
├── client
│ ├── client_disabled.phpt
│ ├── client_utils.inc
│ ├── close_client.phpt
│ ├── close_client_open_session.phpt
│ ├── close_open.phpt
│ ├── common_vs_simple.phpt
│ ├── default_options.phpt
│ ├── default_options_as_null.phpt
│ ├── default_options_with_enabled.phpt
│ ├── default_options_with_max_idle_time.phpt
│ ├── default_options_with_max_size.phpt
│ ├── default_options_with_queue_timeout.phpt
│ ├── incorrect_options.phpt
│ ├── incorrect_options_case_sensitive.phpt
│ ├── incorrect_uri.phpt
│ ├── new_session_reset.phpt
│ ├── session_multiple_close.phpt
│ ├── simple.phpt
│ ├── simple_close.phpt
│ ├── simple_close_client.phpt
│ ├── simple_prune_expired.phpt
│ ├── simple_vs_common.phpt
│ ├── waiting_timeout.phpt
│ └── waiting_timeout_close_open.phpt
├── client_side_failover.phpt
├── coll_multiple_affected_items_count.phpt
├── collection.phpt
├── collection_fields.phpt
├── collection_find.phpt
├── collection_find_no_only_full_group_by.phpt
├── collection_group_by.phpt
├── collection_limit_offset.phpt
├── collection_modify_array_delete.phpt
├── collection_modify_set_replace.phpt
├── collection_modify_sortreplacemerge.phpt
├── collection_modifysetunset.phpt
├── collection_remove.phpt
├── complex_query.phpt
├── compression
│ ├── algorithm_alias.phpt
│ ├── algorithm_empty.phpt
│ ├── algorithm_incorrect.phpt
│ ├── algorithm_name.phpt
│ ├── algorithm_name_alias.phpt
│ ├── algorithm_unknown.phpt
│ ├── compression_utils.inc
│ └── mode.phpt
├── connect.inc
├── connection_test_uri_string.phpt
├── createdrop_schema.phpt
├── crud_json
│ ├── crud_json_utils.inc
│ ├── modify_array_append.phpt
│ ├── modify_array_insert.phpt
│ ├── modify_patch.phpt
│ ├── modify_replace.phpt
│ ├── modify_set.phpt
│ └── modify_unset.phpt
├── date_time_types.phpt
├── drop_item.phpt
├── exists_in_database.phpt
├── field_metadata.phpt
├── field_metadata_empty_rowset.phpt
├── flexible_number_of_arguments.phpt
├── generated_doc_ids.phpt
├── get_auto_increment_value.phpt
├── get_collection_as_table.phpt
├── get_name.phpt
├── get_tableget_tables.phpt
├── index
│ ├── array_dates.phpt
│ ├── array_integers.phpt
│ ├── array_strings.phpt
│ ├── common.phpt
│ ├── create.phpt
│ ├── drop.phpt
│ ├── extra.phpt
│ ├── fail.phpt
│ ├── index_utils.inc
│ └── multi.phpt
├── iterators.phpt
├── mergepatch.phpt
├── modify_array_append_insert.phpt
├── multiple_results.phpt
├── orabugs
│ ├── orabug_30093227.phpt
│ └── orabug_30226250.phpt
├── prepared_statement
│ ├── ps_collection_find.phpt
│ ├── ps_collection_modify.phpt
│ ├── ps_collection_remove.phpt
│ ├── ps_table_delete.phpt
│ ├── ps_table_select.phpt
│ ├── ps_table_update.phpt
│ └── ps_utils.inc
├── query
│ ├── collection_overlaps_int.phpt
│ ├── collection_overlaps_int_list.phpt
│ ├── collection_overlaps_string.phpt
│ ├── collection_overlaps_string_list.phpt
│ ├── query_utils.inc
│ ├── table_overlaps_int.phpt
│ ├── table_overlaps_json_int_list.phpt
│ └── table_overlaps_json_string_list.phpt
├── row_locking
│ ├── collection_misc.phpt
│ ├── collection_parallel_exclusive_exclusive.phpt
│ ├── collection_parallel_exclusive_exclusive_worker.php
│ ├── collection_parallel_exclusive_shared.phpt
│ ├── collection_parallel_exclusive_shared_worker.php
│ ├── collection_parallel_shared_exclusive.phpt
│ ├── collection_parallel_shared_exclusive_worker.php
│ ├── collection_sequential.phpt
│ ├── row_locking_utils.inc
│ ├── table_misc.phpt
│ ├── table_parallel_exclusive_exclusive.phpt
│ ├── table_parallel_exclusive_exclusive_worker.php
│ ├── table_parallel_exclusive_shared.phpt
│ ├── table_parallel_exclusive_shared_worker.php
│ ├── table_parallel_shared_exclusive.phpt
│ ├── table_parallel_shared_exclusive_worker.php
│ ├── table_sequential.phpt
│ ├── table_sequential_native_sql.phpt
│ ├── waiting_options_collection
│ │ ├── coll_default_exclusive_exclusive.phpt
│ │ ├── coll_default_exclusive_exclusive_worker.php
│ │ ├── coll_default_exclusive_none.phpt
│ │ ├── coll_default_exclusive_none_worker.php
│ │ ├── coll_default_exclusive_shared.phpt
│ │ ├── coll_default_exclusive_shared_worker.php
│ │ ├── coll_default_shared_exclusive.phpt
│ │ ├── coll_default_shared_exclusive_worker.php
│ │ ├── coll_default_shared_none.phpt
│ │ ├── coll_default_shared_none_worker.php
│ │ ├── coll_default_shared_shared.phpt
│ │ ├── coll_default_shared_shared_worker.php
│ │ ├── coll_nowait_exclusive_exclusive.phpt
│ │ ├── coll_nowait_exclusive_exclusive_worker.php
│ │ ├── coll_nowait_exclusive_shared.phpt
│ │ ├── coll_nowait_exclusive_shared_worker.php
│ │ ├── coll_nowait_shared_exclusive.phpt
│ │ ├── coll_nowait_shared_exclusive_worker.php
│ │ ├── coll_nowait_shared_shared.phpt
│ │ ├── coll_nowait_shared_shared_worker.php
│ │ ├── coll_skip_locked_exclusive_exclusive.phpt
│ │ ├── coll_skip_locked_exclusive_exclusive_worker.php
│ │ ├── coll_skip_locked_exclusive_shared.phpt
│ │ ├── coll_skip_locked_exclusive_shared_worker.php
│ │ ├── coll_skip_locked_shared_exclusive.phpt
│ │ ├── coll_skip_locked_shared_exclusive_worker.php
│ │ ├── coll_skip_locked_shared_shared.phpt
│ │ ├── coll_skip_locked_shared_shared_worker.php
│ │ ├── coll_without_exclusive_exclusive.phpt
│ │ ├── coll_without_exclusive_exclusive_worker.php
│ │ ├── coll_without_exclusive_none.phpt
│ │ ├── coll_without_exclusive_none_worker.php
│ │ ├── coll_without_exclusive_shared.phpt
│ │ ├── coll_without_exclusive_shared_worker.php
│ │ ├── coll_without_shared_exclusive.phpt
│ │ ├── coll_without_shared_exclusive_worker.php
│ │ ├── coll_without_shared_none.phpt
│ │ ├── coll_without_shared_none_worker.php
│ │ ├── coll_without_shared_shared.phpt
│ │ └── coll_without_shared_shared_worker.php
│ └── waiting_options_table
│ │ ├── tab_default_exclusive_exclusive.phpt
│ │ ├── tab_default_exclusive_exclusive_worker.php
│ │ ├── tab_default_exclusive_none.phpt
│ │ ├── tab_default_exclusive_none_worker.php
│ │ ├── tab_default_exclusive_shared.phpt
│ │ ├── tab_default_exclusive_shared_worker.php
│ │ ├── tab_default_shared_exclusive.phpt
│ │ ├── tab_default_shared_exclusive_worker.php
│ │ ├── tab_default_shared_none.phpt
│ │ ├── tab_default_shared_none_worker.php
│ │ ├── tab_default_shared_shared.phpt
│ │ ├── tab_default_shared_shared_worker.php
│ │ ├── tab_nowait_exclusive_exclusive.phpt
│ │ ├── tab_nowait_exclusive_exclusive_worker.php
│ │ ├── tab_nowait_exclusive_shared.phpt
│ │ ├── tab_nowait_exclusive_shared_worker.php
│ │ ├── tab_nowait_shared_exclusive.phpt
│ │ ├── tab_nowait_shared_exclusive_worker.php
│ │ ├── tab_nowait_shared_shared.phpt
│ │ ├── tab_nowait_shared_shared_worker.php
│ │ ├── tab_skip_locked_exclusive_exclusive.phpt
│ │ ├── tab_skip_locked_exclusive_exclusive_worker.php
│ │ ├── tab_skip_locked_exclusive_shared.phpt
│ │ ├── tab_skip_locked_exclusive_shared_worker.php
│ │ ├── tab_skip_locked_shared_exclusive.phpt
│ │ ├── tab_skip_locked_shared_exclusive_worker.php
│ │ ├── tab_skip_locked_shared_shared.phpt
│ │ ├── tab_skip_locked_shared_shared_worker.php
│ │ ├── tab_without_exclusive_exclusive.phpt
│ │ ├── tab_without_exclusive_exclusive_worker.php
│ │ ├── tab_without_exclusive_none.phpt
│ │ ├── tab_without_exclusive_none_worker.php
│ │ ├── tab_without_exclusive_shared.phpt
│ │ ├── tab_without_exclusive_shared_worker.php
│ │ ├── tab_without_shared_exclusive.phpt
│ │ ├── tab_without_shared_exclusive_worker.php
│ │ ├── tab_without_shared_none.phpt
│ │ ├── tab_without_shared_none_worker.php
│ │ ├── tab_without_shared_shared.phpt
│ │ └── tab_without_shared_shared_worker.php
├── savepoint.phpt
├── schema.phpt
├── schema
│ ├── common_default_schema.phpt
│ ├── empty_default_schema.phpt
│ ├── get_default_schema.phpt
│ ├── get_empty_default_schema.phpt
│ ├── incorrect_default_schema.phpt
│ └── schema_utils.inc
├── schema_validation
│ ├── create_common.phpt
│ ├── create_no_schema.phpt
│ ├── create_simple.phpt
│ ├── modify_off.phpt
│ ├── modify_schema.phpt
│ ├── modify_strict.phpt
│ └── parse_error.phpt
├── select_fetch.phpt
├── session
│ ├── from_collection.phpt
│ ├── from_schema.phpt
│ ├── from_table.phpt
│ ├── multiple_close.phpt
│ ├── session_utils.inc
│ ├── simple_session_open.phpt
│ ├── simple_session_open_close.phpt
│ └── simple_session_open_verify_close.phpt
├── session_attributes.phpt
├── session_minor_tc.phpt
├── simple_expression.phpt
├── simple_ssl.phpt
├── single_doc_ops
│ ├── add_or_replace_one.phpt
│ ├── get_one.phpt
│ ├── remove_one.phpt
│ ├── replace_one.phpt
│ └── single_doc_utils.inc
├── sql_simple.phpt
├── ssl
│ ├── ca.pem
│ ├── client-cert.pem
│ ├── client-key.pem
│ ├── client-req.pem
│ ├── server-cert.pem
│ ├── server-key.pem
│ └── server-req.pem
├── table.phpt
├── table_delete_limit_order_by.phpt
├── table_delete_where.phpt
├── table_group_by.phpt
├── table_limit_offset.phpt
├── unix_domain_socket.phpt
├── update.phpt
├── warnings.phpt
└── worker_utils.inc
├── util
├── allocator.cc
├── allocator.h
├── arguments.cc
├── arguments.h
├── arguments.inl
├── compiler_utils.h
├── exceptions.cc
├── exceptions.h
├── functions.cc
├── functions.h
├── json_utils.cc
├── json_utils.h
├── object.cc
├── object.h
├── pb_utils.cc
├── pb_utils.h
├── string_utils.cc
├── string_utils.h
├── strings.cc
├── strings.h
├── types.h
├── url_utils.cc
├── url_utils.h
├── value.cc
├── value.h
├── value.inl
├── zend_utils.cc
└── zend_utils.h
└── xmysqlnd
├── cdkbase
├── core
│ └── codec.cc
├── extra
│ └── rapidjson
│ │ └── include
│ │ └── rapidjson
│ │ ├── allocators.h
│ │ ├── document.h
│ │ ├── encodedstream.h
│ │ ├── encodings.h
│ │ ├── error
│ │ ├── en.h
│ │ └── error.h
│ │ ├── filereadstream.h
│ │ ├── filewritestream.h
│ │ ├── fwd.h
│ │ ├── internal
│ │ ├── biginteger.h
│ │ ├── diyfp.h
│ │ ├── dtoa.h
│ │ ├── ieee754.h
│ │ ├── itoa.h
│ │ ├── meta.h
│ │ ├── pow10.h
│ │ ├── regex.h
│ │ ├── stack.h
│ │ ├── strfunc.h
│ │ ├── strtod.h
│ │ └── swap.h
│ │ ├── istreamwrapper.h
│ │ ├── memorybuffer.h
│ │ ├── memorystream.h
│ │ ├── msinttypes
│ │ ├── inttypes.h
│ │ └── stdint.h
│ │ ├── ostreamwrapper.h
│ │ ├── pointer.h
│ │ ├── prettywriter.h
│ │ ├── rapidjson.h
│ │ ├── reader.h
│ │ ├── schema.h
│ │ ├── stream.h
│ │ ├── stringbuffer.h
│ │ └── writer.h
├── foundation
│ ├── error.cc
│ └── stream.cc
├── include
│ └── mysql
│ │ ├── cdk.h
│ │ └── cdk
│ │ ├── api
│ │ ├── cursor.h
│ │ ├── document.h
│ │ ├── expression.h
│ │ ├── mdata.h
│ │ ├── obj_ref.h
│ │ ├── processors.h
│ │ ├── query.h
│ │ ├── reply.h
│ │ ├── session.h
│ │ └── transaction.h
│ │ ├── charsets.h
│ │ ├── codec.h
│ │ ├── common.h
│ │ ├── config.h
│ │ ├── converters.h
│ │ ├── cursor.h
│ │ ├── data_source.h
│ │ ├── foundation.h
│ │ ├── foundation
│ │ ├── async.h
│ │ ├── cdk_time.h
│ │ ├── codec.h
│ │ ├── common.h
│ │ ├── connection_openssl.h
│ │ ├── connection_tcpip.h
│ │ ├── diagnostics.h
│ │ ├── error.h
│ │ ├── error_category.h
│ │ ├── opaque_impl.h
│ │ ├── opaque_impl.i
│ │ ├── socket.h
│ │ ├── static_assert.h
│ │ ├── std_error_conditions.h
│ │ ├── stream.h
│ │ ├── string.h
│ │ ├── types.h
│ │ └── variant.h
│ │ ├── mysqlx.h
│ │ ├── mysqlx
│ │ ├── common.h
│ │ ├── result.h
│ │ └── session.h
│ │ ├── protocol
│ │ ├── mysqlx.h
│ │ └── mysqlx
│ │ │ ├── collations.h
│ │ │ ├── expr.h
│ │ │ └── traits.h
│ │ ├── reply.h
│ │ └── session.h
├── mysqlx
│ ├── converters.h
│ └── delayed_op.h
├── parser
│ ├── char_iterator.h
│ ├── expr_parser.cc
│ ├── expr_parser.h
│ ├── json_parser.cc
│ ├── json_parser.h
│ ├── parser.h
│ ├── tokenizer.cc
│ └── tokenizer.h
└── protocol
│ └── mysqlx
│ └── builders.h
├── crud_parsers
├── compilerutils.h
├── expression_parser.cc
├── expression_parser.h
├── legacy_tokenizer.cc
├── legacy_tokenizer.h
├── memory_new.h
├── mysqlx_crud_parser.cc
└── mysqlx_crud_parser.h
├── proto_def
├── mysqlx.proto
├── mysqlx_connection.proto
├── mysqlx_crud.proto
├── mysqlx_cursor.proto
├── mysqlx_datatypes.proto
├── mysqlx_expect.proto
├── mysqlx_expr.proto
├── mysqlx_notice.proto
├── mysqlx_prepare.proto
├── mysqlx_resultset.proto
├── mysqlx_session.proto
└── mysqlx_sql.proto
├── proto_gen
└── .keep
├── xmysqlnd.h
├── xmysqlnd_any2expr.cc
├── xmysqlnd_any2expr.h
├── xmysqlnd_collection.cc
├── xmysqlnd_collection.h
├── xmysqlnd_compression.cc
├── xmysqlnd_compression.h
├── xmysqlnd_compression_setup.cc
├── xmysqlnd_compression_setup.h
├── xmysqlnd_compression_types.cc
├── xmysqlnd_compression_types.h
├── xmysqlnd_compressor.cc
├── xmysqlnd_compressor.h
├── xmysqlnd_compressor_lz4.cc
├── xmysqlnd_compressor_lz4.h
├── xmysqlnd_compressor_zlib.cc
├── xmysqlnd_compressor_zlib.h
├── xmysqlnd_compressor_zstd.cc
├── xmysqlnd_compressor_zstd.h
├── xmysqlnd_crud_collection_commands.cc
├── xmysqlnd_crud_collection_commands.h
├── xmysqlnd_crud_commands.h
├── xmysqlnd_crud_table_commands.cc
├── xmysqlnd_crud_table_commands.h
├── xmysqlnd_driver.cc
├── xmysqlnd_driver.h
├── xmysqlnd_enum_n_def.h
├── xmysqlnd_environment.cc
├── xmysqlnd_environment.h
├── xmysqlnd_extension_plugin.cc
├── xmysqlnd_extension_plugin.h
├── xmysqlnd_index_collection_commands.cc
├── xmysqlnd_index_collection_commands.h
├── xmysqlnd_object_factory.cc
├── xmysqlnd_object_factory.h
├── xmysqlnd_priv.h
├── xmysqlnd_protocol_dumper.cc
├── xmysqlnd_protocol_dumper.h
├── xmysqlnd_protocol_frame_codec.cc
├── xmysqlnd_protocol_frame_codec.h
├── xmysqlnd_rowset.cc
├── xmysqlnd_rowset.h
├── xmysqlnd_rowset_buffered.cc
├── xmysqlnd_rowset_buffered.h
├── xmysqlnd_rowset_fwd.cc
├── xmysqlnd_rowset_fwd.h
├── xmysqlnd_schema.cc
├── xmysqlnd_schema.h
├── xmysqlnd_session.cc
├── xmysqlnd_session.h
├── xmysqlnd_statistics.cc
├── xmysqlnd_stmt.cc
├── xmysqlnd_stmt.h
├── xmysqlnd_stmt_execution_state.cc
├── xmysqlnd_stmt_execution_state.h
├── xmysqlnd_stmt_result.cc
├── xmysqlnd_stmt_result.h
├── xmysqlnd_stmt_result_meta.cc
├── xmysqlnd_stmt_result_meta.h
├── xmysqlnd_structs.h
├── xmysqlnd_table.cc
├── xmysqlnd_table.h
├── xmysqlnd_utils.cc
├── xmysqlnd_utils.h
├── xmysqlnd_warning_list.cc
├── xmysqlnd_warning_list.h
├── xmysqlnd_wireprotocol.cc
├── xmysqlnd_wireprotocol.h
├── xmysqlnd_wireprotocol_types.cc
├── xmysqlnd_wireprotocol_types.h
├── xmysqlnd_zval2any.cc
└── xmysqlnd_zval2any.h
/CREDITS:
--------------------------------------------------------------------------------
1 | mysql_xdevapi
2 | Andrey Hristov, Ulf Wendel, Johannes Schlüter, Dariusz Slusarczyk, Filip Janiszewski
3 |
--------------------------------------------------------------------------------
/docbook/index.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/php/pecl-database-mysql_xdevapi/41f52fbca6acce68780b66efca4a75815b548661/docbook/index.sqlite
--------------------------------------------------------------------------------
/docbook/mysql_xdevapi/client/close.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | mysql_xdevapi\Client::close
7 | Close client
8 |
9 |
10 |
11 | &reftitle.description;
12 |
13 | public boolmysql_xdevapi\Client::close
14 |
15 |
16 |
17 | Close all client connections with the server.
18 |
19 |
20 |
21 |
22 | &reftitle.parameters;
23 | &no.function.parameters;
24 |
25 |
26 |
27 | &reftitle.returnvalues;
28 |
29 | &true; if connections are closed.
30 |
31 |
32 |
33 |
34 |
35 |
55 |
--------------------------------------------------------------------------------
/docbook/mysql_xdevapi/client/getsession.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Client::getClient
7 | Get client session
8 |
9 |
10 |
11 | &reftitle.description;
12 |
13 | public mysql_xdevapi\Sessionmysql_xdevapi\Client::getSession
14 |
15 |
16 |
17 | Get session associated with the client.
18 |
19 |
20 |
21 |
22 | &reftitle.parameters;
23 | &no.function.parameters;
24 |
25 |
26 |
27 | &reftitle.returnvalues;
28 |
29 | A Session object.
30 |
31 |
32 |
33 |
34 |
35 |
55 |
--------------------------------------------------------------------------------
/docbook/reference.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Mysql_xdevapi &Functions;
6 |
7 | &reference.mysql-xdevapi.entities.functions;
8 |
9 |
10 |
11 |
31 |
--------------------------------------------------------------------------------
/json_api.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Darek Slusarczyk |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef MYSQL_XDEVAPI_JSON_API_H
19 | #define MYSQL_XDEVAPI_JSON_API_H
20 |
21 | extern "C" {
22 | #include
23 | #include
24 | #include
25 | }
26 |
27 | #endif // MYSQL_XDEVAPI_JSON_API_H
28 |
--------------------------------------------------------------------------------
/mysqlx_doc_result_iterator.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef MYSQLX_DOC_RESULT_ITERATOR_H
19 | #define MYSQLX_DOC_RESULT_ITERATOR_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace devapi {
24 |
25 | void mysqlx_register_doc_result_iterator(zend_class_entry * ce);
26 |
27 | } // namespace devapi
28 |
29 | } // namespace mysqlx
30 |
31 | #endif /* MYSQLX_DOC_RESULT_ITERATOR_H */
32 |
--------------------------------------------------------------------------------
/mysqlx_result_iterator.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef MYSQLX_RESULT_ITERATOR_H
19 | #define MYSQLX_RESULT_ITERATOR_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace devapi {
24 |
25 | void mysqlx_register_result_iterator(zend_class_entry * ce);
26 |
27 | } // namespace devapi
28 |
29 | } // namespace mysqlx
30 |
31 | #endif /* MYSQLX_RESULT_ITERATOR_H */
32 |
--------------------------------------------------------------------------------
/mysqlx_row_result_iterator.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef MYSQLX_ROW_RESULT_ITERATOR_H
19 | #define MYSQLX_ROW_RESULT_ITERATOR_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace devapi {
24 |
25 | void mysqlx_register_row_result_iterator(zend_class_entry * ce);
26 |
27 | } // namespace devapi
28 |
29 | } // namespace mysqlx
30 |
31 | #endif /* MYSQLX_ROW_RESULT_ITERATOR_H */
32 |
--------------------------------------------------------------------------------
/mysqlx_sql_statement_result_iterator.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef MYSQLX_SQL_STATEMENT_RESULT_ITERATOR_H
19 | #define MYSQLX_SQL_STATEMENT_RESULT_ITERATOR_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace devapi {
24 |
25 | void mysqlx_register_sql_statement_result_iterator(zend_class_entry * ce);
26 |
27 | } // namespace devapi
28 |
29 | } // namespace mysqlx
30 |
31 | #endif /* MYSQLX_SQL_STATEMENT_RESULT_ITERATOR_H */
32 |
--------------------------------------------------------------------------------
/php_mysqlx_ex.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef PHP_MYSQLX_EX_H
19 | #define PHP_MYSQLX_EX_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace devapi {
24 |
25 | PHP_MYSQL_XDEVAPI_API int mysqlx_minit_classes(INIT_FUNC_ARGS);
26 | PHP_MYSQL_XDEVAPI_API int mysqlx_mshutdown_classes(SHUTDOWN_FUNC_ARGS);
27 |
28 | } // namespace devapi
29 |
30 | } // namespace mysqlx
31 |
32 | #endif /* PHP_MYSQLX_EX_H */
33 |
--------------------------------------------------------------------------------
/product_data.txt:
--------------------------------------------------------------------------------
1 | 01230 SuperDent The best toothpaste ever 1.36 5
2 | 51A51 PlasticFace Your favorite plastic surgeon 1499.99 3
3 | FFFFF UltraCop At your service! 59.99 99
4 | ABCDE MetalFork You really want this fork for dinner! 1.99 2000
5 | 54321 Big Hat One of the best big hat! 99.99 578
6 | 12345 Lottery Ticket You're not going to win! 0.99 465
7 | 55555 Programmer1 Will develop all for you! 199.99 56
8 | 56411 Programmer2 The best of the best! 299.99 2
9 | 77789 Programmer3 The cheapest one! 99.99 65536
10 | 14452 Fresh Air Made with the best nitrogen! 0.49 991
11 | 95511 Fresh Air2 Double portion of oxygen here! 2.99 55563
12 | ABABA PHP Expert Available in two colors! 2499.99 6
13 |
--------------------------------------------------------------------------------
/protobuf_api.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Darek Slusarczyk |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef MYSQL_XDEVAPI_PROTOBUF_API_H
19 | #define MYSQL_XDEVAPI_PROTOBUF_API_H
20 |
21 | MYSQLX_SUPPRESS_ALL_WARNINGS()
22 | #include
23 | #include
24 | #include
25 | #include
26 | MYSQLX_RESTORE_WARNINGS()
27 |
28 | #endif // MYSQL_XDEVAPI_PROTOBUF_API_H
29 |
--------------------------------------------------------------------------------
/tests/000.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx test initializer
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 |
11 | --CLEAN--
12 |
16 | --EXPECTF--
17 | done!%A
18 |
--------------------------------------------------------------------------------
/tests/auth/timeout/default_timeout.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx default connection timeout
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 |
15 | --CLEAN--
16 |
20 | --EXPECTF--
21 | done!%A
22 |
--------------------------------------------------------------------------------
/tests/auth/timeout/disabled_timeout.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx disabled connection timeout
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
16 | --CLEAN--
17 |
21 | --EXPECTF--
22 | done!%A
23 |
--------------------------------------------------------------------------------
/tests/auth/timeout/elapsed_timeout.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx elapsed connection timeout with explicit timeout given
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 |
15 | --CLEAN--
16 |
20 | --EXPECTF--
21 | done!%A
22 |
--------------------------------------------------------------------------------
/tests/auth/timeout/successful_no_timeout.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx successful connection, no timeout
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=1
6 | --FILE--
7 |
22 | --CLEAN--
23 |
27 | --EXPECTF--
28 | mysqlx://%s:%S@%S:%d/?connect-timeout=4
29 | ----------------------
30 | mysqlx://%s:%S@%S:%d
31 | ----------------------
32 | mysqlx://%s:%S@%S:%d/?connect-timeout=0
33 | ----------------------
34 | mysqlx://%s:%S@%S:%d/?connect-timeout=7
35 | ----------------------
36 | mysqlx://%s:%S@%S:%d
37 | ----------------------
38 | mysqlx://%s:%S@%S:%d/?connect-timeout=0
39 | ----------------------
40 | done!%A
41 |
--------------------------------------------------------------------------------
/tests/auth/tls/ciphers.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx TLS ciphers
3 | --SKIPIF--
4 | --FILE--
5 |
30 | --CLEAN--
31 |
35 | --EXPECTF--
36 | done!%A
37 |
--------------------------------------------------------------------------------
/tests/auth/tls/ciphersuites_tlsv13.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx TLS ciphersuites for TLSv1.3
3 | --SKIPIF--
4 |
9 | --FILE--
10 |
28 | --CLEAN--
29 |
33 | --EXPECTF--
34 | done!%A
35 |
--------------------------------------------------------------------------------
/tests/auth/tls/incorrect_ciphersuites_tlsv13.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx incorrect ciphersuites for TLSv1.3
3 | --SKIPIF--
4 |
9 | --FILE--
10 |
28 | --CLEAN--
29 |
33 | --EXPECTF--
34 | [10071][HY000] No valid cipher suite found in the tls ciphersuites list.
35 | [10071][HY000] No valid cipher suite found in the tls ciphersuites list.
36 | [10071][HY000] No valid cipher suite found in the tls ciphersuites list.
37 | done!%A
38 |
--------------------------------------------------------------------------------
/tests/auth/tls/tls_versions.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx TLS versions
3 | --SKIPIF--
4 |
9 | --FILE--
10 |
24 | --CLEAN--
25 |
29 | --EXPECTF--
30 |
31 | Warning: mysql_xdevapi\getSession(): TLSv1 and TLSv1.1 are not supported starting from MySQL 8.0.28 and should not be used.%a
32 | [10065][HY000] Unknown TLS version: No valid TLS version specified, the only valid versions are%a
33 | [10065][HY000] Unknown TLS version: No valid TLS version specified, the only valid versions are%a
34 | done!%A
35 |
--------------------------------------------------------------------------------
/tests/basic_transactions.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx basic transactions
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | getSchema($db);
12 | $coll = $schema->getCollection("test_collection");
13 |
14 | $session->startTransaction();
15 |
16 | try{
17 | fill_db_collection($coll);
18 | $session->commit();
19 | } catch( Exception $e ) {
20 | test_step_failed();
21 | }
22 |
23 | $res = $coll->find()->execute();
24 | expect_eq( count($res->fetchAll()), 16);
25 |
26 | $session->startTransaction();
27 |
28 | try{
29 | $coll->add('{"_id":17, "name": "Massimo", "age": 32, "job": "Cavia"}')->execute();
30 | $coll->add('{"_id":18, "name": "Carlo", "age": 47, "job": "Cavia"}')->execute();
31 | $coll->add('{"_id":17, "name": "Leonardo", "age": 53, "job": "Cavia"}')->execute();
32 | $session->commit();
33 | test_step_failed(); //commit shall raise an exception!
34 | } catch( Exception $e) {
35 | expect_eq($e->getMessage(),
36 | "[HY000] Couldn't fetch data");
37 | expect_eq($e->getCode(), 10000);
38 | $session->rollback();
39 | }
40 |
41 | $res = $coll->find()->execute();
42 | expect_eq( count($res->fetchAll()), 16);
43 |
44 | verify_expectations();
45 | print "done!\n";
46 | ?>
47 | --CLEAN--
48 |
52 | --EXPECTF--
53 | done!%A
54 |
--------------------------------------------------------------------------------
/tests/client/client_disabled.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client with disabled pooling vs validity of retrieved sessions
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
21 | create_test_db($session0);
22 | assert_session_valid($session0);
23 |
24 | $client->close();
25 |
26 | assert_session_valid($session0);
27 |
28 | $session1 = $client->getSession();
29 | assert_session_valid($session1);
30 |
31 | $client->close();
32 |
33 | assert_session_valid($session0);
34 | assert_session_valid($session1);
35 |
36 | $session0->close();
37 | assert_session_invalid($session0);
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | [10056][HY000] Session closed.
49 | done!%A
50 |
--------------------------------------------------------------------------------
/tests/client/client_utils.inc:
--------------------------------------------------------------------------------
1 | getSession();
11 | test_step_failed("connection pool should be full");
12 | } catch (Exception $e) {
13 | echo $e->getMessage(), PHP_EOL;
14 | test_step_ok();
15 | }
16 | }
17 |
18 | // -------
19 |
20 | function assert_client_session_with_options($pooling_options) {
21 | global $connection_uri;
22 | $client = mysql_xdevapi\getClient($connection_uri, $pooling_options);
23 | $session = $client->getSession();
24 | create_test_db($session);
25 | assert_session_valid($session);
26 | }
27 |
28 | function assert_client_fail_with_options($pooling_options) {
29 | global $connection_uri;
30 | try {
31 | $client = mysql_xdevapi\getClient($connection_uri, $pooling_options);
32 | test_step_failed("client shouldn't accept incorrect options");
33 | } catch (Exception $e) {
34 | echo $e->getMessage(), PHP_EOL;
35 | test_step_ok();
36 | }
37 | }
38 |
39 | ?>
40 |
--------------------------------------------------------------------------------
/tests/client/close_client.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx close client, and all its connections
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
19 | create_test_db($session0);
20 | assert_session_valid($session0);
21 |
22 | $session1 = $client->getSession();
23 | assert_session_valid($session1);
24 |
25 | $client->close();
26 |
27 | assert_session_invalid($session0);
28 | assert_session_invalid($session1);
29 |
30 | verify_expectations();
31 | print "done!\n";
32 | ?>
33 | --CLEAN--
34 |
38 | --EXPECTF--
39 | [10056][HY000] Session closed.
40 | [10056][HY000] Session closed.
41 | done!%A
42 |
--------------------------------------------------------------------------------
/tests/client/close_client_open_session.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx close client, then open new session
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
14 | create_test_db($session0);
15 | assert_session_valid($session0);
16 |
17 | $client->close();
18 |
19 | assert_session_invalid($session0);
20 |
21 | $session1 = $client->getSession();
22 | assert_session_valid($session1);
23 |
24 | $client->close();
25 |
26 | assert_session_invalid($session1);
27 |
28 | $session2 = $client->getSession();
29 | assert_session_valid($session2);
30 |
31 | verify_expectations();
32 | print "done!\n";
33 | ?>
34 | --CLEAN--
35 |
39 | --EXPECTF--
40 | [10056][HY000] Session closed.
41 | [10056][HY000] Session closed.
42 | done!%A
43 |
--------------------------------------------------------------------------------
/tests/client/close_open.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client get session from pool, close it, open another one again
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
20 | create_test_db($session0);
21 | assert_session_valid($session0);
22 |
23 | $session0->close();
24 | assert_session_invalid($session0);
25 |
26 | $session1 = $client->getSession();
27 | assert_session_valid($session1);
28 |
29 | verify_expectations();
30 | print "done!\n";
31 | ?>
32 | --CLEAN--
33 |
37 | --EXPECTF--
38 | [10056][HY000] Session closed.
39 | done!%A
40 |
--------------------------------------------------------------------------------
/tests/client/common_vs_simple.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx get one common session, then check session from client
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
23 | assert_session_valid($session);
24 |
25 | verify_expectations();
26 | print "done!\n";
27 | ?>
28 | --CLEAN--
29 |
33 | --EXPECTF--
34 | done!%A
35 |
--------------------------------------------------------------------------------
/tests/client/default_options.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create client with default empty options
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
18 | --CLEAN--
19 |
23 | --EXPECTF--
24 | done!%A
25 |
--------------------------------------------------------------------------------
/tests/client/default_options_as_null.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create client with null options
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
18 | --CLEAN--
19 |
23 | --EXPECTF--
24 | done!%A
25 |
--------------------------------------------------------------------------------
/tests/client/default_options_with_enabled.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create client with default options and explicit 'enabled'
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
20 | --CLEAN--
21 |
25 | --EXPECTF--
26 | done!%A
27 |
--------------------------------------------------------------------------------
/tests/client/default_options_with_max_idle_time.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create client with default options and explicit 'maxIdleTime'
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
20 | --CLEAN--
21 |
25 | --EXPECTF--
26 | done!%A
27 |
--------------------------------------------------------------------------------
/tests/client/default_options_with_max_size.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create client with default options and explicit 'maxSize'
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
20 | --CLEAN--
21 |
25 | --EXPECTF--
26 | done!%A
27 |
--------------------------------------------------------------------------------
/tests/client/default_options_with_queue_timeout.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create client with default options and explicit 'queueTimeOut'
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
20 | --CLEAN--
21 |
25 | --EXPECTF--
26 | done!%A
27 |
--------------------------------------------------------------------------------
/tests/client/incorrect_uri.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client fail due to incorrect uri
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
22 | test_step_failed("shouldn't retrieve session for incorrect uri");
23 | } catch (Exception $e) {
24 | test_step_ok();
25 | }
26 |
27 | verify_expectations();
28 | print "done!\n";
29 | ?>
30 | --CLEAN--
31 |
35 | --EXPECTF--
36 | done!%A
37 |
--------------------------------------------------------------------------------
/tests/client/new_session_reset.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | check new session reset without reauthentication
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | sql("SELECT CONNECTION_ID()");
14 | $res = $query->execute()->fetchAll();
15 | return $res[0]["CONNECTION_ID()"];
16 | }
17 |
18 | $pooling_options = '{
19 | "enabled": true,
20 | "maxSize": 5,
21 | "queueTimeOut": 10000
22 | }';
23 |
24 | $client = mysql_xdevapi\getClient($connection_uri, $pooling_options);
25 | $session0 = $client->getSession();
26 | $session_id0 = get_session_id($session0);
27 | create_test_db($session0);
28 | assert_session_valid($session0);
29 |
30 | $session0->close();
31 | assert_session_invalid($session0);
32 |
33 | $session1 = $client->getSession();
34 | assert_session_valid($session1);
35 | $session_id1 = get_session_id($session1);
36 |
37 | const SERVER_SUPPORTING_NEW_SESSION_RESET = 80016;
38 | $svr_version = $session1->getServerVersion();
39 | if (SERVER_SUPPORTING_NEW_SESSION_RESET <= $svr_version) {
40 | expect_true($session_id0 == $session_id1);
41 | } else {
42 | expect_true($session_id0 != $session_id1);
43 | }
44 |
45 | verify_expectations();
46 | print "done!\n";
47 | ?>
48 | --CLEAN--
49 |
53 | --EXPECTF--
54 | [10056][HY000] Session closed.
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/client/session_multiple_close.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx close session from pool multiple times
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
14 | create_test_db($session0);
15 | assert_session_valid($session0);
16 |
17 | $session0->close();
18 | assert_session_invalid($session0);
19 |
20 | // ----
21 |
22 | $session1 = $client->getSession();
23 | assert_session_valid($session1);
24 |
25 | $session1->close();
26 | assert_session_invalid($session1);
27 |
28 | $session1->close();
29 | assert_session_invalid($session1);
30 |
31 | // ----
32 |
33 | $session2 = $client->getSession();
34 | assert_session_valid($session2);
35 |
36 | $session2->close();
37 | assert_session_invalid($session2);
38 |
39 | $session2->close();
40 | assert_session_invalid($session2);
41 |
42 | $session2->close();
43 | assert_session_invalid($session2);
44 |
45 | verify_expectations();
46 | print "done!\n";
47 | ?>
48 | --CLEAN--
49 |
53 | --EXPECTF--
54 | [10056][HY000] Session closed.
55 | [10056][HY000] Session closed.
56 | [10056][HY000] Session closed.
57 | [10056][HY000] Session closed.
58 | [10056][HY000] Session closed.
59 | [10056][HY000] Session closed.
60 | done!%A
61 |
--------------------------------------------------------------------------------
/tests/client/simple.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client get one session from client
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
21 | create_test_db($session);
22 | assert_session_valid($session);
23 |
24 | verify_expectations();
25 | print "done!\n";
26 | ?>
27 | --CLEAN--
28 |
32 | --EXPECTF--
33 | done!%A
34 |
--------------------------------------------------------------------------------
/tests/client/simple_close.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client open and close session from pool
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
20 | create_test_db($session0);
21 | assert_session_valid($session0);
22 |
23 | $session0->close();
24 | assert_session_invalid($session0);
25 |
26 | verify_expectations();
27 | print "done!\n";
28 | ?>
29 | --CLEAN--
30 |
34 | --EXPECTF--
35 | [10056][HY000] Session closed.
36 | done!%A
37 |
--------------------------------------------------------------------------------
/tests/client/simple_close_client.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create and close client
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | close();
14 |
15 | verify_expectations();
16 | print "done!\n";
17 | ?>
18 | --CLEAN--
19 |
23 | --EXPECTF--
24 | done!%A
25 |
--------------------------------------------------------------------------------
/tests/client/simple_prune_expired.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx trigger prune expired idle connections in pool
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
22 | create_test_db($session0);
23 | assert_session_valid($session0);
24 |
25 | $session1 = $client->getSession();
26 | assert_session_valid($session1);
27 |
28 | $session2 = $client->getSession();
29 | assert_session_valid($session2);
30 |
31 | $session0->close();
32 | assert_session_invalid($session0);
33 |
34 | $session1->close();
35 | assert_session_invalid($session1);
36 |
37 | $session2->close();
38 | assert_session_invalid($session2);
39 |
40 | msleep(2 * $maxIdleTime);
41 |
42 | verify_expectations();
43 | print "done!\n";
44 | ?>
45 | --CLEAN--
46 |
50 | --EXPECTF--
51 | [10056][HY000] Session closed.
52 | [10056][HY000] Session closed.
53 | [10056][HY000] Session closed.
54 | done!%A
55 |
--------------------------------------------------------------------------------
/tests/client/simple_vs_common.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx get one session from client, then check common session
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
21 | create_test_db($session);
22 | assert_session_valid($session);
23 |
24 | $common_session = mysql_xdevapi\getSession($connection_uri);
25 | assert_session_valid($common_session);
26 |
27 | verify_expectations();
28 | print "done!\n";
29 | ?>
30 | --CLEAN--
31 |
35 | --EXPECTF--
36 | done!%A
37 |
--------------------------------------------------------------------------------
/tests/client/waiting_timeout.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client queue timeout while getting session from client
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
20 | create_test_db($session0);
21 | assert_session_valid($session0);
22 |
23 | $session1 = $client->getSession();
24 | assert_session_valid($session1);
25 |
26 | $session2 = $client->getSession();
27 | assert_session_valid($session2);
28 |
29 | triggerQueueTimeoutAtGetSession($client);
30 |
31 | verify_expectations();
32 | print "done!\n";
33 | ?>
34 | --CLEAN--
35 |
39 | --EXPECTF--
40 | [10055][HY000] Run-time error. Couldn't get connection from pool - queue timeout elapsed%s
41 | done!%A
42 |
--------------------------------------------------------------------------------
/tests/client/waiting_timeout_close_open.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx client queue timeout, close other session, open once again
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | getSession();
19 | create_test_db($session0);
20 | assert_session_valid($session0);
21 |
22 | $session1 = $client->getSession();
23 | assert_session_valid($session1);
24 |
25 | triggerQueueTimeoutAtGetSession($client);
26 |
27 | $session1->close();
28 | assert_session_invalid($session1);
29 |
30 | $session2 = $client->getSession();
31 | assert_session_valid($session2);
32 |
33 | verify_expectations();
34 | print "done!\n";
35 | ?>
36 | --CLEAN--
37 |
41 | --EXPECTF--
42 | [10055][HY000] Run-time error. Couldn't get connection from pool - queue timeout elapsed%s
43 | [10056][HY000] Session closed.
44 | done!%A
45 |
--------------------------------------------------------------------------------
/tests/collection.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx Collection
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
10 | $coll = $schema->getCollection($test_collection_name);
11 |
12 | fill_db_collection($coll);
13 |
14 | expect_eq($coll->getName(),$test_collection_name);
15 | expect_eq($coll->name, $test_collection_name);
16 | expect_true($coll->existsInDatabase());
17 | expect_eq($coll->count(), 16);
18 |
19 | try {
20 | $schema = $coll->getSchema();
21 | expect_eq($schema->getName(),$db);
22 | expect_true($schema->existsInDatabase());
23 | $coll2 = $schema->getCollection($test_collection_name);
24 | expect_eq($coll2->getName(),$test_collection_name);
25 | expect_true($coll2->existsInDatabase());
26 | } catch(Exception $ex) {
27 | test_step_failed();
28 | }
29 |
30 | try {
31 | $session2 = $coll->getSession();
32 | } catch(Exception $ex) {
33 | test_step_failed();
34 | }
35 |
36 | $coll = $schema->getCollection("not_existing_collection");
37 | expect_eq($coll->getName(), 'not_existing_collection');
38 | expect_eq($coll->name, 'not_existing_collection');
39 | expect_false($coll->existsInDatabase());
40 |
41 | try {
42 | $schema = $coll->count();
43 | test_step_failed();
44 | } catch(Exception $ex) {
45 | test_step_ok();
46 | }
47 |
48 | verify_expectations();
49 | print "done!\n";
50 | ?>
51 | --CLEAN--
52 |
56 | --EXPECTF--
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/collection_remove.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection remove
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | getSchema($db);
12 | $coll = $schema->getCollection("test_collection");
13 |
14 | fill_db_collection($coll);
15 |
16 | $coll->remove('age > :age_from and age < :age_to')->bind(['age_from' => 20, 'age_to' => 50])->limit(7)->execute();
17 |
18 | $coll->remove('true')->sort('age desc')->limit(2)->execute();
19 | $coll->modify('_id in (1,13,5,7)')->unset(['age'])->execute();
20 | $coll->remove("job in ('Barista', 'Programmatore', 'Ballerino', 'Programmatrice')")->limit(5)->sort(['age desc', 'name asc'])->execute();
21 |
22 | $res = $coll->find()->execute()->fetchAll();
23 | expect_eq($res[0]['job'],'Programmatore');
24 | expect_eq($res[0]['name'],'Marco');
25 | expect_eq($res[1]['job'],'Programmatore');
26 | expect_eq($res[1]['name'],'Carlo');
27 |
28 | // fails expected due to empty or incorrect search-condition
29 | function check_incorrect_condition($condition) {
30 | global $coll;
31 | try {
32 | $coll->remove($condition);
33 | test_step_failed();
34 | } catch(Exception $e) {
35 | test_step_ok();
36 | }
37 | }
38 |
39 | check_incorrect_condition('');
40 | check_incorrect_condition(' ');
41 | check_incorrect_condition('@ incorrect $ condition &');
42 |
43 | verify_expectations();
44 | print "done!\n";
45 | ?>
46 | --CLEAN--
47 |
51 | --EXPECTF--
52 | done!%A
53 |
--------------------------------------------------------------------------------
/tests/complex_query.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx complex query
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
13 | $table = $schema->getTable("test_table");
14 |
15 | $sel = $table->select(['age as age_group', 'count(name) as cnt'])->groupBy('age_group');
16 | $sel = $sel->where("age > 11 and 1 < 2 and 40 between 30 and 900");
17 | $sel = $sel->having('cnt > 1');
18 | $sel = $sel->orderBy('age_group desc');
19 | $res = $sel->limit(2)->offset(1)->execute();
20 | $data = $res->fetchAll();
21 | expect_eq(count($data), 2);
22 | expect_eq($data[0]['age_group'],15);
23 | expect_eq($data[0]['cnt'],2);
24 | expect_eq($data[1]['age_group'],14);
25 | expect_eq($data[1]['cnt'],2);
26 |
27 | //Make sure to have duplicated values
28 | fill_db_table();
29 |
30 | //groupBy with multiple arguments
31 | $sel = $table->select(['age','count(name) as cnt'])->groupBy('age','name')->execute();
32 | $data = $sel->fetchAll();
33 | expect_eq(count($data), 12);
34 | for( $i = 0 ; $i < 12 ; $i++ ) {
35 | expect_eq($data[$i]['cnt'],2);
36 | }
37 |
38 | verify_expectations();
39 | print "done!\n";
40 | ?>
41 | --CLEAN--
42 |
46 | --EXPECTF--
47 | done!%A
48 |
--------------------------------------------------------------------------------
/tests/compression/algorithm_alias.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx compression algorithm aliases
3 | --SKIPIF--
4 | --FILE--
5 |
21 | --CLEAN--
22 |
26 | --EXPECTF--
27 | done!%A
28 |
--------------------------------------------------------------------------------
/tests/compression/algorithm_empty.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx compression algorithm empty
3 | --SKIPIF--
4 | --FILE--
5 |
16 | --CLEAN--
17 |
21 | --EXPECTF--
22 | done!%A
23 |
--------------------------------------------------------------------------------
/tests/compression/algorithm_name.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx compression algorithm names
3 | --SKIPIF--
4 | --FILE--
5 |
21 | --CLEAN--
22 |
26 | --EXPECTF--
27 | done!%A
28 |
--------------------------------------------------------------------------------
/tests/compression/algorithm_name_alias.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx compression algorithm mix names and aliases
3 | --SKIPIF--
4 | --FILE--
5 |
22 | --CLEAN--
23 |
27 | --EXPECTF--
28 | done!%A
29 |
--------------------------------------------------------------------------------
/tests/compression/algorithm_unknown.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx compression algorithm unknown
3 | --SKIPIF--
4 | --FILE--
5 |
21 | --CLEAN--
22 |
26 | --EXPECTF--
27 | done!%A
28 |
--------------------------------------------------------------------------------
/tests/compression/compression_utils.inc:
--------------------------------------------------------------------------------
1 | getMessage();
20 | if ($expect_failure) {
21 | test_step_ok();
22 | if ($msg != Compression_disabled_msg) {
23 | echo $msg, "\n";
24 | }
25 | } else {
26 | test_step_failed();
27 | echo $msg, "\n";
28 | }
29 | }
30 | }
31 |
32 | ?>
33 |
--------------------------------------------------------------------------------
/tests/crud_json/crud_json_utils.inc:
--------------------------------------------------------------------------------
1 | find('name = "'.$name.'"')->execute();
8 | print_r($res->fetchAll());
9 | }
10 |
11 | ?>
12 |
--------------------------------------------------------------------------------
/tests/drop_item.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx drop schema, table, collection, collection index, view
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
14 | $collection = $schema->getCollection($test_collection_name);
15 |
16 | $indexName = "name_index";
17 | $collection->createIndex($indexName, '{"fields": [{"field": "$.name", "type": "TEXT(25)", "required": true}], "unique": false}');
18 | expect_true($collection->dropIndex($indexName));
19 | expect_false($collection->dropIndex($indexName));
20 |
21 | expect_true($schema->dropCollection($test_collection_name));
22 | expect_false($schema->dropCollection($test_collection_name));
23 |
24 | expect_true($session->dropSchema($test_schema_name));
25 | expect_false($session->dropSchema($test_schema_name));
26 |
27 | verify_expectations();
28 | print "done!\n";
29 | ?>
30 | --CLEAN--
31 |
35 | --EXPECTF--
36 | Warning: mysql_xdevapi\Collection::dropIndex(): [1091][42000] Can't DROP 'name_index'; check that column/key exists in%A
37 |
38 | Warning: mysql_xdevapi\Schema::dropCollection(): [1051][42S02] Unknown table '%s.test_collection' in%A
39 |
40 | Warning: mysql_xdevapi\Session::dropSchema(): cannot drop schema '%s' in%A
41 | done!%A
42 |
--------------------------------------------------------------------------------
/tests/exists_in_database.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx existsInDatabase for schema, collection, table and view
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
11 | $table = $schema->getTable($test_table_name);
12 | $collection = $schema->getCollection($test_collection_name);
13 | $view = create_test_view($session);
14 |
15 | expect_true($schema->existsInDatabase());
16 | expect_true($table->existsInDatabase());
17 | expect_true($collection->existsInDatabase());
18 | expect_true($view->existsInDatabase());
19 | expect_true($view->isView());
20 |
21 | $table = $schema->getTable("non_found_table");
22 | $collection = $schema->getCollection("non_found_collection");
23 |
24 | expect_false($table->existsInDatabase());
25 | expect_false($table->isView());
26 | expect_false($collection->existsInDatabase());
27 |
28 | $schema = $session->getSchema("non_existing_schema");
29 | $table = $schema->getTable("non_existing_table");
30 | $collection = $schema->getCollection("non_existing_collection");
31 |
32 | expect_false($schema->existsInDatabase());
33 | expect_false($table->existsInDatabase());
34 | expect_false($table->isView());
35 | expect_false($collection->existsInDatabase());
36 |
37 | verify_expectations();
38 | print "done!".PHP_EOL;
39 | ?>
40 | --CLEAN--
41 |
45 | --EXPECTF--
46 | done!%A
47 |
--------------------------------------------------------------------------------
/tests/get_auto_increment_value.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx getAutoIncrementValue
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | sql("create database $db")->execute();
12 | $session->sql("create table $db.test_table(id int not null auto_increment,name char(30), primary key (id))")->execute();
13 |
14 | $schema = $session->getSchema($db);
15 | $table = $schema->getTable("test_table");
16 |
17 | $res = $table->insert(['name'])->values(['name'=>'Luigi']);
18 | $res = $res->values(['name'=>'Carlo'])->execute();
19 |
20 | expect_eq($res->getAffectedItemsCount(), 2);
21 | expect_eq($res->getAutoIncrementValue(), 1);
22 |
23 | $res = $table->insert(['name'])->values(['name'=>'Arturo'])->execute();
24 |
25 | expect_eq($res->getAffectedItemsCount(), 1);
26 | expect_eq($res->getAutoIncrementValue(), 3);
27 |
28 | verify_expectations();
29 | print "done!\n";
30 | ?>
31 | --CLEAN--
32 |
36 | --EXPECTF--
37 | done!%A
38 |
--------------------------------------------------------------------------------
/tests/get_name.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx getName for schema, collection, table and view
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
11 | $table = $schema->getTable($test_table_name);
12 | $collection = $schema->getCollection($test_collection_name);
13 | $view = create_test_view($session);
14 |
15 | var_dump($schema->getName());
16 | var_dump($table->getName());
17 | var_dump($collection->getName());
18 | var_dump($view->getName());
19 |
20 | $table = $schema->getTable("non_found_table");
21 | $collection = $schema->getCollection("non_found_collection");
22 |
23 | var_dump($table->getName());
24 | var_dump($collection->getName());
25 |
26 | $schema = $session->getSchema("non_existing_schema");
27 | $table = $schema->getTable("non_existing_table");
28 | $collection = $schema->getCollection("non_existing_collection");
29 |
30 | var_dump($schema->getName());
31 | var_dump($table->getName());
32 | var_dump($collection->getName());
33 | var_dump($view->getName());
34 |
35 | print "done!\n";
36 | ?>
37 | --CLEAN--
38 |
42 | --EXPECTF--
43 | string(%d) "%s"
44 | string(10) "test_table"
45 | string(15) "test_collection"
46 | string(9) "test_view"
47 | string(15) "non_found_table"
48 | string(20) "non_found_collection"
49 | string(19) "non_existing_schema"
50 | string(18) "non_existing_table"
51 | string(23) "non_existing_collection"
52 | string(9) "test_view"
53 | done!%A
54 |
--------------------------------------------------------------------------------
/tests/get_tableget_tables.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx getTable/getTables
3 | --SKIPIF--
4 | --FILE--
5 | existsInDatabase());
11 | expect_eq($tables[$name]->getName(), $name);
12 | expect_eq($tables[$name]->isView(), $is_view);
13 | }
14 |
15 | $session = create_test_db();
16 |
17 | $schema = $session->getSchema($db);
18 | $table = $schema->getTable("wrong_table");
19 |
20 | expect_false($table->existsInDatabase());
21 |
22 | try {
23 | $table->insert(["name", "age"])->values(["Jackie", 256])->execute();
24 | test_step_failed();
25 | } catch(Exception $e) {
26 | test_step_ok();
27 | }
28 | expect_null($schema->getTable(""));
29 |
30 | $session->sql("create table $db.test_table2(job text, experience int, uuid int)")->execute();
31 | $session->sql("create table $db.test_table3(name text, surname text)")->execute();
32 | create_test_view($session);
33 |
34 | $tables = $schema->getTables();
35 | assert_table($test_table_name);
36 | assert_table('test_table2');
37 | assert_table('test_table3');
38 | assert_table($test_view_name, true);
39 |
40 | verify_expectations();
41 | print "done!\n";
42 | ?>
43 | --CLEAN--
44 |
48 | --EXPECTF--
49 | done!%A
50 |
--------------------------------------------------------------------------------
/tests/index/drop.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx drop index
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | getSchema($db);
13 | $coll = $schema->getCollection($test_collection_name);
14 |
15 | drop_index(false);
16 |
17 | create_index('{"fields": [{"field": "$.myField", "type": "TEXT(13)"}]}');
18 |
19 | drop_index(true);
20 | drop_index(false);
21 | drop_index(false);
22 |
23 | create_index('{"fields": [{"field": "$.myField", "type": "TEXT(13)"}, {"field": "$.myField2", "type": "TEXT(10)", "required": true}, {"field": "$.myField3", "type": "INT UNSIGNED", "required": false}], "unique": true}');
24 |
25 | drop_index(true);
26 | drop_index(false);
27 | drop_index(false);
28 |
29 | verify_expectations();
30 | print "done!\n";
31 | ?>
32 | --CLEAN--
33 |
37 | --EXPECTF--
38 | done!%A
39 |
--------------------------------------------------------------------------------
/tests/index/extra.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx create/drop index - extra cases
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | // ET_1 Create an index with mismatched data types
14 | // Create the index with datetime data type on a number "field":
15 | expect_create_index_with_name("myIntField", '{"fields": [{"field": "$.myField", "type": "DATETIME"}]}');
16 |
17 | // ET_2 Create an index specifiying SPATIAL as the index type for a non spatial data type
18 | // Create the index with text data type and geojson "options":
19 | // Error should be thrown
20 | expect_fail_index('{"fields": [{"field": "$.myField", "type": "TEXT(13)"}], "type":"SPATIAL"}');
21 |
22 | // ET_3 Create an index specifiying INDEX as the index type for a spatial data type
23 | // Create the index with text data type and geojson "options":
24 | // Error should be thrown
25 | //FILIP: expect_fail_index('{"fields": [{"field": "$.myField", "type": "GEOJSON", "required": true, "options": 2, "srid": 4326}], "type":"INDEX"}');
26 |
27 | verify_expectations();
28 | print "done!\n";
29 | ?>
30 | --CLEAN--
31 |
35 | --EXPECTF--
36 | done!%A
37 |
--------------------------------------------------------------------------------
/tests/prepared_statement/ps_utils.inc:
--------------------------------------------------------------------------------
1 | select(true)->execute();
8 | return $obj->fetchAll();
9 | }
10 |
11 | function get_stmt_id($op_idx) {
12 | $prep_stmts = get_prepared_statements();
13 | return $prep_stmts[$op_idx]["STATEMENT_ID"];
14 | }
15 |
16 | function verify_op_ps( $op_idx, $expected, $sql_idx, $count ) {
17 | global $sql_strings;
18 | $prep_stmts = get_prepared_statements();
19 | expect_eq( count($prep_stmts), $count );
20 | $prep_stmt = $prep_stmts[$op_idx];
21 | expect_eq($prep_stmt["STATEMENT_ID"], $expected);
22 |
23 | if( $sql_idx > 0 ){
24 | expect_eq($prep_stmt["SQL_TEXT"], $sql_strings[$sql_idx]);
25 | }
26 | }
27 |
28 | ?>
29 |
--------------------------------------------------------------------------------
/tests/query/collection_overlaps_string.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | collection [NOT] OVERLAPS operator on string
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | getSchema($db);
16 | $coll = $schema->getCollection($test_collection_name);
17 | fill_db_collection($coll);
18 |
19 | verify_query_result('["Monica"] overlaps $.name', array("9"));
20 | verify_query_result('["Carlo", "Carlotta"] OVERLAPS $.name', array("4", "5", "15"));
21 | verify_query_result(
22 | '["Marco", "Riccardo", "Alfredo", "Giulio", "Alessandra", "Carlo"] not overlaps $.name',
23 | array("2", "4", "6", "8", "9", "11", "12", "14", "16"));
24 |
25 | verify_query_result('["Paninaro", "Cantante"] overlaps $.job', array("2", "3"));
26 | verify_query_result('["Studente"] OVERLAPS $.job', array("8"));
27 | verify_query_result(
28 | '["Programmatore", "Barista", "Programmatrice", "Calciatore"] NOT OVERLAPS $.job',
29 | array("2", "3", "8", "9", "10", "12"));
30 |
31 | verify_expectations();
32 | print "done!\n";
33 | ?>
34 | --CLEAN--
35 |
39 | --EXPECTF--
40 | done!%A
41 |
--------------------------------------------------------------------------------
/tests/query/query_utils.inc:
--------------------------------------------------------------------------------
1 | find($criteria)->fields($field)->sort($sort_by)->execute();
17 | $result = $query->fetchAll();
18 | compare_result($result, $expected_result, $field);
19 | }
20 |
21 | function verify_table_query_result($select_column, $criteria, $order_by, $expected_result) {
22 | global $table;
23 | $query = $table->select($select_column)->where($criteria)->orderBy($order_by)->execute();
24 | $result = $query->fetchAll();
25 | compare_result($result, $expected_result, $select_column);
26 | }
27 |
28 | ?>
29 |
--------------------------------------------------------------------------------
/tests/query/table_overlaps_int.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | table [NOT] OVERLAPS operator on int
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | getSchema($db);
16 | $table = $schema->getTable($test_table_name);
17 | fill_db_table();
18 |
19 | verify_query_result(
20 | 'CAST(age as JSON) overlaps [11, 13, 19]',
21 | array("Eulalia", "Mamie", "Cassidy"));
22 | verify_query_result('CAST(age as JSON) overlaps [14, 21, 30]', array("Lev", "Olympia"));
23 | verify_query_result('[13, 21, 30] overlaps CAST(age as JSON)', array("Cassidy"));
24 | verify_query_result(
25 | '[7, 11, 12, 14, 15, 17] not overlaps CAST(age as JSON)',
26 | array("Cassidy", "Vesper"));
27 |
28 | verify_query_result(
29 | '[17, 14, 10] OVERlaps CAST(age as JSON)',
30 | array("Lev", "Olympia", "Caspian", "Romy"));
31 | verify_query_result('[18, 10] overLAPS CAST(age as JSON)', array());
32 |
33 | verify_query_result(
34 | 'CAST(age as JSON) Not Overlaps [17, 16, 14, 11]',
35 | array("Polly", "Rufus", "Cassidy", "Octavia", "Tierney"));
36 | verify_query_result(
37 | '[1, 11, 12, 13, 14, 15, 16, 17, 20] NoT OvErLaPs CAST(age as JSON)',
38 | array());
39 |
40 | verify_expectations();
41 | print "done!\n";
42 | ?>
43 | --CLEAN--
44 |
48 | --EXPECTF--
49 | done!%A
50 |
--------------------------------------------------------------------------------
/tests/row_locking/collection_parallel_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | startTransaction();
14 |
15 | recv_let_worker_modify();
16 |
17 | find_lock_one($coll, '3', $Lock_exclusive);
18 | modify_row($coll, '3', 333);
19 |
20 | find_lock_one($coll, '4', $Lock_exclusive);
21 | modify_row($coll, '4', 444);
22 |
23 | recv_let_worker_block();
24 |
25 | check_find_lock_one($coll, '1', 11, $Lock_exclusive);
26 | check_find_lock_one($coll, '2', 22, $Lock_exclusive);
27 |
28 | find_lock_one($coll, '5', $Lock_exclusive);
29 | modify_row($coll, '5', 55);
30 |
31 | find_lock_one($coll, '1', $Lock_exclusive);
32 | modify_row($coll, '1', 111);
33 |
34 | find_lock_one($coll, '2', $Lock_exclusive);
35 | modify_row($coll, '2', 222);
36 |
37 | recv_let_worker_commit();
38 | $session->commit();
39 | notify_worker_committed();
40 |
41 | recv_let_worker_end();
42 | ?>
43 |
--------------------------------------------------------------------------------
/tests/row_locking/collection_parallel_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
17 | $coll = $schema->getCollection($test_collection_name);
18 |
19 | $session->startTransaction();
20 |
21 | $res2 = find_lock_one($coll, '4', $Lock_shared);
22 |
23 | $res1 = find_lock_one($coll, '3', $Lock_shared);
24 |
25 | send_current_state($res1, $res2);
26 |
27 | recv_let_worker_block();
28 |
29 | $res2 = find_lock_one($coll, '5', $Lock_shared);
30 | $res1 = find_lock_one($coll, '6', $Lock_shared);
31 | send_current_state($res1, $res2);
32 |
33 | recv_let_worker_commit();
34 | $session->commit();
35 | notify_worker_committed();
36 |
37 | $res1 = find_lock_one($coll, '1', $Lock_shared);
38 | $res2 = find_lock_one($coll, '2', $Lock_shared);
39 | send_current_state($res1, $res2);
40 |
41 | $res1 = find_lock_one($coll, '5', $Lock_shared);
42 | $res2 = find_lock_one($coll, '6', $Lock_shared);
43 | send_current_state($res1, $res2);
44 | ?>
45 |
--------------------------------------------------------------------------------
/tests/row_locking/collection_parallel_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection row locking parallel shared read before exclusive write
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | startTransaction();
22 | check_find_lock_all($coll, ['1', '2', '3'], [1, 2, 3], $Lock_shared);
23 |
24 | send_let_worker_modify();
25 |
26 | check_find_lock_one($coll, '6', 6, $Lock_shared);
27 |
28 | send_let_worker_block();
29 |
30 | check_find_lock_one($coll, '2', 2, $Lock_shared);
31 |
32 | $session->commit();
33 |
34 | send_let_worker_commit();
35 |
36 | check_find_lock_one($coll, '6', 6, $Lock_shared);
37 |
38 | recv_worker_committed();
39 | check_find_lock_all($coll, ['1', '2', '3'], [11, 22, 3], $Lock_shared);
40 | check_find_lock_all($coll, ['4', '5', '6'], [44, 55, 6], $Lock_shared);
41 |
42 | recv_msg_from_worker("ok");
43 | send_let_worker_end();
44 | }
45 |
46 | verify_expectations();
47 | print "done!\n";
48 | ?>
49 | --CLEAN--
50 |
54 | --EXPECTF--
55 | worker cmd-line:%s
56 | worker started
57 | let worker modify
58 | let worker block
59 | let worker commit
60 | worker committed
61 | ok
62 | let worker end
63 | done!%A
64 |
--------------------------------------------------------------------------------
/tests/row_locking/collection_parallel_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
12 | $coll = $schema->getCollection($test_collection_name);
13 |
14 | $session->startTransaction();
15 |
16 | recv_let_worker_modify();
17 |
18 | check_find_lock_all($coll, ['4', '5'], [4, 5], $Lock_exclusive);
19 | modify_row($coll, '4', 44);
20 | modify_row($coll, '5', 55);
21 | check_find_lock_all($coll, ['4', '5'], [44, 55], $Lock_exclusive);
22 |
23 | recv_let_worker_block();
24 |
25 | check_find_lock_one($coll, '3', 3, $Lock_exclusive);
26 |
27 | check_find_lock_one($coll, '2', 2, $Lock_exclusive);
28 | modify_row($coll, '2', 22);
29 | check_find_lock_one($coll, '2', 22, $Lock_exclusive);
30 |
31 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
32 | modify_row($coll, '1', 11);
33 | check_find_lock_one($coll, '1', 11, $Lock_exclusive);
34 |
35 | recv_let_worker_commit();
36 | $session->commit();
37 | check_find_lock_all($coll, ['4', '5'], [44, 55], $Lock_shared);
38 | notify_worker_committed();
39 |
40 | send_verification_status();
41 | recv_let_worker_end();
42 | ?>
43 |
--------------------------------------------------------------------------------
/tests/row_locking/table_parallel_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $tab = $schema->getTable($test_table_name);
12 |
13 | $session->startTransaction();
14 |
15 | recv_let_worker_modify();
16 |
17 | select_lock_one($tab, '3', $Lock_exclusive);
18 | update_row($tab, '3', 333);
19 |
20 | select_lock_one($tab, '4', $Lock_exclusive);
21 | update_row($tab, '4', 444);
22 |
23 | recv_let_worker_block();
24 |
25 | select_lock_one($tab, '1', $Lock_exclusive);
26 | update_row($tab, '1', 111);
27 |
28 | select_lock_one($tab, '2', $Lock_exclusive);
29 | update_row($tab, '2', 222);
30 |
31 | recv_let_worker_commit();
32 | $session->commit();
33 | notify_worker_committed();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/row_locking/table_parallel_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
17 | $tab = $schema->getTable($test_table_name);
18 |
19 | $session->startTransaction();
20 |
21 | $res2 = select_lock_one($tab, '3', $Lock_shared);
22 | $res1 = select_lock_one($tab, '4', $Lock_shared);
23 | send_current_state($res1, $res2);
24 |
25 | recv_let_worker_block();
26 |
27 | $res1 = select_lock_one($tab, '5', $Lock_shared);
28 | $res2 = select_lock_one($tab, '2', $Lock_shared);
29 | send_current_state($res1, $res2);
30 |
31 | recv_let_worker_commit();
32 | $session->commit();
33 | notify_worker_committed();
34 |
35 | $res1 = select_lock_one($tab, '1', $Lock_shared);
36 | $res2 = select_lock_one($tab, '2', $Lock_shared);
37 | send_current_state($res1, $res2);
38 |
39 | $res1 = select_lock_one($tab, '5', $Lock_shared);
40 | $res2 = select_lock_one($tab, '6', $Lock_shared);
41 | send_current_state($res1, $res2);
42 | ?>
43 |
--------------------------------------------------------------------------------
/tests/row_locking/table_parallel_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table row locking parallel shared read before exclusive write
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | startTransaction();
22 | check_select_lock_all($tab, ['1', '2', '3'], [1, 2, 3], $Lock_shared);
23 |
24 | send_let_worker_modify();
25 |
26 | check_select_lock_one($tab, '4', 4, $Lock_shared);
27 |
28 | send_let_worker_block();
29 |
30 | $session->commit();
31 |
32 | check_select_lock_one($tab, '4', 4, $Lock_shared);
33 |
34 | send_let_worker_commit();
35 | recv_worker_committed();
36 |
37 | check_select_lock_all($tab, ['4', '5', '6'], [4, 55, 66], $Lock_shared);
38 | check_select_lock_all($tab, ['1', '2', '3'], [11, 22, 3], $Lock_shared);
39 |
40 | recv_msg_from_worker("ok");
41 | send_let_worker_end();
42 | }
43 |
44 | verify_expectations();
45 | print "done!\n";
46 | ?>
47 | --CLEAN--
48 |
52 | --EXPECTF--
53 | worker cmd-line:%s
54 | worker started
55 | let worker modify
56 | let worker block
57 | let worker commit
58 | worker committed
59 | ok
60 | let worker end
61 | done!%A
62 |
--------------------------------------------------------------------------------
/tests/row_locking/table_parallel_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
12 | $tab = $schema->getTable($test_table_name);
13 |
14 | $session->startTransaction();
15 |
16 | recv_let_worker_modify();
17 |
18 | check_select_lock_one($tab, '5', 5, $Lock_exclusive);
19 | update_row($tab, '5', 55);
20 | check_select_lock_one($tab, '5', 55, $Lock_exclusive);
21 |
22 | check_select_lock_one($tab, '6', 6, $Lock_exclusive);
23 | update_row($tab, '6', 66);
24 | check_select_lock_one($tab, '6', 66, $Lock_exclusive);
25 |
26 | recv_let_worker_block();
27 |
28 | check_select_lock_one($tab, '2', 2, $Lock_exclusive);
29 | update_row($tab, '2', 22);
30 | check_select_lock_one($tab, '2', 22, $Lock_exclusive);
31 |
32 | check_select_lock_one($tab, '3', 3, $Lock_exclusive);
33 |
34 | check_select_lock_one($tab, '1', 1, $Lock_exclusive);
35 | update_row($tab, '1', 11);
36 | check_select_lock_one($tab, '1', 11, $Lock_exclusive);
37 |
38 | recv_let_worker_commit();
39 | $session->commit();
40 | notify_worker_committed();
41 |
42 | send_verification_status();
43 | recv_let_worker_end();
44 | ?>
45 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, exclusive, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_exclusive_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, none lock, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // this line should unlock the transaction in the terminal/cmd 2
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_exclusive_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
17 | // the execution should return immediately, no block should be present
18 | // as MySQL CLI handles this scenario
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now
24 | check_find_lock_one($coll, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
25 | $session->rollback();
26 | // rollback the open transaction
27 | notify_worker_rolled_back();
28 |
29 | recv_let_worker_end();
30 | ?>
31 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, shared, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_DEFAULT);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_DEFAULT);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - shared, exclusive, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_shared_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - shared, none lock, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the open transaction
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_shared_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | check_find_lock_one($coll, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
23 | $session->rollback();
24 | // rollback the open transaction
25 | notify_worker_rolled_back();
26 |
27 | recv_let_worker_end();
28 | ?>
29 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_default_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_DEFAULT);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_run_cmd();
21 | modify_row($coll, '1', 11);
22 | // The transaction should be blocked
23 | notify_worker_ran_cmd();
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // the execution should return immediately, no block should be present
28 | check_find_lock_one($coll, '1', 11, $Lock_shared, MYSQLX_LOCK_DEFAULT);
29 | $session->rollback();
30 | // rollback the open transaction
31 | notify_worker_rolled_back();
32 |
33 | recv_let_worker_end();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, exclusive, nowait
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | try {
17 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
18 | // the execution should return immediately, and an error must be thrown
19 | test_step_failed();
20 | } catch(Exception $e) {
21 | log_err($e);
22 | notify_worker_ran_cmd();
23 | }
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // since commit is done in cmd1 then the read must be possible now and no error
28 | // should be thrown
29 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, shared, nowait
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | try {
17 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_NOWAIT);
18 | // the execution should return immediately, and an error must be thrown
19 | test_step_failed();
20 | } catch(Exception $e) {
21 | log_err($e);
22 | notify_worker_ran_cmd();
23 | }
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // since commit is done in cmd1 then the read must be possible now and no error
28 | // should be thrown
29 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_NOWAIT);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - shared, exclusive, nowait
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | try {
17 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
18 | // the execution should return immediately, and an error must be thrown
19 | test_step_failed();
20 | } catch(Exception $e) {
21 | log_err($e);
22 | notify_worker_ran_cmd();
23 | }
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // since commit is done in cmd1 then the read must be possible now and no error
28 | // should be thrown
29 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_nowait_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_NOWAIT);
17 | // the execution should return immediately, no block and no error should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_run_cmd();
21 | modify_row($coll, '1', 11);
22 | // The transaction should be blocked
23 | notify_worker_ran_cmd();
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // the execution should return immediately, no block and no error should be present
28 | check_find_lock_one($coll, '1', 11, $Lock_shared, MYSQLX_LOCK_NOWAIT);
29 | $session->rollback();
30 | // rollback the open transaction
31 | notify_worker_rolled_back();
32 |
33 | recv_let_worker_end();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, exclusive, skip locked
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', null, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, and no error must be thrown. No
18 | // data should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now and no error
24 | // should be thrown. Data should be returned
25 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
26 | $session->rollback();
27 | // rollback the open transaction
28 | notify_worker_rolled_back();
29 |
30 | recv_let_worker_end();
31 | ?>
32 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, shared, skip locked
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', null, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, and no error must be thrown. No data
18 | // should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now and no error
24 | // should be thrown. Data should be returned
25 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
26 | $session->rollback();
27 | // rollback the open transaction
28 | notify_worker_rolled_back();
29 |
30 | recv_let_worker_end();
31 | ?>
32 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - shared, exclusive, skip locked
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', null, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, and no error must be thrown. No data
18 | // should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now and no error
24 | // should be thrown. Data should be returned
25 | check_find_lock_one($coll, '1', 1, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
26 | $session->rollback();
27 | // rollback the open transaction
28 | notify_worker_rolled_back();
29 |
30 | recv_let_worker_end();
31 | ?>
32 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_skip_locked_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, no block and no error should be
18 | // present. Data should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_run_cmd();
22 | modify_row($coll, '1', 11);
23 | // The transaction should be blocked
24 | notify_worker_ran_cmd();
25 |
26 | recv_let_worker_rollback();
27 | // terminal/cmd 2
28 | // read must be possible now and no error should be thrown. Data should be returned
29 | check_find_lock_one($coll, '1', 11, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, exclusive, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_exclusive_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, none lock, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // this line should unlock the transaction in the terminal/cmd 2
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_exclusive_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_none);
17 | // the execution should return immediately, no block should be present
18 | // as MySQL CLI handles this scenario
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now
24 | check_find_lock_one($coll, '1', 1, $Lock_none);
25 | $session->rollback();
26 | // rollback the open transaction
27 | notify_worker_rolled_back();
28 |
29 | recv_let_worker_end();
30 | ?>
31 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - exclusive, shared, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_shared);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_find_lock_one($coll, '1', 1, $Lock_shared);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - shared, exclusive, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_find_lock_one($coll, '1', 1, $Lock_exclusive);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_shared_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection waiting options - shared, none lock, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_find_lock_one($coll, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the open transaction
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_shared_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_none);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | check_find_lock_one($coll, '1', 1, $Lock_none);
23 | $session->rollback();
24 | // rollback the open transaction
25 | notify_worker_rolled_back();
26 |
27 | recv_let_worker_end();
28 | ?>
29 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_collection/coll_without_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $coll = $schema->getCollection($test_collection_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_find_lock_one($coll, '1', 1, $Lock_shared);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_run_cmd();
21 | modify_row($coll, '1', 11);
22 | // The transaction should be blocked
23 | notify_worker_ran_cmd();
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // the execution should return immediately, no block should be present
28 | check_find_lock_one($coll, '1', 11, $Lock_shared);
29 | $session->rollback();
30 | // rollback the open transaction
31 | notify_worker_rolled_back();
32 |
33 | recv_let_worker_end();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, exclusive, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_exclusive_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, none lock, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // this line should unlock the transaction in the terminal/cmd 2
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_exclusive_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
17 | // the execution should return immediately, no block should be present
18 | // as MySQL CLI handles this scenario
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now
24 | check_select_lock_one($table, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
25 | $session->rollback();
26 | // rollback the open transaction
27 | notify_worker_rolled_back();
28 |
29 | recv_let_worker_end();
30 | ?>
31 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, shared, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_DEFAULT);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_DEFAULT);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - shared, exclusive, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_DEFAULT);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_shared_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - shared, none lock, default waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the open transaction
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_shared_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | check_select_lock_one($table, '1', 1, $Lock_none, MYSQLX_LOCK_DEFAULT);
23 | $session->rollback();
24 | // rollback the open transaction
25 | notify_worker_rolled_back();
26 |
27 | recv_let_worker_end();
28 | ?>
29 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_default_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_DEFAULT);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_run_cmd();
21 | update_row($table, '1', 11);
22 | // The transaction should be blocked
23 | notify_worker_ran_cmd();
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // the execution should return immediately, no block should be present
28 | check_select_lock_one($table, '1', 11, $Lock_shared, MYSQLX_LOCK_DEFAULT);
29 | $session->rollback();
30 | // rollback the open transaction
31 | notify_worker_rolled_back();
32 |
33 | recv_let_worker_end();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, exclusive, nowait
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | try {
17 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
18 | // the execution should return immediately, and an error must be thrown
19 | test_step_failed();
20 | } catch(Exception $e) {
21 | log_err($e);
22 | notify_worker_ran_cmd();
23 | }
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // since commit is done in cmd1 then the read must be possible now and no error
28 | // should be thrown
29 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, shared, nowait
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | try {
17 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_NOWAIT);
18 | // the execution should return immediately, and an error must be thrown
19 | test_step_failed();
20 | } catch(Exception $e) {
21 | log_err($e);
22 | notify_worker_ran_cmd();
23 | }
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // since commit is done in cmd1 then the read must be possible now and no error
28 | // should be thrown
29 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_NOWAIT);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - shared, exclusive, nowait
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | try {
17 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
18 | // the execution should return immediately, and an error must be thrown
19 | test_step_failed();
20 | } catch(Exception $e) {
21 | log_err($e);
22 | notify_worker_ran_cmd();
23 | }
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // since commit is done in cmd1 then the read must be possible now and no error
28 | // should be thrown
29 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_NOWAIT);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_nowait_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_NOWAIT);
17 | // the execution should return immediately, no block and no error should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_run_cmd();
21 | update_row($table, '1', 11);
22 | // The transaction should be blocked
23 | notify_worker_ran_cmd();
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // the execution should return immediately, no block and no error should be present
28 | check_select_lock_one($table, '1', 11, $Lock_shared, MYSQLX_LOCK_NOWAIT);
29 | $session->rollback();
30 | // rollback the open transaction
31 | notify_worker_rolled_back();
32 |
33 | recv_let_worker_end();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, exclusive, skip locked
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', null, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, and no error must be thrown. No
18 | // data should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now and no error
24 | // should be thrown. Data should be returned
25 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
26 | $session->rollback();
27 | // rollback the open transaction
28 | notify_worker_rolled_back();
29 |
30 | recv_let_worker_end();
31 | ?>
32 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, shared, skip locked
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', null, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, and no error must be thrown. No data
18 | // should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now and no error
24 | // should be thrown. Data should be returned
25 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
26 | $session->rollback();
27 | // rollback the open transaction
28 | notify_worker_rolled_back();
29 |
30 | recv_let_worker_end();
31 | ?>
32 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - shared, exclusive, skip locked
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the transaction open
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', null, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, and no error must be thrown. No data
18 | // should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now and no error
24 | // should be thrown. Data should be returned
25 | check_select_lock_one($table, '1', 1, $Lock_exclusive, MYSQLX_LOCK_SKIP_LOCKED);
26 | $session->rollback();
27 | // rollback the open transaction
28 | notify_worker_rolled_back();
29 |
30 | recv_let_worker_end();
31 | ?>
32 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_skip_locked_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
17 | // the execution should return immediately, no block and no error should be
18 | // present. Data should be returned
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_run_cmd();
22 | update_row($table, '1', 11);
23 | // The transaction should be blocked
24 | notify_worker_ran_cmd();
25 |
26 | recv_let_worker_rollback();
27 | // terminal/cmd 2
28 | // read must be possible now and no error should be thrown. Data should be returned
29 | check_select_lock_one($table, '1', 11, $Lock_shared, MYSQLX_LOCK_SKIP_LOCKED);
30 | $session->rollback();
31 | // rollback the open transaction
32 | notify_worker_rolled_back();
33 |
34 | recv_let_worker_end();
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_exclusive_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, exclusive, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_exclusive_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_exclusive_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, none lock, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // this line should unlock the transaction in the terminal/cmd 2
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_exclusive_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_none);
17 | // the execution should return immediately, no block should be present
18 | // as MySQL CLI handles this scenario
19 | notify_worker_ran_cmd();
20 |
21 | recv_let_worker_rollback();
22 | // terminal/cmd 2
23 | // since commit is done in cmd1 then the read must be possible now
24 | check_select_lock_one($table, '1', 1, $Lock_none);
25 | $session->rollback();
26 | // rollback the open transaction
27 | notify_worker_rolled_back();
28 |
29 | recv_let_worker_end();
30 | ?>
31 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_exclusive_shared.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - exclusive, shared, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_exclusive_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_shared);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_select_lock_one($table, '1', 1, $Lock_shared);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_shared_exclusive.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - shared, exclusive, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | // let worker block now
28 | sleep(1);
29 |
30 | // terminal/cmd 1
31 | $session->commit();
32 | // this line should unlock the transaction in the terminal/cmd 2
33 | recv_worker_ran_cmd();
34 |
35 | send_let_worker_rollback();
36 | recv_worker_rolled_back();
37 |
38 | send_let_worker_end();
39 | }
40 |
41 | verify_expectations();
42 | print "done!\n";
43 | ?>
44 | --CLEAN--
45 |
49 | --EXPECTF--
50 | worker cmd-line:%s
51 | worker started
52 | let worker run cmd
53 | worker ran cmd
54 | let worker rollback
55 | worker rolled back
56 | let worker end
57 | done!%A
58 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_shared_exclusive_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
17 | // the execution should not return immediately, the transaction should be blocked
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | // since commit is done in cmd1 then the read must be possible now
23 | check_select_lock_one($table, '1', 1, $Lock_exclusive);
24 | $session->rollback();
25 | // rollback the open transaction
26 | notify_worker_rolled_back();
27 |
28 | recv_let_worker_end();
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_shared_none.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx table waiting options - shared, none lock, without waiting option
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | startTransaction();
24 | check_select_lock_one($table, '1', 1, $Lock_shared);
25 |
26 | send_let_worker_run_cmd();
27 | recv_worker_ran_cmd();
28 |
29 | // terminal/cmd 1
30 | $session->commit();
31 | // commit the open transaction
32 |
33 | send_let_worker_rollback();
34 | recv_worker_rolled_back();
35 |
36 | send_let_worker_end();
37 | }
38 |
39 | verify_expectations();
40 | print "done!\n";
41 | ?>
42 | --CLEAN--
43 |
47 | --EXPECTF--
48 | worker cmd-line:%s
49 | worker started
50 | let worker run cmd
51 | worker ran cmd
52 | let worker rollback
53 | worker rolled back
54 | let worker end
55 | done!%A
56 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_shared_none_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_none);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_rollback();
21 | // terminal/cmd 2
22 | check_select_lock_one($table, '1', 1, $Lock_none);
23 | $session->rollback();
24 | // rollback the open transaction
25 | notify_worker_rolled_back();
26 |
27 | recv_let_worker_end();
28 | ?>
29 |
--------------------------------------------------------------------------------
/tests/row_locking/waiting_options_table/tab_without_shared_shared_worker.php:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
11 | $table = $schema->getTable($test_table_name);
12 |
13 | recv_let_worker_run_cmd();
14 | // terminal/cmd 2
15 | $session->startTransaction();
16 | check_select_lock_one($table, '1', 1, $Lock_shared);
17 | // the execution should return immediately, no block should be present
18 | notify_worker_ran_cmd();
19 |
20 | recv_let_worker_run_cmd();
21 | update_row($table, '1', 11);
22 | // The transaction should be blocked
23 | notify_worker_ran_cmd();
24 |
25 | recv_let_worker_rollback();
26 | // terminal/cmd 2
27 | // the execution should return immediately, no block should be present
28 | check_select_lock_one($table, '1', 11, $Lock_shared);
29 | $session->rollback();
30 | // rollback the open transaction
31 | notify_worker_rolled_back();
32 |
33 | recv_let_worker_end();
34 | ?>
35 |
--------------------------------------------------------------------------------
/tests/schema/common_default_schema.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx common test for default schema in uri
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 |
31 | --CLEAN--
32 |
36 | --EXPECTF--
37 | done!%A
38 |
--------------------------------------------------------------------------------
/tests/schema/empty_default_schema.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx empty default schema
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 |
23 | --CLEAN--
24 |
28 | --EXPECTF--
29 | done!%A
30 |
--------------------------------------------------------------------------------
/tests/schema/get_default_schema.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx get default schema
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | getDefaultSchema();
21 | expect_eq($schema->getName(), $default_schema_name);
22 |
23 | verify_expectations();
24 | print "done!\n";
25 | ?>
26 | --CLEAN--
27 |
31 | --EXPECTF--
32 | done!%A
33 |
--------------------------------------------------------------------------------
/tests/schema/get_empty_default_schema.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx get empty default schema
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 | getDefaultSchema();
14 | expect_null($schema);
15 |
16 | verify_expectations();
17 | print "done!\n";
18 | ?>
19 | --CLEAN--
20 |
24 | --EXPECTF--
25 | done!%A
26 |
--------------------------------------------------------------------------------
/tests/schema/incorrect_default_schema.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx incorrect default schema
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | --FILE--
7 |
22 | --CLEAN--
23 |
27 | --EXPECTF--
28 | Warning: %s
29 | done!%A
30 |
--------------------------------------------------------------------------------
/tests/schema/schema_utils.inc:
--------------------------------------------------------------------------------
1 | sql("create database $schema_name")->execute();
15 | return $session->getSchema($schema_name);
16 | }
17 |
18 | function create_table($session, $schema, $table_name) {
19 | $schema_name = $schema->getName();
20 | $session->sql("create table $schema_name.$table_name(name varchar(128), age int)")->execute();
21 | return $schema->getTable($table_name);
22 | }
23 |
24 | function create_collection($session, $schema, $collection_name) {
25 | $schema->createCollection($collection_name);
26 | return $schema->getCollection($collection_name);
27 | }
28 |
29 | function verify_default_schema($session, $expected_tables_count) {
30 | $sql_result = $session->sql('show tables')->execute();
31 | $tables_result = $sql_result->fetchAll();
32 | expect_eq(count($tables_result), $expected_tables_count);
33 | }
34 |
35 | ?>
36 |
--------------------------------------------------------------------------------
/tests/schema_validation/create_no_schema.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx schema validation no schema
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
10 |
11 | $coll = $schema->createCollection("mycollection", '{
12 | "validation": {
13 | "level": "off"
14 | }
15 | }');
16 |
17 | $coll->add('{"name": "Barbara", "city": "Katowice"}')->execute();
18 |
19 | expect_eq($coll->count(), 1);
20 |
21 |
22 |
23 | $coll2 = $schema->createCollection("mycollection2", '{
24 | "validation": {
25 | }
26 | }');
27 |
28 | $coll2->add('{"name": "Agnieszka", "city": "Zory"}')->execute();
29 |
30 | expect_eq($coll2->count(), 1);
31 |
32 | verify_expectations();
33 | print "done!\n";
34 | ?>
35 | --CLEAN--
36 |
40 | --EXPECTF--
41 | done!%A
42 |
--------------------------------------------------------------------------------
/tests/schema_validation/create_simple.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx schema validation simple
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
10 |
11 | $coll = $schema->createCollection("mycollection", '{
12 | "validation": {
13 | "level": "strict",
14 | "schema": {
15 | "id": "http://json-schema.org/geo",
16 | "description": "A geographical coordinate",
17 | "type": "object",
18 | "properties": {
19 | "latitude": {
20 | "type": "number"
21 | },
22 | "longitude": {
23 | "type": "number"
24 | }
25 | },
26 | "required": ["latitude", "longitude"]
27 | }
28 | }
29 | }');
30 |
31 | $coll->add('{"latitude": 10, "longitude": 20}')->execute();
32 |
33 | expect_eq($coll->count(), 1);
34 |
35 | verify_expectations();
36 | print "done!\n";
37 | ?>
38 | --CLEAN--
39 |
43 | --EXPECTF--
44 | done!%A
45 |
--------------------------------------------------------------------------------
/tests/schema_validation/parse_error.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx schema validation parse error
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
10 |
11 | try {
12 | $schema_validation_with_error = '{ "validation": / { "level": "off" } }';
13 | $coll = $schema->createCollection("mycollection", $schema_validation_with_error);
14 | test_step_failed();
15 | } catch(Exception $e) {
16 | echo $e->GetMessage(), "\n";
17 | test_step_ok();
18 | }
19 |
20 | $coll2 = $schema->createCollection("mycollection2", '{
21 | "validation": {
22 | "level": "strict",
23 | "schema": {
24 | "id": "http://json-schema.org/geo",
25 | "description": "A simple schema",
26 | "type": "object",
27 | "properties": {
28 | "value": {
29 | "type": "number"
30 | }
31 | }
32 | }
33 | }
34 | }');
35 |
36 | try {
37 | $schema_validation_with_error2 = '{ "validation": { "level": "off" } ! }';
38 | $schema->modifyCollection("mycollection2", $schema_validation_with_error2 );
39 | test_step_failed();
40 | } catch(Exception $e) {
41 | echo $e->GetMessage(), "\n";
42 | test_step_ok();
43 | }
44 |
45 | verify_expectations();
46 | print "done!\n";
47 | ?>
48 | --CLEAN--
49 |
53 | --EXPECTF--
54 | [10077][HY000] json parse error, code: 4
55 | [10077][HY000] json parse error, code: 4
56 | done!%A
57 |
--------------------------------------------------------------------------------
/tests/session/multiple_close.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx close session multiple times
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | close();
17 | assert_session_invalid($session0);
18 |
19 | // ----
20 |
21 | $session1 = mysql_xdevapi\getSession($connection_uri);
22 | assert_session_valid($session1);
23 |
24 | $session1->close();
25 | assert_session_invalid($session1);
26 |
27 | $session1->close();
28 | assert_session_invalid($session1);
29 |
30 | // ----
31 |
32 | $session2 = mysql_xdevapi\getSession($connection_uri);
33 | assert_session_valid($session2);
34 |
35 | $session2->close();
36 | assert_session_invalid($session2);
37 |
38 | $session2->close();
39 | assert_session_invalid($session2);
40 |
41 | $session2->close();
42 | assert_session_invalid($session2);
43 |
44 | verify_expectations();
45 | print "done!\n";
46 | ?>
47 | --CLEAN--
48 |
52 | --EXPECTF--
53 | [10056][HY000] Session closed.
54 | [10056][HY000] Session closed.
55 | [10056][HY000] Session closed.
56 | [10056][HY000] Session closed.
57 | [10056][HY000] Session closed.
58 | [10056][HY000] Session closed.
59 | done!%A
60 |
--------------------------------------------------------------------------------
/tests/session/session_utils.inc:
--------------------------------------------------------------------------------
1 | getSchema($test_schema_name);
10 | expect_true($schema->existsInDatabase());
11 | }
12 |
13 | function assert_session_valid_server_ver($session) {
14 | global $test_schema_name;
15 | $server_ver = $session->getServerVersion();
16 | expect_true(is_int($server_ver) && ($server_ver != 0));
17 | }
18 |
19 | function assert_session_invalid($session) {
20 | try {
21 | $serverVersion = $session->getServerVersion();
22 | test_step_failed('invalid session expected');
23 | } catch(Exception $e) {
24 | echo $e->getMessage(), PHP_EOL;
25 | test_step_ok();
26 | }
27 | }
28 |
29 | ?>
30 |
--------------------------------------------------------------------------------
/tests/session/simple_session_open.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx simple session test open
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 |
18 | --EXPECTF--
19 | done!%A
20 |
--------------------------------------------------------------------------------
/tests/session/simple_session_open_close.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx simple session test open close
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | close();
16 | assert_session_invalid($session);
17 |
18 | verify_expectations();
19 | print "done!\n";
20 | ?>
21 | --EXPECTF--
22 | [10056][HY000] Session closed.
23 | done!%A
24 |
--------------------------------------------------------------------------------
/tests/session/simple_session_open_verify_close.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx simple session test open verify close
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=E_ALL
6 | default_socket_timeout=4
7 | --FILE--
8 | close();
17 | assert_session_invalid($session);
18 |
19 | verify_expectations();
20 | print "done!\n";
21 | ?>
22 | --CLEAN--
23 |
27 | --EXPECTF--
28 | [10056][HY000] Session closed.
29 | done!%A
30 |
--------------------------------------------------------------------------------
/tests/session_minor_tc.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx session minor TC's
3 | --SKIPIF--
4 | --FILE--
5 | getSchema("bad");
13 |
14 | $schema = $session->getSchema($db);
15 |
16 | $svr_version = $session->getServerVersion();
17 | if(is_int($svr_version) && $svr_version != 0)
18 | $test[0] = "1";
19 |
20 | $uuid = $session->generateUUID();
21 | if(is_string($uuid) && !empty($uuid) != 0)
22 | $test[1] = "1";
23 |
24 | var_dump($session->quoteName("test test test"));
25 | var_dump($session->quoteName("x'y'z' test"));
26 | var_dump($session->quoteName(""));
27 |
28 | $session = mysql_xdevapi\getSession($connection_uri);
29 |
30 | var_dump($session->quoteName("test test test"));
31 | var_dump($session->quoteName("x'y'z' test"));
32 | var_dump($session->quoteName(""));
33 |
34 | var_dump($session->quoteName("test `test` `2`"));
35 |
36 | var_dump($test);
37 |
38 | print "done!\n";
39 | ?>
40 | --CLEAN--
41 |
45 | --EXPECTF--
46 | string(16) "`test test test`"
47 | string(13) "`x'y'z' test`"
48 | string(0) ""
49 | string(16) "`test test test`"
50 | string(13) "`x'y'z' test`"
51 | string(0) ""
52 | string(21) "`test ``test`` ``2```"
53 | string(2) "11"
54 | done!%A
55 |
--------------------------------------------------------------------------------
/tests/simple_expression.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx simple expression
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
10 | $coll = $schema->getCollection("test_collection");
11 |
12 | fill_db_collection($coll);
13 |
14 | $expression = mysql_xdevapi\Expression("[age,job]");
15 | $res = $coll->find("age > 30")->fields($expression)->limit(3)->execute();
16 | $data = $res->fetchAll();
17 |
18 | expect_eq(count($data), 3 );
19 | expect_eq($data[0]["job"][0],47);
20 | expect_eq($data[1]["job"][0],31);
21 | expect_eq($data[2]["job"][0],37);
22 |
23 | verify_expectations();
24 | print "done!\n";
25 | ?>
26 | --CLEAN--
27 |
31 | --EXPECTF--
32 | done!%A
33 |
--------------------------------------------------------------------------------
/tests/simple_ssl.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx simple SSL connection
3 | --SKIPIF--
4 | --FILE--
5 | sql("show variables like '%ssl%'")->execute();
10 | $ssl_info = $ssl_info_query->fetchAll();
11 |
12 | $mysql_datadir = get_mysql_variable($session, 'datadir');
13 |
14 | if( false == is_dir( $mysql_datadir ) ) {
15 | $mysql_datadir = __DIR__.'/ssl';
16 | }
17 |
18 |
19 | $rsa_key_path = $mysql_datadir.DIRECTORY_SEPARATOR;
20 |
21 | //Attempt a connection using these ssl settings
22 | $new_uri = $scheme.'://'.$user.':'.$passwd.'@'.$host.':'.$port.'/?';
23 | $new_uri .= 'ssl-key=' . $rsa_key_path . 'client-key.pem&';
24 | $new_uri .= 'ssl-cert=' . $rsa_key_path . 'client-cert.pem&';
25 | $new_uri .= 'ssl-ca=' . $rsa_key_path . 'ca.pem';
26 |
27 | $session = mysql_xdevapi\getSession($new_uri);
28 | $res = $session->sql('SELECT USER()')->execute();
29 | $userdata = $res->fetchOne();
30 |
31 | // FIXME:
32 | // - fails when DNS hostname is converted to IP address
33 | // - fails when test server runs inside docker
34 | // expect_eq($userdata['USER()'], $user.'@'.$host);
35 | verify_expectations();
36 | print "done!\n";
37 | ?>
38 | --CLEAN--
39 |
43 | --EXPECTF--
44 | done!%A
45 |
--------------------------------------------------------------------------------
/tests/single_doc_ops/get_one.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection single doc ops - getOne
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | getOne(0);
17 | expect_null($doc);
18 |
19 | $doc = $coll->getOne(5);
20 | verify_doc($doc, 5, "Carlo", 25, "Programmatore");
21 |
22 | $doc = $coll->getOne('31');
23 | expect_null($doc);
24 |
25 | $doc = $coll->getOne('13');
26 | verify_doc($doc, 13, "Alessandra", 15, "Barista");
27 |
28 | verify_expectations();
29 | print "done!\n";
30 | ?>
31 | --CLEAN--
32 |
36 | --EXPECTF--
37 | done!%A
38 |
--------------------------------------------------------------------------------
/tests/single_doc_ops/remove_one.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx collection single doc ops - removeOne
3 | --SKIPIF--
4 | --INI--
5 | error_reporting=0
6 | --FILE--
7 | removeOne('25');
19 | verify_result($res, '25', 1);
20 | expect_null_doc(25);
21 |
22 | $res = $coll->removeOne('25');
23 | verify_result($res, null, 0);
24 | expect_null_doc(25);
25 |
26 | expect_null_doc(1001);
27 | $res = $coll->removeOne('1001');
28 | verify_result($res, null, 0);
29 | expect_null_doc(1001);
30 |
31 | verify_expectations();
32 | print "done!\n";
33 | ?>
34 | --CLEAN--
35 |
39 | --EXPECTF--
40 | done!%A
41 |
--------------------------------------------------------------------------------
/tests/ssl/ca.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDCzCCAfOgAwIBAgIJAKXu4ZRsQLtoMA0GCSqGSIb3DQEBCwUAMBwxCzAJBgNV
3 | BAYTAlBMMQ0wCwYDVQQDDARQSFAxMB4XDTE3MTAwOTEwNTM0N1oXDTI3MDgxODEw
4 | NTM0N1owHDELMAkGA1UEBhMCUEwxDTALBgNVBAMMBFBIUDEwggEiMA0GCSqGSIb3
5 | DQEBAQUAA4IBDwAwggEKAoIBAQCvOi6PVzhCBHWbkgMoDA8SFWWw4to0g1swZPyU
6 | OrR9TlkzWE06rgkk9+aodsYSTDlpOc74IwKfu9jvR9zMUyDYWVSmsraZg1YOJ8Pi
7 | brMdNIaSm8jkPPsumlz4rEQGKLfKLWx/bZrWxi7JqkONrw4zM81qoM5FNCY9mZT8
8 | NDoR3UR1WeTkPKyX/hheeTbbc6zxaR+uUhsWAPpwX3WJeZm9PaBEKcIbCXhwObpg
9 | C+iqbnxiXCrBSVuRlnFQulJjB4nmvVwkS+sJ4nVSzCwz7aS9M5Nzf0bGZpN3nerW
10 | rubOg+bRZTErWSnHfn9wk/p3mJC/KOfOMT/heOeWFjUX13sdAgMBAAGjUDBOMB0G
11 | A1UdDgQWBBTbce1tncw0d48UP2dBNhUj0JjmQDAfBgNVHSMEGDAWgBTbce1tncw0
12 | d48UP2dBNhUj0JjmQDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCm
13 | mfhHDDJ4xNi8Tj/zLpySi9/vKzcrUYXe+wafY+VVoAkUavk+IvpH5+yP1+uupKe7
14 | QDsZ2D45Y2r4iCiIAd9CEgibyD1q84UeugIbylrcyGPSEUcnacVHex6eYF4AqPJu
15 | 8jEkfQP+GJnhXMJf7JRqR0pB+T6qjGFAj+TVsQNL3r7WStUpWo0hfaU2HQyXE3h3
16 | y1MFVf/6EsrinxjNBID4vZF0J9KgllDwhvCObr7n4FFEQTlewstSsJkFU57J9Rbk
17 | i5C8CMby2gyjVKwUUsmv7yyiY3QURtFDf1zqM0kgDSHKC/4iyeOrlXFYWGtvRAQY
18 | jWUa/X31UtmeXoD8AXxK
19 | -----END CERTIFICATE-----
20 |
--------------------------------------------------------------------------------
/tests/ssl/client-req.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICdjCCAV4CAQAwHDELMAkGA1UEBhMCUEwxDTALBgNVBAMMBFBIUDMwggEiMA0G
3 | CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCdoc6SoNMsPHu9aBN9ibOIJTwYatv8
4 | RScmOVh2a9v74v1I/5svBDPGZDa/ZOYAOgotzApUfRGsAiU2cGCbEgtwFI/k/j1/
5 | +y3OHvoIMJYKcjxTYrQjFqJ9DutkhQM6p8ZJSKz4PyWFlGBSPqdGklYovhGFzQ5n
6 | MErt3/jP7rvhtKTxd4/ElWRXMwISBFTt+ow46UqnnVgWnRpg1Y6xy+j/y8mT7KYr
7 | KOG5FYnZ67XOfclNSPtWW+YLVP00CwJVtmlQgK8FVuBCSEba2MeRbGt+NtdkDizp
8 | yxNCg7gvCfAKKsRzxXbUt3XOjXDc0zGfvC099ZhyVNOwOwgTNnJ3XRgjAgMBAAGg
9 | FTATBgkqhkiG9w0BCQcxBgwEcGFzczANBgkqhkiG9w0BAQsFAAOCAQEAThXBBqj8
10 | kdQRZIRheAyIXGe0RdrZdzbP+8MEtv0KyU9oJYZZmv33PKGN0E9NB3LNXn4lLt+f
11 | 87BLJXxyK62L6y9WWqWuSgHJMThIAKDPDZ31b96tZyBPSAnYh8t4T59/CMBpNf0o
12 | UFbyGRYH9kDIopx98HWhLPzpUvsroeTDrW/2ptLyFvqDvOO68WADErND+VrEaboG
13 | Duow/XNIPc6Ll/H7hiX1bfkzNBrvUinyxFangDOBU+Cz0rjB1QVXTOftPG2d5wzj
14 | +n/VRI+ft1CMMuWmnxLnA6SQVzjhR/VtViTPsWcSKHkXjRswqMHgJGKTGkZN2N1I
15 | Wv7U9j1zCpOJUw==
16 | -----END CERTIFICATE REQUEST-----
17 |
--------------------------------------------------------------------------------
/tests/ssl/server-req.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICdjCCAV4CAQAwHDELMAkGA1UEBhMCUEwxDTALBgNVBAMMBFBIUDIwggEiMA0G
3 | CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGePoS+KJys7WMMlQhQnp0BVFjHL0v
4 | Bnz67nBptwf8M+oUL6GUq9GLweH8RSpAXZd6syCkTOmvni+5taWhsFAeAIJFmYk2
5 | 7nqK9UNzjNNOxAgiTDb5W1dfTIhmdMMGVhYFgCBwghpMGkITwYIeS6j0994HOu18
6 | AwsQYyYEAjE5olTfdEYmGiA10yOzzPnaC1ApTU5f1rv90qLCWkXXH9gpvWLZE41T
7 | WEPpQyn/9MTuAtprWG3yvTJuGZJf1csailJpSWS6yifdQyc1zz28lGagH6AEvko7
8 | 8wf1YixNHGqDz9K7FcNWE0+VD9nxsp3X6RYxoRvBz13O4gPZx7QPdn1DAgMBAAGg
9 | FTATBgkqhkiG9w0BCQcxBgwEcGFzczANBgkqhkiG9w0BAQsFAAOCAQEAFtHAwaxm
10 | 8w5RZfrmzZN2xkfGUltgt8r4T4K+zCDgo6ThA50WHYqflNr1CoO8KrG3rTXCVd8A
11 | 6OI1vZU10AWAkgnFrRY9b4uz9XVjnF6KTm/fGqrbY4DGYedH1XAkQb1xijxHJqeL
12 | n4lXyYJ9odV4Qrfqd1HWmwB2Rcv5nrYmnColnzR22QBW6AeE+SGfPujXGpWvHGVg
13 | 2/YytJhICT6j7SERXyNfXDq84rd665lU0a2WXtdCLwgddSwR2NGSdKU58UVgx94K
14 | hKuVFDlRHAiQtDve35vIz4rkjfP76FvjR5HSASLp8z4+4sgrgc5PRROuUDyp0meZ
15 | AlAfqlfPDbiGag==
16 | -----END CERTIFICATE REQUEST-----
17 |
--------------------------------------------------------------------------------
/tests/table.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx Table
3 | --SKIPIF--
4 | --FILE--
5 | getSchema($db);
11 | $table = $schema->getTable("test_table");
12 |
13 | fill_db_table();
14 |
15 | expect_eq($table->getName(), 'test_table');
16 | expect_eq($table->name, 'test_table');
17 | expect_eq($table->count(), 12);
18 | expect_true($table->existsInDatabase());
19 |
20 | try {
21 | $schema = $table->getSchema();
22 | expect_eq($schema->getName(),$db);
23 | expect_true($schema->existsInDatabase());
24 | $table2 = $schema->getTable('test_table');
25 | expect_eq($table2->getName(),'test_table');
26 | expect_true($table2->existsInDatabase());
27 | } catch(Exception $ex) {
28 | test_step_failed();
29 | }
30 |
31 | $table = $schema->getTable("not_existing_table");
32 | expect_eq($table->getName(), 'not_existing_table');
33 | expect_eq($table->name, 'not_existing_table');
34 | expect_false($table->existsInDatabase());
35 |
36 | try {
37 | $schema = $table->count();
38 | test_step_failed();
39 | } catch(Exception $ex) {
40 | test_step_ok();
41 | }
42 |
43 | verify_expectations();
44 | print "done!\n";
45 | ?>
46 | --CLEAN--
47 |
51 | --EXPECTF--
52 | done!%A
53 |
--------------------------------------------------------------------------------
/tests/warnings.phpt:
--------------------------------------------------------------------------------
1 | --TEST--
2 | mysqlx warnings
3 | --SKIPIF--
4 | --FILE--
5 | sql("create database $db")->execute();
10 | $session->sql("create table $db.test_table(x int)")->execute();
11 |
12 | $schema = $session->getSchema($db);
13 | $table = $schema->getTable("test_table");
14 |
15 | $table->insert(['x'])->values([1])->values([2])->values([3])->execute();
16 | $res = $table->select(['x/0 as bad_x'])->execute();
17 |
18 | expect_eq($res->getWarningsCount(), 3);
19 |
20 | $warn = $res->getWarnings();
21 | for( $i = 0 ; $i < 3; $i++ ) {
22 | //expect_eq($warn[0]->message,'');
23 | expect_eq($warn[0]->level,2);
24 | expect_eq($warn[0]->code,1365);
25 | }
26 |
27 | $schema->createCollection($test_collection_name);
28 | $coll = $schema->getCollection($test_collection_name);
29 | $res = $coll->add('{"name": "Marco", "age": 19, "job": "Programmatore"}',
30 | '{"name": "Lonardo", "age": 59, "job": "Paninaro"}',
31 | '{"name": "Riccardo", "age": 27, "job": "Cantante"}',
32 | '{"name": "Carlotta", "age": 23, "job": "Programmatrice"}')->execute();
33 | expect_eq($res->getWarningsCount(), 0);
34 | expect_eq($res->getWarnings(), []);
35 |
36 | verify_expectations();
37 | print "done!\n";
38 | ?>
39 | --CLEAN--
40 |
44 | --EXPECTF--
45 | done!%A
46 |
--------------------------------------------------------------------------------
/xmysqlnd/cdkbase/include/mysql/cdk/config.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | */
16 |
17 | #ifndef CDK_CONFIG_H
18 | #define CDK_CONFIG_H
19 |
20 |
21 | #define HAVE_MOVE_SEMANTICS
22 | #define HAVE_STATIC_ASSERT
23 | /* #undef HAVE_IS_SAME */
24 | #define HAVE_SHARED_PTR
25 | #define HAVE_SYSTEM_ERROR
26 | //#define HAVE_CODECVT_UTF8
27 | /* #undef HAVE_ENDIAN_H */
28 | /* #undef HAVE_BYTEORDER_H */
29 | #define CDK_BIG_ENDIAN 0
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/xmysqlnd/cdkbase/include/mysql/cdk/mysqlx.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | */
16 |
17 | #ifndef CDK_MYSQLX_H
18 | #define CDK_MYSQLX_H
19 |
20 | #include "mysqlx/session.h"
21 | #include "mysqlx/result.h"
22 |
23 | namespace cdk {
24 |
25 | using mysqlx::server_error_category;
26 | using mysqlx::server_error;
27 |
28 | }
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/xmysqlnd/crud_parsers/compilerutils.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Oracle Corp |
16 | +----------------------------------------------------------------------+
17 | */
18 |
19 | #ifndef COMPILERUTILS_H
20 | #define COMPILERUTILS_H
21 |
22 | #ifdef UNUSED
23 | # elif defined(__GNUC__)
24 | # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
25 | # elif defined(__LCLINT__)
26 | # define UNUSED(x) /*@unused@*/ x
27 | # elif defined(__cplusplus)
28 | # define UNUSED(x)
29 | # else
30 | # define UNUSED(x) x
31 | #endif
32 |
33 | #endif /* COMPILERUTILS_H */
34 |
--------------------------------------------------------------------------------
/xmysqlnd/proto_gen/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/php/pecl-database-mysql_xdevapi/41f52fbca6acce68780b66efca4a75815b548661/xmysqlnd/proto_gen/.keep
--------------------------------------------------------------------------------
/xmysqlnd/xmysqlnd_compressor.cc:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Darek Slusarczyk |
16 | +----------------------------------------------------------------------+
17 | */
18 | #include "xmysqlnd_compressor.h"
19 |
--------------------------------------------------------------------------------
/xmysqlnd/xmysqlnd_compressor_lz4.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Darek Slusarczyk |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef XMYSQLND_COMPRESSOR_LZ4_H
19 | #define XMYSQLND_COMPRESSOR_LZ4_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace drv {
24 |
25 | namespace compression {
26 |
27 | bool is_compressor_lz4_available();
28 |
29 | struct Compressor;
30 | Compressor* create_compressor_lz4();
31 |
32 | } // namespace compression
33 |
34 | } // namespace drv
35 |
36 | } // namespace mysqlx
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/xmysqlnd/xmysqlnd_compressor_zlib.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Darek Slusarczyk |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef XMYSQLND_COMPRESSOR_ZLIB_H
19 | #define XMYSQLND_COMPRESSOR_ZLIB_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace drv {
24 |
25 | namespace compression {
26 |
27 | bool is_compressor_zlib_available();
28 |
29 | struct Compressor;
30 | Compressor* create_compressor_zlib();
31 |
32 | } // namespace compression
33 |
34 | } // namespace drv
35 |
36 | } // namespace mysqlx
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/xmysqlnd/xmysqlnd_compressor_zstd.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Darek Slusarczyk |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef XMYSQLND_COMPRESSOR_ZSTD_H
19 | #define XMYSQLND_COMPRESSOR_ZSTD_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace drv {
24 |
25 | namespace compression {
26 |
27 | bool is_compressor_zstd_available();
28 |
29 | struct Compressor;
30 | Compressor* create_compressor_zstd();
31 |
32 | } // namespace compression
33 |
34 | } // namespace drv
35 |
36 | } // namespace mysqlx
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/xmysqlnd/xmysqlnd_crud_commands.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef XMYSQLND_CRUD_COMMANDS_H
19 | #define XMYSQLND_CRUD_COMMANDS_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace drv {
24 |
25 | struct st_xmysqlnd_pb_message_shell
26 | {
27 | void * message;
28 | unsigned int command;
29 | };
30 |
31 | struct st_xmysqlnd_expression_shell
32 | {
33 | void * expr;
34 | };
35 |
36 | } // namespace drv
37 |
38 | } // namespace mysqlx
39 |
40 | #endif /* XMYSQLND_CRUD_COMMANDS_H */
41 |
--------------------------------------------------------------------------------
/xmysqlnd/xmysqlnd_structs.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 7 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Authors: Andrey Hristov |
16 | +----------------------------------------------------------------------+
17 | */
18 | #ifndef XMYSQLND_STRUCTS_H
19 | #define XMYSQLND_STRUCTS_H
20 |
21 | namespace mysqlx {
22 |
23 | namespace drv {
24 |
25 | struct st_collection_op_var_binder_ctx
26 | {
27 | util::string_view schema_name;
28 | util::string_view collection_name;
29 | util::string_view collection_options;
30 | };
31 |
32 | } // namespace drv
33 |
34 | } // namespace mysqlx
35 |
36 | #endif /* XMYSQLND_STRUCTS_H */
37 |
--------------------------------------------------------------------------------