[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] com =?UTF-8?Q?pecl/database/mysql=5Fxdevapi=3A=20WL=23=31=33=35=34=31=3A?= =?UTF-8?Q?=20F
From:       hery ramilison <mysqlre () php ! net>
Date:       2019-11-05 19:42:03
Message-ID: php-mail-28c1e7a83357f3b2ff9a7ccb843dd5402001404535 () git ! php ! net
[Download RAW message or body]

Commit:    8f88ed65a8e0cc62d8f2922508988213280c450c
Author:    Darek Slusarczyk <dariusz.slusarczyk@oracle.com>         Tue, 5 Nov 2019 \
                20:31:56 +0100
Parents:   3f123457397d8261fb91ed665e4d58013ce530fd
Branches:  master

Link:       http://git.php.net/?p=pecl/database/mysql_xdevapi.git;a=commitdiff;h=8f88ed65a8e0cc62d8f2922508988213280c450c


Log:
WL#13541: Fix admin command namespace usage
- remove calls to commands from obsolete xplugin namespace
- fix Schema.getTables
- fix crash in on_error handler for Schema.getTables

Bugs:
https://bugs.php.net/13541

Changed paths:
  M  tests/schema.phpt
  M  xmysqlnd/xmysqlnd_collection.cc
  M  xmysqlnd/xmysqlnd_schema.cc
  M  xmysqlnd/xmysqlnd_session.cc
  M  xmysqlnd/xmysqlnd_table.cc


Diff:
diff --git a/tests/schema.phpt b/tests/schema.phpt
index 2e29420..18370ca 100644
--- a/tests/schema.phpt
+++ b/tests/schema.phpt
@@ -18,14 +18,13 @@ mysqlx Schema
 	expect_eq($coll_as_table->getName(), 'test_collection');
 	expect_eq($coll_as_table->name, 'test_collection');
 	expect_eq($coll_as_table->count(), 16);
-/*
+
 	try {
-		//This is not implemented yet
-		$session = $schema->getSession();
+		$session2 = $schema->getSession();
 	} catch(Exception $e) {
 		test_step_failed();
 	}
-*/
+
 	$res = $coll_as_table->select(['doc','_id'])->execute()->fetchAll();
 	expect_eq(count($res), 16);
 
diff --git a/xmysqlnd/xmysqlnd_collection.cc b/xmysqlnd/xmysqlnd_collection.cc
index 2d67162..e002bca 100644
--- a/xmysqlnd/xmysqlnd_collection.cc
+++ b/xmysqlnd/xmysqlnd_collection.cc
@@ -71,15 +71,14 @@ static const enum_hnd_func_status collection_op_var_binder(
 
 	Mysqlx::Sql::StmtExecute& stmt_message = \
xmysqlnd_stmt_execute__get_pb_msg(stmt_execute);  
-	util::pb::Object* idx_obj{util::pb::add_object_arg(stmt_message)};
+	util::pb::Object* stmt_obj{util::pb::add_object_arg(stmt_message)};
 
-	util::pb::add_field_to_object("schema", ctx->schema_name, idx_obj);
-	util::pb::add_field_to_object("pattern", ctx->collection_name, idx_obj);
+	util::pb::add_field_to_object("schema", ctx->schema_name, stmt_obj);
+	util::pb::add_field_to_object("pattern", ctx->collection_name, stmt_obj);
 
 	DBG_RETURN(HND_PASS);
 }
 
