config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/t/admin_ensure_collection.test

## Admin command: ensure_collection

--source ../include/xplugin_preamble.inc

CREATE SCHEMA xtest DEFAULT CHARSET 'utf8mb4';

## Test starts here
--let $xtest_file= $MYSQL_TMP_DIR/admin_ensure_collection.tmp
--write_file $xtest_file
-->quiet

-->macro Make_stmt  %CMD%  %SCHEMA%
Mysqlx.Sql.StmtExecute {
  stmt: "%CMD%"
  args {
	%SCHEMA%
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "books"
      }
    }
  }
  namespace: "xplugin"
}
-->endmacro


-->macro Make_collection_with_schema  %CMD%  %SCHEMA%  %ERROR%
-->callmacro Make_stmt	%CMD%	type: SCALAR scalar { type: V_STRING v_string { value: "%SCHEMA%" } }
-->expecterror %ERROR%
-->recvresult
-->stmtsql SHOW TABLES FROM xtest;
-->recvresult
-->endmacro


-->macro Make_collection_without_schema  %CMD%  %ERROR%
-->callmacro Make_stmt	%CMD%	type: SCALAR scalar { type: V_NULL }
-->expecterror %ERROR%
-->recvresult
-->stmtsql SHOW TABLES FROM xtest;
-->recvresult
-->endmacro


-->macro Make_collection  %CMD%  %ERROR%
-->callmacro Make_collection_with_schema	%CMD%	xtest	%ERROR%
-->endmacro


-->macro Make_table  %DEF%  %TEMP%
-->sql
CREATE %TEMP% TABLE xtest.books %DEF%;
-->endsql
-->endmacro


-->macro Drop_table
-->sql
DROP TABLE xtest.books;
-->endsql
-->endmacro


-->macro Make_index  %NAME%  %TYPE%
Mysqlx.Sql.StmtExecute {
  stmt: "create_collection_index"
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "xtest"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "books"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "%NAME%"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_BOOL
      v_bool: true
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "$.%NAME%"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "%TYPE%"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_BOOL
      v_bool: false
    }
  }
  namespace: "xplugin"
}
-->recvresult
-->endmacro


-->callmacro Make_collection	create_collection	0
-->callmacro Make_collection	create_collection	1050
-->callmacro Make_collection	ensure_collection	0

-->callmacro Make_index	isbn	TEXT(13)
-->callmacro Make_collection	ensure_collection	0

-->callmacro Make_index	pages	INT
-->callmacro Make_collection	ensure_collection	0

-->sql
ALTER TABLE xtest.books ADD COLUMN (nothing INT)
-->endsql
-->callmacro Make_collection	ensure_collection	5156

-->callmacro Drop_table
-->callmacro Make_collection	ensure_collection	0

-->callmacro Drop_table
-->callmacro Make_collection	create_collection	0

-->sql
ALTER TABLE xtest.books DROP _id
-->endsql
-->callmacro Make_collection	ensure_collection	5156


-->callmacro Drop_table
-->callmacro Make_table	(doc JSON, _id VARCHAR(32))	 
-->callmacro Make_collection	ensure_collection	5156

-->callmacro Drop_table
-->callmacro Make_table	(doc INT, _id VARCHAR(32))	 
-->callmacro Make_collection	ensure_collection	5156

-->callmacro Drop_table
-->callmacro Make_table	(doc JSON, _id INT)	 
-->callmacro Make_collection	ensure_collection	5156


-->callmacro Make_collection_with_schema	ensure_collection	nowhere	1049

-->callmacro Drop_table
-->callmacro Make_collection_without_schema	ensure_collection	1046

-->stmtsql USE xtest
-->recvresult

-->callmacro Make_collection_without_schema	ensure_collection	 0



-->callmacro Drop_table
-->newsession temp
-->callmacro Make_table	(it_is_not_collection INT)	TEMPORARY
-->callmacro Make_collection	ensure_collection	 0
-->stmtsql SHOW COLUMNS FROM xtest.books
-->recvresult
-->closesession
-->stmtsql SHOW COLUMNS FROM xtest.books
-->recvresult


-->callmacro Drop_table
-->sql
CREATE USER unpriv;
SET PASSWORD FOR unpriv = PASSWORD('x');
GRANT SELECT ON xtest.* TO unpriv;
-->endsql
-->newsession unable_to_create	unpriv	x
-->callmacro Make_collection	ensure_collection	1142
-->closesession
-->stmtsql DROP USER unpriv;
-->recvresult


-->callmacro Make_table	(it_is_not_collection INT)	 
-->stmtsql LOCK TABLE xtest.books WRITE;
-->recvresult
-->newsession lock
-->callmacro Make_collection	ensure_collection	5156
-->closesession
-->stmtsql UNLOCK TABLES
-->recvresult
EOF


--exec $MYSQLXTEST -uroot --password='' --file=$xtest_file 2>&1
--remove_file $xtest_file

SHOW STATUS like 'Mysqlx_stmt_create_collection';
SHOW STATUS like 'Mysqlx_stmt_ensure_collection';

## Postamble
DROP SCHEMA IF EXISTS xtest;
UNINSTALL PLUGIN mysqlx;

Man Man