Class Index | File Index

## Classes

- _Association
- _global_
- Dataset
- ManyToMany
- ManyToOne
- MayToOne
- Migrations
- Model
- moose
- moose.adapters
- moose.adapters.client.Client
- moose.adapters.client.ConnectionPool
- moose.adapters.client.mysql.ConnectionPool
- moose.adapters.client.mysql.Query
- moose.adapters.client.mysql.TransactionQuery
- moose.adapters.mysql
- moose.adapters.mysql.types
- moose.plugins
- moose.plugins.AssociationPlugin
- moose.plugins.CachePlugin
- moose.plugins.QueryPlugin
- moose.plugins.TimeStampPlugin
- moose.Table
- OneToMany
- SQL
- Type

# Class moose.adapters.mysql

Extends SQL.
mysql implementaton of SQL this class exposes all MySql relevant functionality.

You should not have to use this class directly, but will be exposed for you by specifying the type when initializing moose.createConnection

Defined in: mysql.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| moose.adapters.mysql()

Fields borrowed from class SQL:
  sql

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | moose.adapters.mysql.addColumn(name, type) Create add column syntax.
<static> | moose.adapters.mysql.addForeignKey(name, options)
<static> | moose.adapters.mysql.addPrimaryKey(name)
<static> | moose.adapters.mysql.addUnique(name)
<static> | moose.adapters.mysql.alterColumn(name, options) Creates the alter column syntax.
<static> | moose.adapters.mysql.column(name, type) Create the column definition of a type
<static> | moose.adapters.mysql.dropColumn(name) Create drop column syntax.
<static> | moose.adapters.mysql.dropForeignKey(name, options)
<static> | moose.adapters.mysql.dropPrimaryKey()
<static> | moose.adapters.mysql.dropUnique(name)
<static> | moose.adapters.mysql.foreignKey(name, options)
<static> | moose.adapters.mysql.fromColDef(sql) Creates a Type from a column defintion
<static> | moose.adapters.mysql.primaryKey(name)
<static> | moose.adapters.mysql.unique(name)

Methods borrowed from class SQL:
  and, avg, between, bitAnd, bitOr, bitXor, clear, clearHaving, clearLimit, clearOffset, clearOrder, close, count, crossJoin, distinct, end, eq, exec, find, format, fullJoin, fullOuterJoin, group, groupAndAvg, groupAndBitAnd, groupAndBitOr, groupAndBitXor, groupAndCount, groupAndMax, groupAndMin, groupAndStd, groupAndStdDev, groupAndStdDevPop, groupAndStdDevSamp, groupAndSum, groupAndVariance, groupAndVarPop, groupAndVarSamp, gt, gte, having, innerJoin, is, isNot, isNotNull, isNull, join, leftJoin, leftOuterJoin, like, limit, logicGroup, lt, lte, max, min, naturalJoin, naturalLeftJoin, naturalRightJoin, neq, notBetween, notIn, notLike, offset, or, order, orderBy, remove, rightJoin, rightOuterJoin, select, std, stdDev, stdDevPop, stdDevSamp, sum, update, variance, varPop, varSamp, where

Class Detail
moose.adapters.mysql()
Method Detail
<static> {String} moose.adapters.mysql.addColumn(name, type)
Create add column syntax.
Defined in: index.js.

