MySQL Shell API 9.0.0
Unified development interface for MySQL Products
|
Modules | |
mysql | |
Encloses the functions and classes available to interact with a MySQL Server using the traditional MySQL Protocol. | |
util | |
Global object that groups miscellaneous tools like upgrade checker and JSON import. | |
Classes | |
class | DatabaseObject |
Provides base functionality for database objects. More... | |
class | Column |
Represents the a Column definition on a result. More... | |
class | Row |
Represents the a Row in a Result. More... | |
class | ClassicResult |
Allows browsing through the result information after performing an operation on the database through the MySQL Protocol. More... | |
class | ClassicSession |
Enables interaction with a MySQL Server using the MySQL Protocol. More... | |
class | Os |
Gives access to functions which allow to interact with the operating system. More... | |
class | Path |
Gives access to path-related functions. More... | |
class | Shell |
Gives access to general purpose functions and properties. More... | |
class | Options |
class | Reports |
Gives access to built-in and user-defined reports. More... | |
class | ShellResult |
Encapsulates custom query result and metadata. More... | |
class | Sys |
Gives access to system specific parameters. More... | |
Functions | |
Array | dir (Object object) |
Returns a list of enumerable properties on the target object. More... | |
Any | require (String module_name_or_path) |
Loads the specified JavaScript module. More... | |
Shell API and backward compatibility API for MySQL Servers not supporting the X DevAPI.
Array dir | ( | Object | object | ) |
Returns a list of enumerable properties on the target object.
object | The object whose properties will be listed. |
Traverses the object retrieving its enumerable properties. The content of the returned list will depend on the object:
Behavior of the function passing other types of objects is undefined and also unsupported.
Any require | ( | String | module_name_or_path | ) |
Loads the specified JavaScript module.
module_name_or_path | The name or a path to the module to be loaded. |
The module_name_or_path parameter can be either a name of the built-in module (i.e. mysql or mysqlx) or a path to the JavaScript module on the local file system. The local module is searched for in the following folders:
The file containing the module to be loaded is located by iterating through these folders, for each folder path:
The loaded module has access to the following variables:
Each module is loaded only once, any subsequent call to require() which would use the same module will return a cached value instead.
If two modules form a cycle (try to load each other using the require() function), one of them is going to receive an unfinished copy of the other ones exports object.
Here is a sample module called test.js which stores some data in the module object and exports a function callme():
If placed in the current working directory, it can be used in shell as follows:
TypeError | in the following scenarios:
|
Error | in the following scenarios:
|