Date objects. It converts null values to JavaScript null.
NOTE: Because JavaScript does not support fixed or packed decimal notation, some precision may be lost when reading and writing packed decimal data types. Be sure to check results before inserting values back into a database, and use appropriate mathematical functions to correct for any loss of precision.
Date objects. To insert a date value in a database, use a JavaScript Date object, as follows:
cursorName.dateColumn = dateObjHere,
cursorName is a cursor, dateColumn is a column corresponding to a date, and dateObj is a JavaScript Date object. You create a Date object using the new operator and the Date constructor, as follows:
dateObj = new Date(dateString)where
dateString is a string representing a date. If dateString is the empty string, it creates a Date object for the current date. For example:
custs.orderDate = new Date("Jan 27, 1997")NOTE: DB2 databases havetimeandtimestampdata types. These data types both convert to theDatetype in JavaScript.
WARNING: The LiveWire Database Service cannot handle dates after February 5, 2037.For more information on working with dates in JavaScript, see Date Object.
Table 18.1 DB2 data-type conversions
| DB2 Data Type |
JavaScript Data Type
|
|
|
|
|
| |
|---|
Table 18.2 Informix data-type conversions
| Informix Data Type |
JavaScript Data Type
|
|
|
|
|
| |
|---|
varchar data type is converted to the ODBC SQL_VARCHAR data type. For more information, see the ODBC SDK documentation. The following table shows the conversions made by the JavaScript runtime engine for ODBC databases.
Table 18.3 ODBC data-type conversions
| ODBC Data Type |
JavaScript Data Type
|
|
|
|
| |
|---|
Table 18.4 Oracle data-type conversions
| Oracle Data Type |
JavaScript Data Type
|
|
|
|
| |
|---|
Table 18.5 Sybase data-type conversions
| Sybase Data Type |
JavaScript Data Type
|
|
|
|
| |
|---|
| 1 The Sybase client restricts numeric data types to 33 digits. If you insert a JavaScript number with more digits into a Sybase database, you'll get an error. |
Last Updated: 11/12/98 15:29:45
Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use