37 lines
1.4 KiB
Plaintext

/*
Converter classes convert between JavaScript types and MySQL types.
If a user supplies a javascript converter, and it will be used to read
and write the database.
Converters have several purposes:
- To convert between MySQL DECIMAL types and a user's preferred JavaScript
fixed-precision utility library
- To convert between MySQL BIGINT types and a user's preferred JavaScript
big number utility library
- To serialize arbitrary application objects into character or binary columns
- To facilitate handling of DATETIME, TIME, DATE, and TIMESTAMP
- The emulate the MySQL server's handling of SET and ENUM columns in
non-SQL adapters
A converter class implements two functions:
toDB(obj) : convert obj, an application object,
into the intermediate type representation of a column
fromDB(val): convert val, an intermediate type,
into an application object form
Each function returns the result of the conversion.
A TypeConverter registered by the user takes precedence over the adapter's
default converter for a type (if any).
A fieldConverter registered as part of a TableMapping takes precedence over
any typeConverters.
*/
function Converter() {}:
Converter.prototype = {
"toDB" : function(obj) { },
"fromDB" : function(val) { }
};