[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=31=39=34=39=3A?= =?UTF-8?Q?=20g
From:       hery ramilison <mysqlre () php ! net>
Date:       2018-04-23 21:05:40
Message-ID: php-mail-ee412d936dbe734a8a1f30b66d7799011728863018 () git ! php ! net
[Download RAW message or body]

Commit:    13a36cdd6337931d604f9fd2ba3a90ff87317fb3
Author:    Darek Slusarczyk <dariusz.slusarczyk@oracle.com>         Mon, 23 Apr 2018 \
                23:05:40 +0200
Parents:   3e81752b87ee0c7a0423e9d2f933191a16d04c50
Branches:  master

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


Log:
WL#11949: getSchema superfluous param
- fix arglists, handler and tests

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

Changed paths:
  M  mysqlx_collection.cc
  M  mysqlx_table.cc
  M  tests/collection.phpt
  M  tests/table.phpt


Diff:
diff --git a/mysqlx_collection.cc b/mysqlx_collection.cc
index 015979a..c8f756f 100644
--- a/mysqlx_collection.cc
+++ b/mysqlx_collection.cc
@@ -297,17 +297,15 @@ MYSQL_XDEVAPI_PHP_METHOD(mysqlx_collection, getSchema)
 {
 	st_mysqlx_collection* object{nullptr};
 	XMYSQLND_SESSION session;
-	MYSQLND_CSTRING schema_name = {nullptr, 0};
 	zval* object_zv{nullptr};
 
 	DBG_ENTER("mysqlx_collection::getSchema");
 
 	if (FAILURE == zend_parse_method_parameters(
 				ZEND_NUM_ARGS(),
-				getThis(), "Os",
+				getThis(), "O",
 				&object_zv,
-				mysqlx_collection_class_entry,
-				&(schema_name.s), &(schema_name.l))) {
+				mysqlx_collection_class_entry)) {
 		DBG_VOID_RETURN;
 	}
 
@@ -322,8 +320,9 @@ MYSQL_XDEVAPI_PHP_METHOD(mysqlx_collection, getSchema)
 	}
 
 	if(session != nullptr) {
+		MYSQLND_STRING& schema_name{ object->collection->data->schema->data->schema_name \
};  XMYSQLND_SCHEMA * schema = session->m->create_schema_object(
-					session, schema_name);
+					session, mnd_str2c(schema_name));
 		if (schema) {
 			mysqlx_new_schema(return_value, schema);
 		} else {
diff --git a/mysqlx_table.cc b/mysqlx_table.cc
index 54c2080..03789d1 100644
--- a/mysqlx_table.cc
+++ b/mysqlx_table.cc
@@ -286,17 +286,15 @@ MYSQL_XDEVAPI_PHP_METHOD(mysqlx_table, getSchema)
 {
 	st_mysqlx_table* object{nullptr};
 	XMYSQLND_SESSION session;
-	MYSQLND_CSTRING schema_name{nullptr, 0};
 	zval* object_zv{nullptr};
 
 	DBG_ENTER("mysqlx_collection::getSchema");
 
 	if (FAILURE == zend_parse_method_parameters(
 				ZEND_NUM_ARGS(),
-				getThis(), "Os",
+				getThis(), "O",
 				&object_zv,
-				mysqlx_table_class_entry,
-				&(schema_name.s), &(schema_name.l))) {
+				mysqlx_table_class_entry)) {
 		DBG_VOID_RETURN;
 	}
 
@@ -311,8 +309,9 @@ MYSQL_XDEVAPI_PHP_METHOD(mysqlx_table, getSchema)
 	}
 
 	if(session != nullptr) {
+		MYSQLND_STRING& schema_name{ object->table->data->schema->data->schema_name };
 		XMYSQLND_SCHEMA * schema = session->m->create_schema_object(
-					session, schema_name);
+					session, mnd_str2c(schema_name));
 		if (schema) {
 			mysqlx_new_schema(return_value, schema);
 		} else {
diff --git a/tests/collection.phpt b/tests/collection.phpt
index f5abf07..6e057b2 100644
--- a/tests/collection.phpt
+++ b/tests/collection.phpt
@@ -17,7 +17,7 @@ mysqlx Collection
 	expect_eq($coll->count(), 16);
 
 	try {
-	        $schema = $coll->getSchema($db);
+		$schema = $coll->getSchema();
 		expect_eq($schema->getName(),$db);
 		expect_true($schema->existsInDatabase());
 		$coll2 = $schema->getCollection('test_collection');
diff --git a/tests/table.phpt b/tests/table.phpt
index b7e2825..5712a71 100644
--- a/tests/table.phpt
+++ b/tests/table.phpt
@@ -17,8 +17,8 @@ mysqlx Table
 	expect_eq($table->count(), 12);
 	expect_true($table->existsInDatabase());
 
-        try {
-	        $schema = $table->getSchema($db);
+	try {
+		$schema = $table->getSchema();
 		expect_eq($schema->getName(),$db);
 		expect_true($schema->existsInDatabase());
 		$table2 = $schema->getTable('test_table');


--
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