dbBindTimeStamp

Top  Previous  Next

Syntax

INT = dbBindTimeStamp(hstmt as INT,column as INT,timestamp as DBTIMESTAMP,opt pReturn as POINTER)

Description

Binds a DBTIMESTAMP variable to a column in a result set.

Parameters

hstmt - A statement handle returned by dbExecSQL or dbPrepareSQL.

column - The ones based column number to bind.

timestamp - A variable of type DBTIMESTAMP.

pReturn - optional pointer to an INT.

Return value

TRUE if variable successfully bound to column. FALSE on error.

Remarks

The variable passed to the optional pReturn value will contain an indicator of the operation after each dbGet, dbGetNext or dbGetPrev operation.  The variable can then be checked against SQL_NULL_DATA or SQL_NO_TOTAL.  It is easier to use the dbIsNull function for checking for a NULL column. Some database drivers won't allow using dbIsNull against bound columns and this provides an alternative.

See Also: dbBindVariable, dbBindDate, dbBindTime

Example usage

DEF tsAdded as DBTIMESTAMP
DEF first,last as STRING
DEF Address_ID as INT
...
hstmt = dbExecSQL(pdb,"SELECT * FROM Addresses")
IF hStmt
    'bind the columns in the table to appropriate variables
    'column numbers start at 1 starting from the left.
    '
    dbBindVariable(hstmt,1,Address_ID)
    dbBindVariable(hstmt,2,first)
    dbBindVariable(hstmt,3,last)
    dbBindTimeStamp(hstmt,8,tsAdded)
    WHILE dbGet(hstmt)
        PRINT "ID:",Address_ID
        PRINT "Name:",first,last
        PRINT "Time added:",USING("##:##:##",tsAdded.hour,tsAdded.minute,tsAdded.second)
        PRINT "Date added:",USING("## / ## / ####",tsAdded.month,tsAdded.day,tsAdded.year)
    ENDWHILE
ENDIF