-
 struct collection_exists_in_database_ctx
 {
 	const MYSQLND_CSTRING expected_collection_name;
diff --git a/xmysqlnd/xmysqlnd_schema.cc b/xmysqlnd/xmysqlnd_schema.cc
index 6ace2b6..dcfca9b 100644
--- a/xmysqlnd/xmysqlnd_schema.cc
+++ b/xmysqlnd/xmysqlnd_schema.cc
@@ -256,10 +256,10 @@ static const enum_hnd_func_status schema_op_var_binder(void * \
context,  
 	Mysqlx::Sql::StmtExecute& stmt_message = \
xmysqlnd_stmt_execute__get_pb_msg(stmt_execute);  
-	util::pb::Object* idx_obj{util::pb::add_object_arg(stmt_message)};
+	util::pb::Object* stmt_obj{util::pb::add_object_arg(stmt_message)};
 
-	util::pb::add_field_to_object("schema", ctx->schema_name, idx_obj);
-	util::pb::add_field_to_object("name", ctx->collection_name, idx_obj);
+	util::pb::add_field_to_object("schema", ctx->schema_name, stmt_obj);
+	util::pb::add_field_to_object("name", ctx->collection_name, stmt_obj);
 
 	DBG_RETURN(HND_PASS);
 }
@@ -425,39 +425,22 @@ struct st_collection_get_objects_var_binder_ctx
 
 
 static const enum_hnd_func_status
-collection_get_objects_var_binder(void * context, XMYSQLND_SESSION session, \
XMYSQLND_STMT_OP__EXECUTE * const stmt_execute) +collection_get_objects_var_binder(
+	void* context,
+	XMYSQLND_SESSION session,
+	XMYSQLND_STMT_OP__EXECUTE* const stmt_execute)
 {
-	enum_hnd_func_status ret{HND_FAIL};
-	st_collection_get_objects_var_binder_ctx* ctx = \
                (st_collection_get_objects_var_binder_ctx*) context;
-	const MYSQLND_CSTRING* param{nullptr};
 	DBG_ENTER("collection_get_objects_var_binder");
-	DBG_INF_FMT("counter=%d", ctx->counter);
-	switch (ctx->counter) {
-		case 0:
-			param = &ctx->schema_name;
-			ret = HND_PASS;
-			{
-				enum_func_status result;
-				zval zv;
-				ZVAL_UNDEF(&zv);
-				ZVAL_STRINGL(&zv, param->s, param->l);
-				DBG_INF_FMT("[%d]=[%*s]", ctx->counter, param->l, param->s);
+	st_collection_get_objects_var_binder_ctx* ctx
+		= static_cast<st_collection_get_objects_var_binder_ctx*>(context);
 
-				result = xmysqlnd_stmt_execute__bind_one_param(stmt_execute, ctx->counter, &zv);
+	Mysqlx::Sql::StmtExecute& stmt_message = \
xmysqlnd_stmt_execute__get_pb_msg(stmt_execute);  
-//				result = stmt->m.bind_one_stmt_param(stmt, ctx->counter, &zv);
+	util::pb::Object* stmt_obj{util::pb::add_object_arg(stmt_message)};
 
-				zval_ptr_dtor(&zv);
-				if (FAIL == result) {
-					ret = HND_FAIL;
-				}
-			}
-			break;
-		default: /* should not happen */
-			break;
-	}
-	++ctx->counter;
-	DBG_RETURN(ret);
+	util::pb::add_field_to_object("schema", ctx->schema_name, stmt_obj);
+
+	DBG_RETURN(HND_PASS);
 }
 
 } // anonymous namespace
@@ -478,10 +461,13 @@ xmysqlnd_schema::get_db_objects(
 	};
 	const struct st_xmysqlnd_session_query_bind_variable_bind var_binder = { \
collection_get_objects_var_binder, &var_binder_ctx };  
-	xmysqlnd_schema_get_db_objects_ctx handler_ctx = { this, object_type_filter, \
on_object, handler_on_error }; +	xmysqlnd_schema_get_db_objects_ctx handler_ctx{ \
this, object_type_filter, on_object, handler_on_error }; \
+	st_create_collection_handler_ctx error_handler_ctx{ this, handler_on_error };  
-	const struct st_xmysqlnd_session_on_row_bind on_row = { on_object.handler? \
                get_db_objects_on_row : nullptr, &handler_ctx };
-	const struct st_xmysqlnd_session_on_error_bind on_error = { \
handler_on_error.handler? collection_op_handler_on_error : nullptr, &handler_ctx }; \
+	const st_xmysqlnd_session_on_row_bind on_row{ +		on_object.handler? \
get_db_objects_on_row : nullptr, &handler_ctx }; +	const \
st_xmysqlnd_session_on_error_bind on_error{ +		handler_on_error.handler? \
collection_op_handler_on_error : nullptr, &error_handler_ctx };  
 	DBG_ENTER("xmysqlnd_schema::get_db_objects");
 