Parameters:
{String} name
  name of the column
{Type} type
  the Type object representing the column

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.addForeignKey(name, options)
Defined in: index.js.

    //ADD FOREIGN KEY (myColumn) REFERENCES otherTable (otherTableColumn)
    moose.adapters.mysql.addForeignKey("myColumn", {otherTable : "otherTableColumn"}

    //ADD CONSTRAINT fk_myColumnMyColumn2... FOREIGN KEY (myColumn, myColumn2)
    //             REFERENCES otherTable (otherTableColumn, otherTableColumn2)
    moose.adapters.mysql.addForeignKey([myColumn, myColumn2], {
                     otherTable : ["otherTableColumn", "otherTableColumn2"]
    });

    //ADD FOREIGN KEY (myColumn) REFERENCES otherTable (otherTableColumn),
    //ADD FOREIGN KEY (myColumn2) REFERENCES otherTable2 (otherTableColumn2)
    moose.adapters.mysql.addForeignKey({
                     myColumn : {otherTable : "otherTableColumn"},
                     myColumn2 : {otherTable2 : "otherTableColumn2"}
    });

Parameters:
{String|Array|Object} name
  - If a String is provided then it is assumed to be the name of the column
  - If an array is provided then it assumed to be an array of columns that reference the columns specified in the foreign table.
  - If an object is specified then its treated as multiple foreign keys against multiple tables.
{Object} options
  object containg the foreignTable as the key and the value should be either a string or array, depending on the name parameter, see the example.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.addPrimaryKey(name)
Defined in: index.js.

    //ADD PRIMARY KEY (myColumn)
    moose.adapters.mysql.addPrimaryKey("myColumn"}

    //ADD CONSTRAINT pk_myColumnMyColumn2... PRIMARY KEY (myColumn, myColumn2, ...)
    moose.adapters.mysql.addPrimaryKey([myColumn, myColumn2, ...]);

Parameters:
{String|Array} name
  name or names of columns to create a primary key.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.addUnique(name)
Defined in: index.js.

    //ADD UNIQUE (myColumn)
    moose.adapters.mysql.addUnique("myColumn"}

    //ADD CONSTRAINT uc_myColumnMyColumn2... UNIQUE (myColumn, myColumn2, ...)
    moose.adapters.mysql.addUnique([myColumn, myColumn2, ...]);

Parameters:
{String|Array} name
  name or names of columns to create a unique constraint.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.alterColumn(name, options)
Creates the alter column syntax.
Defined in: index.js.

Parameters:
{String} name
  the name of the column
{Object} options
  parameters representing how to transform the column
{Type} options.type Optional
  the Type object of the column.
{String} options.newName Optional
  the new name of the column.
{Type} options.original Optional
  the original type of the column
{*} options.default Optional
  change the default value of the column.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.column(name, type)
Create the column definition of a type
Defined in: index.js.

Parameters:
{String} name
  the name of the column
{Type} type
  the Type object of the column

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.dropColumn(name)
Create drop column syntax.
Defined in: index.js.

Parameters:
{String} name
  name of the column being dropped.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.dropForeignKey(name, options)
Defined in: index.js.

    //DROP FOREIGN KEY myColumn
    moose.adapters.mysql.dropForeignKey("myColumn", {otherTable : "otherTableColumn"}

    //DROP FOREIGN KEY fk_myColumnMyColumn2
    moose.adapters.mysql.foreignKey([myColumn, myColumn2], {
                 otherTable : ["otherTableColumn", "otherTableColumn2"]
    });

    //DROP FOREIGN KEY myColumn,
    //DROP FOREIGN KEY myColumn2
    moose.adapters.mysql.foreignKey({
                 myColumn : {otherTable : "otherTableColumn"},
                 myColumn2 : {otherTable2 : "otherTableColumn2"}
    });

Parameters:
{String|Array|Object} name
  - If a String is provided then it is assumed to be the name of the column
  - If an array is provided then it assumed to be an array of columns that reference the columns specified in the foreign table.
  - If an object is specified then its treated as multiple foreign keys against multiple tables.
{Object} options
  object containg the foreignTable as the key and the value should be either a string or array, depending on the name parameter, see the example.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.dropPrimaryKey()
Defined in: index.js.

     //DROP PRIMARY KEY
    dropPrimaryKey()

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.dropUnique(name)
Defined in: index.js.

    //DROP INDEX myColumn
    moose.adapters.mysql.dropUnique("myColumn")

    //DROP INDEX uc_myColumnMyColumn2
    moose.adapters.mysql.dropUnique([myColumn, myColumn2, ...]);

Parameters:
{String|Array} name
  name or names of columns to create a unique constraint.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.foreignKey(name, options)
Defined in: index.js.

    //FOREIGN KEY (myColumn) REFERENCES otherTable (otherTableColumn)
    moose.adapters.mysql.foreignKey("myColumn", {otherTable : "otherTableColumn"});

    //FOREIGN KEY (myColumn, myColumn2)
    //     REFERENCES otherTable (otherTableColumn, otherTableColumn2)
    moose.adapters.mysql.foreignKey([myColumn, myColumn2], {
                 otherTable : ["otherTableColumn", "otherTableColumn2"]
    });

    //FOREIGN KEY (myColumn) REFERENCES otherTable (otherTableColumn),
    //FOREIGN KEY (myColumn2) REFERENCES otherTable2 (otherTableColumn2)
    moose.adapters.mysql.foreignKey({
                 myColumn : {otherTable : "otherTableColumn"},
                 myColumn2 : {otherTable2 : "otherTableColumn2"}
    });

Parameters:
{String|Array|Object} name
  - If a String is provided then it is assumed to be the name of the column
  - If an array is provided then it assumed to be an array of columns that reference the columns specified in the foreign table.
  - If an object is specified then its treated as multiple foreign keys against multiple tables.
{Object} options
  object containg the foreignTable as the key and the value should be either a string or array, depending on the name parameter, see the example.

Returns:
  {String} the sql

<static> {Type} moose.adapters.mysql.fromColDef(sql)
Creates a Type from a column defintion
Defined in: index.js.

Parameters:
{Object} sql
  the sql type definition returned from a table query.

Returns:
  {Type} The Type

<static> {String} moose.adapters.mysql.primaryKey(name)
Defined in: index.js.

    //PRIMARY KEY (myColumn)
    moose.adapters.mysql.primaryKey("myColumn"}

    //PRIMARY KEY (myColumn, myColumn2, ...)
    moose.adapters.mysql.primaryKey([myColumn, myColumn2, ...]);

Parameters:
{String|Array} name
  name or names of columns to create a primary key.

Returns:
  {String} the sql

<static> {String} moose.adapters.mysql.unique(name)
Defined in: index.js.

    //UNIQUE (myColumn)
    moose.adapters.mysql.unique("myColumn"}

    //CONSTRAINT uc_myColumnMyColumn2... UNIQUE (myColumn, myColumn2, ...)
    moose.adapters.mysql.unique([myColumn, myColumn2, ...]);

Parameters:
{String|Array} name
  name or names of columns to create a unique constraint.

Returns:
  {String} the sql

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Jun 11 2011 03:16:40 GMT-0500 (CDT)