Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Assumptions: ensure_schema_does_not_exist
// Assumes __uripwd is defined as :@:
var mysql = require('mysql');
var mySession = mysql.getClassicSession(__uripwd);
mySession.runSql('drop schema if exists js_shell_test');
mySession.runSql('create schema js_shell_test');
mySession.runSql('use js_shell_test');
//@<> Result member validation
var result = mySession.runSql('create table js_shell_test.buffer_table (name varchar(50) primary key, age integer, gender varchar(20))');
validateMembers(result, [
'affectedItemsCount',
'executionTime',
'warningCount',
'warnings',
'warningsCount',
'getAffectedItemsCount',
'getExecutionTime',
// __uri: @
// __host:
// __port:
// __user:
// __uripwd: :@
// __pwd:
//@<> mysql module: exports
validateMembers(mysql, [
'getClassicSession',
'getSession',
'help'])
//@# getClassicSession errors
mysql.getClassicSession()
mysql.getClassicSession(1, 2, 3)
mysql.getClassicSession(["bla"])
mysql.getClassicSession("some@uri", 25)
//@# getSession errors
mysql.getSession()
mysql.getSession(1, 2, 3)
mysql.getSession(["bla"])
mysql.getSession("some@uri", 25)
// Assumptions: ensure_schema_does_not_exist available
// Assumes __uripwd is defined as :@:
var mysql = require('mysql');
var mySession = mysql.getClassicSession(__uripwd);
ensure_schema_does_not_exist(mySession, 'js_shell_test');
mySession.createSchema('js_shell_test');
mySession.setCurrentSchema('js_shell_test');
var result;
result = mySession.runSql('create table table1 (name varchar(50));');
result = mySession.runSql('create view view1 (my_name) as select name from table1;');
var schema = mySession.getSchema('js_shell_test');
// We need to know the lower_case_table_names option to
// properly handle the table shadowing unit tests
var lcresult = mySession.runSql('select @@lower_case_table_names')
var lcrow = lcresult.fetchOne();
// __port:
// __user:
// __uripwd: :@
// __pwd:
//@<> mysql module: exports
validateMembers(mysql, [
'getClassicSession',
'getSession',
'help'])
//@# getClassicSession errors
mysql.getClassicSession()
mysql.getClassicSession(1, 2, 3)
mysql.getClassicSession(["bla"])
mysql.getClassicSession("some@uri", 25)
//@# getSession errors
mysql.getSession()
mysql.getSession(1, 2, 3)
mysql.getSession(["bla"])
mysql.getSession("some@uri", 25)
// Assumptions: ensure_schema_does_not_exist is available
// Assumes __uripwd is defined as :@:
var mysql = require('mysql');
//@<> Session: validating members
var classicSession = mysql.getClassicSession(__uripwd);
validateMembers(classicSession, [
'close',
'commit',
'getUri',
'help',
'isOpen',
'startTransaction',
'query',
'rollback',
'runSql',
'uri'])
//@ ClassicSession: accessing Schemas
var schemas = classicSession.getSchemas();
function check_super_read_only_done(connection) {
ro_session = ro_module.getClassicSession(connection);
wait(60, 1, wait_super_read_only_done);
ro_session.close();
}
function setupInstance(connection, super_read_only) {
var tmpSession = mysql.getClassicSession(connection);
tmpSession.runSql('SET GLOBAL super_read_only = 0');
if (super_read_only) {
tmpSession.runSql('set global super_read_only=ON');
}
tmpSession.close();
}
function ensureSuperReadOnly(connection) {
var tmpSession = mysql.getClassicSession(connection);
tmpSession.runSql('set global super_read_only=ON');
tmpSession.close();
}