Defines case methods
- define({
Cast the reciever to the given SQL type.
ExampleArguments
- sql.a.cast("integer") //=> CAST(a AS integer)
- sql.a.cast(String) //=> CAST(a AS varchar(255))
patio.sql.Cast
the casted expression
- function (type){
- return new Cast(this, type);
- }
Cast the reciever to the given SQL type (or the database's default Number type if none given.
ExampleArguments
- sql.a.castNumeric() //=> CAST(a AS integer)
- sql.a.castNumeric("double") //=> CAST(a AS double precision)
the numeric type to cast to
patio.sql.NumericExpression
a casted numberic expression
- function (type){
- return this.cast(type || "integer").sqlNumber;
- }
Cast the reciever to the given SQL type (or the database's default String type if none given), and return the result as a patio.sql.StringExpression.
ExampleArguments
- sql.a.castString() //=> CAST(a AS varchar(255))
- sql.a.castString("text") //=> CAST(a AS text)
the string type to cast to
patio.sql.StringExpression
the casted string expression
- function (type){
- return this.cast(type || String).sqlString;
- }