Instance

An awSQL-Instance

Constructor

new Instance()

Methods

alterTable(name) → {AlterTable}

Alters a table and updates to the new given structure.
Parameters:
NameTypeDescription
nameString
Returns:
Type: 
AlterTable

(async) checkStructure(table, desiredStructure, databaseopt) → {CheckResult}

Checks the structure of a table
Parameters:
NameTypeAttributesDescription
tableStringName of the table
desiredStructureStructureStructure to check against
databaseString<optional>
Name of the database. If omitted, uses default database
Returns:
Type: 
CheckResult

connect() → {undefined}

Connects the instance
Returns:
Type: 
undefined

(async) createDatabase(name) → {Any}

Creates a new database - Requires admin privileges
Parameters:
NameTypeDescription
nameStringName of the database to create
Returns:
Type: 
Any

createStructure() → {Structure}

Prepares to create a new table-structure
Returns:
Type: 
Structure

createTable(name) → {CreateTable}

Prepares to create a new table
Parameters:
NameTypeDescription
nameStringName of the table to create
Returns:
Type: 
CreateTable

delete(from) → {Delete}

Prepares a new delete query
Parameters:
NameTypeDescription
fromStringName of the table to delete from
Returns:
Type: 
Delete

destroy() → {true}

Destroys the instance
Returns:
Type: 
true

(async) dropDatabase(database) → {Any}

Drops a whole database - Requires admin privileges
Parameters:
NameTypeDescription
databaseStringName of the database to drop
Returns:
Type: 
Any

(async) dropTable(table) → {Any}

Drops a whole table
Parameters:
NameTypeDescription
tableStringName of the table to drop
Returns:
Type: 
Any

(async) getDatabases(excludeSchema) → {Array.<String>}

Returns a list of database names the user has access to
Parameters:
NameTypeDefaultDescription
excludeSchemaBooleanfalseWhether to exclude the default database 'information_schema'
Returns:
Type: 
Array.<String>

(async) getStructure(table, databaseopt) → {Structure}

Returns the structure object of a table
Parameters:
NameTypeAttributesDescription
tableStringName of table to get structure of
databaseString<optional>
Name of the underlying database
Returns:
Type: 
Structure

(async) getTables(databaseopt) → {Array}

Returns a list of tables for the selected database - 'multipleStatements' must be active for this to work
Parameters:
NameTypeAttributesDescription
databaseString<optional>
Database to select. Can be empty as long as a default database was set with 'selectDatabase'
Returns:
Type: 
Array

insert(into) → {Insert}

Prepares a new query to insert data
Parameters:
NameTypeDescription
intoStringName of the table to insert into
Returns:
Type: 
Insert

isConnected() → {Boolean}

Returns if connection is established
Returns:
Type: 
Boolean

queryRaw(queryString, values) → {Any}

Performs a raw query
Parameters:
NameTypeDescription
queryStringStringThe sql query string to perform.
valuesArray.<Any>An array holding all replacable ?-values from left to right.
Returns:
- The individual result of your query
Type: 
Any

select(from, …columnsopt) → {Select}

Prepares a new select query
Parameters:
NameTypeAttributesDescription
fromStringName of the table
columnsString<optional>
<repeatable>
Name of columns to select. Leave empty to select all
Returns:
Type: 
Select

selectDatabase(name) → {this}

Selects a default database for future queries
Parameters:
NameTypeDescription
nameStringName of the database
Returns:
Type: 
this

(async) total(table) → {Any}

Returns total amount of rows of a table
Parameters:
NameTypeDescription
tableStringTable name
Returns:
Type: 
Any

update(table) → {Update}

Prepares a new update query
Parameters:
NameTypeDescription
tableStringName of the table to update data in
Returns:
Type: 
Update