Providing an SQL Statement
An
RWDBOSql can encapsulate the SQL statement provided in the constructor. However, if you don’t know what statement you want to use when your
RWDBOSql is constructed, you can set it later using the
statement() method as shown here:
// default constructor, no statement provided
RWDBOSql anOSql;
…
// provide a statement
anOSql.statement("SELECT * FROM MYTABLE", RWDBOSql::Query);
When using
RWDBOSql, please note that the statement you provide must be valid syntax for the database against which you are executing.
NOTE: Your SQL statement must use the correct syntax for your database.
The goal of
RWDBOSql is to provide a database-independent way of executing statements and processing results. No attempt is made, however, to normalize SQL grammars between databases. If you are writing an application that must work with relational data in a database-independent fashion, you should use the DML classes—
RWDBSelector,
RWDBInserter,
RWDBDeleter, and
RWDBUpdater—instead of directly executing SQL statements.