SybInt()Class constructor. Does not attempt to connect to Sybase server.
~SybInt()The destructor will automatically disconnect from the Sybase server if currently connected.
void connect(const string& server, const string& username, const string& password)Connect to a Sybase server with supplied username and password. If already connected, disconnect() will be called first.
void useDB(const string& dbname)Select a database to use
long cmdSQL(const string& sql)Execute some SQL. The return value is not currently used. See also runSQL() below.
DTable* runSQL(const string& sql)Execute some SQL. The results of the SQL are returned in a DTable*. Note that you get ownership of the DTable*, i.e. it is your responsibility to delete it when you have finished with it. The DTable API is described below.
int getReturnStatus()Get the return status of the last stored procedure that was executed.
int getRowsAffected()Get the number of rows affected by the last SQL command.
void disconnect()Manually disconnect from the Sybase server. There is normally no need to call this method as the class destructor will disconnect automatically.
DTable()Construct an empty DTable
~DTable()DTable destructor
uint addRow()Add a new row to a DTable. The return value is the index of the new row (rows are numbered from 0).
uint addColumn(DT::ColType coltype, const string& colname="")Add a new column to a DTable to contain items of type coltype. Valid column types are DT::STR, DT::INT, DT::DBL; for STL string, integer and double respectively. The return value is the index of the new column (columns are numbered from 0).
string colName(uint column) constReturns the name of column with index column.
uint colNum(const string& name) constReturns the index of column with name name.
DT::ColType colType(uint column) constReturns the type of data stored in column with index column.
void clear()Delete all columns in DTable.
uint rows() constReturn number of rows in DTable.
uint columns() constReturn number of columns in DTable.
string asText() constReturn contents of DTable as a string. Lines are separated with '\n', columns are separated with tab.
string asHTML() constReturn contents of DTable as a string, formatted as an HTML table.
string getString(uint col, uint row) constReturn the string stored in column col and row row. If this is not a string column, the result will be converted to a string.
int getInt(uint col, uint row) constReturn the integer stored in column col and row row. If this is not an integer column, an exception is thrown.
double getDouble(uint col, uint row) constReturn the double stored in column col and row row. If this is not a double column, an exception is thrown.
string getString(const string& colname, uint row) const
int getInt(const string& colname, uint row) const
double getDouble(const string& colname, uint row) constThe above three methods are identical to the previous three, except the column is specified by name instead of index.
void setString(uint col, uint row, const string& s)Set the string stored in column col and row row to s. If this is not a string column, an attempt will be made to convert the string s into an integer/double.
void setInt(uint col, uint row, int i)Set the integer stored in column col and row row to i. If this is not an integer column, an exception is thrown.
void setDouble(uint col, uint row, double d)Set the double stored in column col and row row to d. If this is not a double column, an exception is thrown.