diff --git a/xmysqlnd/xmysqlnd_session.cc b/xmysqlnd/xmysqlnd_session.cc
index 33d2261..20a80f8 100644
--- a/xmysqlnd/xmysqlnd_session.cc
+++ b/xmysqlnd/xmysqlnd_session.cc
@@ -2191,7 +2191,7 @@ xmysqlnd_session::query_cb(			const MYSQLND_CSTRING namespace_,
 		xmysqlnd_stmt_execute__get_protobuf_message(stmt_execute),
 		data->stats, data->error_info))))
 		{
-			struct st_xmysqlnd_query_cb_ctx query_cb_ctx = {
+			st_xmysqlnd_query_cb_ctx query_cb_ctx{
 				session_handle,
 				handler_on_result_start,
 				handler_on_row,
@@ -2200,27 +2200,27 @@ xmysqlnd_session::query_cb(			const MYSQLND_CSTRING \
namespace_,  handler_on_result_end,
 				handler_on_statement_ok
 			};
-			const struct st_xmysqlnd_stmt_on_row_bind on_row = {
+			const st_xmysqlnd_stmt_on_row_bind on_row{
 				handler_on_row.handler? query_cb_handler_on_row : nullptr,
 				&query_cb_ctx
 			};
-			const struct st_xmysqlnd_stmt_on_warning_bind on_warning = {
+			const st_xmysqlnd_stmt_on_warning_bind on_warning{
 				handler_on_warning.handler? query_cb_handler_on_warning : nullptr,
 				&query_cb_ctx
 			};
-			const struct st_xmysqlnd_stmt_on_error_bind on_error = {
+			const st_xmysqlnd_stmt_on_error_bind on_error{
 				handler_on_error.handler? query_cb_handler_on_error : nullptr,
 				&query_cb_ctx
 			};
-			const struct st_xmysqlnd_stmt_on_result_start_bind on_result_start = {
+			const st_xmysqlnd_stmt_on_result_start_bind on_result_start{
 				handler_on_result_start.handler? query_cb_handler_on_result_start : nullptr,
 				&query_cb_ctx
 			};
-			const struct st_xmysqlnd_stmt_on_result_end_bind on_result_end = {
+			const st_xmysqlnd_stmt_on_result_end_bind on_result_end{
 				handler_on_result_end.handler? query_cb_handler_on_result_end : nullptr,
 				&query_cb_ctx
 			};
-			const struct st_xmysqlnd_stmt_on_statement_ok_bind on_statement_ok = {
+			const st_xmysqlnd_stmt_on_statement_ok_bind on_statement_ok{
 				handler_on_statement_ok.handler? query_cb_handler_on_statement_ok : nullptr,
 				&query_cb_ctx
 			};
diff --git a/xmysqlnd/xmysqlnd_table.cc b/xmysqlnd/xmysqlnd_table.cc
index 28a0183..2b03d40 100644
--- a/xmysqlnd/xmysqlnd_table.cc
+++ b/xmysqlnd/xmysqlnd_table.cc
@@ -72,10 +72,10 @@ static const enum_hnd_func_status table_op_var_binder(
 
 	Mysqlx::Sql::StmtExecute& stmt_message = \
xmysqlnd_stmt_execute__get_pb_msg(stmt_execute);  
-	util::pb::Object* idx_obj{util::pb::add_object_arg(stmt_message)};
+	util::pb::Object* stmt_obj{util::pb::add_object_arg(stmt_message)};
 
-	util::pb::add_field_to_object("schema", ctx->schema_name, idx_obj);
-	util::pb::add_field_to_object("pattern", ctx->table_name, idx_obj);
+	util::pb::add_field_to_object("schema", ctx->schema_name, stmt_obj);
+	util::pb::add_field_to_object("pattern", ctx->table_name, stmt_obj);
 
 	DBG_RETURN(HND_PASS);
 }


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic