lib/dataset/sql.js
function (v) {
            if (isInstanceOf(v, Json, JsonArray)) {
                return this._literalJson(v);
            } else if (isInstanceOf(v, LiteralString)) {
                return "" + v;
            } else if (isString(v)) {
                return this._literalString(v);
            } else if (isNumber(v)) {
                return this._literalNumber(v);
            } else if (isInstanceOf(v, Expression)) {
                return this._literalExpression(v);
            } else if (isInstanceOf(v, Dataset)) {
                return this._literalDataset(v);
            } else if (isArray(v)) {
                return this._literalArray(v);
            } else if (isInstanceOf(v, sql.Year)) {
                return this._literalYear(v);
            } else if (isInstanceOf(v, sql.TimeStamp, sql.DateTime)) {
                return this._literalTimestamp(v);
            } else if (isDate(v)) {
                return this._literalDate(v);
            } else if (isInstanceOf(v, sql.Time)) {
                return this._literalTime(v);
            } else if (Buffer.isBuffer(v)) {
                return this._literalBuffer(v);
            } else if (isNull(v)) {
                return this._literalNull();
            } else if (isBoolean(v)) {
                return this._literalBoolean(v);
            } else if (isHash(v)) {
                return this._literalObject(v);
            } else {
                return this._literalOther(v);
            }
        }
function (v) {
            if (isInstanceOf(v, Json, JsonArray)) {
                return this._literalJson(v);
            } else if (isInstanceOf(v, LiteralString)) {
                return "" + v;
            } else if (isString(v)) {
                return this._literalString(v);
            } else if (isNumber(v)) {
                return this._literalNumber(v);
            } else if (isInstanceOf(v, Expression)) {
                return this._literalExpression(v);
            } else if (isInstanceOf(v, Dataset)) {
                return this._literalDataset(v);
            } else if (isArray(v)) {
                return this._literalArray(v);
            } else if (isInstanceOf(v, sql.Year)) {
                return this._literalYear(v);
            } else if (isInstanceOf(v, sql.TimeStamp, sql.DateTime)) {
                return this._literalTimestamp(v);
            } else if (isDate(v)) {
                return this._literalDate(v);
            } else if (isInstanceOf(v, sql.Time)) {
                return this._literalTime(v);
            } else if (Buffer.isBuffer(v)) {
                return this._literalBuffer(v);
            } else if (isNull(v)) {
                return this._literalNull();
            } else if (isBoolean(v)) {
                return this._literalBoolean(v);
            } else if (isHash(v)) {
                return this._literalObject(v);
            } else {
                return this._literalOther(v);
            }
        }
function ( v ) { if ( isInstanceOf ( v , Json , JsonArray ) ) { return this . _literalJson ( v ) ; } else if ( isInstanceOf ( v , LiteralString ) ) { return "" + v ; } else if ( isString ( v ) ) { return this . _literalString ( v ) ; } else if ( isNumber ( v ) ) { return this . _literalNumber ( v ) ; } else if ( isInstanceOf ( v , Expression ) ) { return this . _literalExpression ( v ) ; } else if ( isInstanceOf ( v , Dataset ) ) { return this . _literalDataset ( v ) ; } else if ( isArray ( v ) ) { return this . _literalArray ( v ) ; } else if ( isInstanceOf ( v , sql . Year ) ) { return this . _literalYear ( v ) ; } else if ( isInstanceOf ( v , sql . TimeStamp , sql . DateTime ) ) { return this . _literalTimestamp ( v ) ; } else if ( isDate ( v ) ) { return this . _literalDate ( v ) ; } else if ( isInstanceOf ( v , sql . Time ) ) { return this . _literalTime ( v ) ; } else if ( Buffer . isBuffer ( v ) ) { return this . _literalBuffer ( v ) ; } else if ( isNull ( v ) ) { return this . _literalNull ( ) ; } else if ( isBoolean ( v ) ) { return this . _literalBoolean ( v ) ; } else if ( isHash ( v ) ) { return this . _literalObject ( v ) ; } else { return this . _literalOther ( v ) ; } }
Returns a literal representation of a value to be used as part
of an SQL expression.

@example

DB.from("items").literal("abc'def\\") //=> "'abc''def\\\\'"
DB.from("items").literal("items__id") //=> "items.id"
DB.from("items").literal([1, 2, 3]) //=> "(1, 2, 3)"
DB.from("items").literal(DB.from("items")) //=> "(SELECT * FROM items)"
DB.from("items").literal(sql.x.plus(1).gt("y")); //=> "((x + 1) > y)"

@throws {patio.QueryError} If an unsupported object is given.
@param {*} v the value to convert the the SQL literal representation

@return {String} a literal representation of the value.
Returns a literal representation of a value to be used as part of an SQL expression .