Bundle ODBC database access layer. Connection manages database sessions; Statement and ParameterStatement execute SQL queries; ResultSet iterates over rows and extracts typed column values. Compile with -lib odbc.
Timestamp
ODBC Timestamp holder
Operations
- New
- GetDay
- GetFraction
- GetHours
- GetMinutes
- GetMonth
- GetSeconds
- GetYear
- SetDay
- SetHours
- SetMinutes
- SetMonth
- SetSeconds
- SetYear
- ToDate
- ToString
GetFraction #
Gets the fraction of seconds
method : public : GetFraction() ~ IntReturn
| Type | Description |
|---|---|
| Int | fraction of seconds |
New # constructor
Copy constructor for System.Time.Date
New(date:System.Time.Date)Parameters
| Name | Type | Description |
|---|---|---|
| date | Date | System.Time.Date |
SetHours #
Sets the hours
method : public : SetHours(hours:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| hours | Int | hours |
SetMinutes #
Sets the minutes
method : public : SetMinutes(minute:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| minute | Int | minutes |
SetMonth #
Sets the month
method : public : SetMonth(month:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| month | Int | value |
SetSeconds #
Sets the seconds
method : public : SetSeconds(second:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| second | Int | seconds |
SetYear #
Sets the year
method : public : SetYear(year:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| year | Int | value |
ToDate #
Converts a timestamp into a system date
method : public : ToDate() ~ System.Time.DateReturn
| Type | Description |
|---|---|
| Date | system date |
Example
conn := Database.ODBC.Connection->New("mydsn", "user", "pass");
rs := conn->Select("SELECT updated_at FROM log");
if(rs->Next()) {
ts := rs->GetTimestamp("updated_at");
sys_date := ts->ToDate(); # convert to System.Time.Date
sys_date->ToString()->PrintLine();
};
conn->Close();