|
abstract bool | active () |
| Returns True if the object is currently active and has a connection or transaction lock allocated to it, or False if not. More...
|
|
abstract int | affectedRows () |
| Returns the number of rows affected by the last call to AbstractSQLStatement::exec() More...
|
|
abstract nothing | beginTransaction () |
| Manually starts a transaction and allocates a connection or grabs the transaction lock according to the object used in the AbstractSQLStatement::constructor() More...
|
|
abstract nothing | bind (...) |
| Binds placeholder buffer specifications and values to buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract nothing | bindArgs (softlist vargs) |
| Binds placeholder buffer specifications and values given as a list in the single argument to the method to buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract nothing | bindPlaceholders (...) |
| Binds placeholder buffer specifications to buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract nothing | bindPlaceholdersArgs (softlist vargs) |
| Binds placeholder buffer specifications given as a list in the single argument to the method to buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract nothing | bindValues (...) |
| Binds values to value buffer specifications to buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract nothing | bindValuesArgs (softlist vargs) |
| Binds values to value buffer specifications given as a list in the single argument to the method to value buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract nothing | close () |
| Closes the statement if it is open, however this method does not release the connection or transaction lock. More...
|
|
abstract nothing | commit () |
| Commits the transaction, releases the connection or the transaction lock according to the object used in the AbstractSQLStatement::constructor(), and closes the SQLStatement. More...
|
|
abstract bool | currentThreadInTransaction () |
| Returns True if the current thread is in a transaction (i.e. holds the transaction lock), False if not. More...
|
|
abstract nothing | define () |
| Performs an explicit define operation on the SQLStatement. More...
|
|
abstract hash | describe () |
| Describes columns in the statement result. More...
|
|
abstract nothing | exec (...) |
| Executes the bound statement with any bound buffers, also optionally allows binding placeholder buffer specifications and values to buffers defined in AbstractSQLStatement::prepare() before executing the statement. More...
|
|
abstract nothing | execArgs (softlist vargs) |
| Executes the bound statement with any bound buffers, also optionally allows binding placeholder buffer specifications and values given as a list in the single argument to the method to buffers defined in AbstractSQLStatement::prepare() More...
|
|
abstract hash | fetchColumns (softint rows=-1) |
| Retrieves a block of rows as a hash of lists with the maximum number of rows determined by the argument passed; automatically advances the row pointer; with this call it is not necessary to call AbstractSQLStatement::next(). More...
|
|
abstract *hash | fetchRow () |
| Retrieves the current row as a hash where the keys are the column names and the values are the column values. More...
|
|
abstract list | fetchRows (softint rows=-1) |
| Retrieves a block of rows as a list of hashes with the maximum number of rows determined by the argument passed; automatically advances the row pointer; with this call it is not necessary to call AbstractSQLStatement::next() More...
|
|
abstract hash | getOutput () |
| Retrieves output buffers as a hash; result sets will be returned as hashes of lists. More...
|
|
abstract hash | getOutputRows () |
| Retrieves output buffers as a hash; result sets will be returned as lists of hashes. More...
|
|
abstract *string | getSQL () |
| Returns the current SQL string set with the call to AbstractSQLStatement::prepare() or AbstractSQLStatement::prepareRaw() or NOTHING if no SQL has been set. More...
|
|
abstract *hash | getValue () |
| Retrieves the current row as a hash where the keys are the column names and the values are the column values. More...
|
|
abstract bool | next () |
| Increments the row pointer when retrieving rows from a select statement; returns True if there is a row to retrieve, False if not. More...
|
|
abstract nothing | prepare (string sql,...) |
| Saves an SQL statement that will be prepared and executed later, along with optional arguments. More...
|
|
abstract nothing | prepareRaw (string sql) |
| Saves an SQL statement that will be prepared and executed later. More...
|
|
abstract nothing | rollback () |
| Closes the SQLStatement, performs a transaction rollback, and releases the connection or the transaction lock according to the object used in the AbstractSQLStatement::constructor(), and closes the SQLStatement. More...
|
|
abstract bool | valid () |
| returns True if the object is currently pointing at a valid element, False if not (use when iterating with AbstractSQLStatement::next()) More...
|
|
This class defines an abstract interface for the SQLStatement class.
- Restrictions:
- Qore::PO_NO_DATABASE
- Since
- Qore 0.9.0
abstract nothing Qore::SQL::AbstractSQLStatement::bind |
( |
|
... | ) |
|
|
pure virtual |
Binds placeholder buffer specifications and values to buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method.
Any arguments previously bound will be released when this call is made.
- Note
- You can also bind directly when calling AbstractSQLStatement::exec() or AbstractSQLStatement::execArgs() as a shortcut as well, in which case it's not necessary to make an extra call to this method.
- Parameters
-
... | Arguments to placeholder specifications (if required by the underlying DBI driver) and bind by value arguments |
- Example:
1 stmt.prepare(
"insert into table (id, name) values (%v, %v)");
2 foreach hash h
in (l) {
3 stmt.bind(h.id, h.name);
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::bindArgs(), AbstractSQLStatement::bindPlaceholders(), AbstractSQLStatement::bindPlaceholdersArgs(), AbstractSQLStatement::bindValues(), and AbstractSQLStatement::bindValuesArgs()
abstract nothing Qore::SQL::AbstractSQLStatement::bindArgs |
( |
softlist |
vargs | ) |
|
|
pure virtual |
Binds placeholder buffer specifications and values given as a list in the single argument to the method to buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method.
Any arguments previously bound will be released when this call is made.
- Note
- You can also bind directly when calling AbstractSQLStatement::exec() or AbstractSQLStatement::execArgs() as a shortcut as well, in which case it's not necessary to make an extra call to this method.
- Parameters
-
vargs | Arguments to placeholder specifications (if required by the underlying DBI driver) and bind by value arguments |
- Example:
1 stmt.prepare(
"insert into table (id, name) values (%v, %v)");
2 foreach hash h
in (l) {
3 list args = (h.id, h.name);
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::bind(), AbstractSQLStatement::bindPlaceholders(), AbstractSQLStatement::bindPlaceholdersArgs(), AbstractSQLStatement::bindValues(), and AbstractSQLStatement::bindValuesArgs()
abstract nothing Qore::SQL::AbstractSQLStatement::bindPlaceholders |
( |
|
... | ) |
|
|
pure virtual |
Binds placeholder buffer specifications to buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method. Only placeholder buffer specifications will be processed; value buffer specifications will be skipped by this method.
Any buffer specifications previously defined will be released when this call is made.
- Note
- You can also bind buffer specifications directly when calling AbstractSQLStatement::exec() or AbstractSQLStatement::execArgs() as a shortcut as well, in which case it's not necessary to make an extra call to this method.
Not all DBI drivers require binding placeholders specification.
- Parameters
-
... | Arguments to placeholder specifications (if required by the underlying DBI driver) |
- Example:
1 stmt.prepare(
"begin select sysdate into :sd from dual", Type::Date); end;
2 stmt.bindPlaceholders(Type::Date);
3 date d = stmt.getOutput().sd;
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::bind(), AbstractSQLStatement::bindArgs(), AbstractSQLStatement::bindPlaceholdersArgs(), AbstractSQLStatement::bindValues(), and AbstractSQLStatement::bindValuesArgs()
abstract nothing Qore::SQL::AbstractSQLStatement::bindPlaceholdersArgs |
( |
softlist |
vargs | ) |
|
|
pure virtual |
Binds placeholder buffer specifications given as a list in the single argument to the method to buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method. Only placeholder buffer specifications will be processed; value buffer specifications will be skipped by this method.
Any buffer specifications previously defined will be released when this call is made.
- Note
- You can also bind buffer specifications directly when calling AbstractSQLStatement::exec() or AbstractSQLStatement::execArgs() as a shortcut as well, in which case it's not necessary to make an extra call to this method.
Not all DBI drivers require binding placeholders specification.
- Parameters
-
vargs | Arguments to placeholder specifications (if required by the underlying DBI driver) |
- Example:
1 stmt.prepare(
"begin select sysdate into :sd from dual", Type::Date); end;
2 list l =
list(Type::Date);
3 stmt.bindPlaceholdersArgs(l);
4 date d = stmt.getOutput().sd;
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::bind(), AbstractSQLStatement::bindArgs(), AbstractSQLStatement::bindPlaceholders(), AbstractSQLStatement::bindValues(), and AbstractSQLStatement::bindValuesArgs()
abstract nothing Qore::SQL::AbstractSQLStatement::bindValues |
( |
|
... | ) |
|
|
pure virtual |
Binds values to value buffer specifications to buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method.
Any values previously bound will be released when this call is made.
- Note
- You can also bind directly when calling AbstractSQLStatement::exec() or AbstractSQLStatement::execArgs() as a shortcut as well, in which case it's not necessary to make an extra call to this method.
- Parameters
-
... | Arguments to bind by value arguments |
- Example:
1 stmt.prepare(
"insert into table (id, name) values (%v, %v)");
2 foreach hash h
in (l) {
3 stmt.bindValues(h.id, h.name);
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::bind(), AbstractSQLStatement::bindArgs(), AbstractSQLStatement::bindPlaceholders(), AbstractSQLStatement::bindPlaceholdersArgs(), and AbstractSQLStatement::bindValuesArgs().
abstract nothing Qore::SQL::AbstractSQLStatement::bindValuesArgs |
( |
softlist |
vargs | ) |
|
|
pure virtual |
Binds values to value buffer specifications given as a list in the single argument to the method to value buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method.
Any values previously bound will be released when this call is made.
- Note
- You can also bind directly when calling AbstractSQLStatement::exec() or AbstractSQLStatement::execArgs() as a shortcut as well, in which case it's not necessary to make an extra call to this method.
- Parameters
-
vargs | Arguments to bind by value arguments |
- Example:
1 stmt.prepare(
"insert into table (id, name) values (%v, %v)");
2 foreach hash h
in (l) {
3 list args = (h.id, h.name);
4 stmt.bindValuesArgs(args);
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications; see the relevant DBI driver docs for more information
abstract nothing Qore::SQL::AbstractSQLStatement::exec |
( |
|
... | ) |
|
|
pure virtual |
Executes the bound statement with any bound buffers, also optionally allows binding placeholder buffer specifications and values to buffers defined in AbstractSQLStatement::prepare() before executing the statement.
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Optional arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method.
If bind arguments are provided, any arguments previously bound will be released when this call is made.
After calling this method to execute the statement, to retrieve information about the call or output values bound in the call, call AbstractSQLStatement::affectedRows(), AbstractSQLStatement::getOutput(), or AbstractSQLStatement::getOutputRows() as needed.
To retrieve rows from a select statement call either AbstractSQLStatement::next() and AbstractSQLStatement::fetchRow(), or AbstractSQLStatement::fetchRows() or AbstractSQLStatement::fetchColumns() as needed.
- Parameters
-
... | Optional arguments to placeholder specifications (if required by the underlying DBI driver) and bind by value arguments can be given in the call to the method; if present, arguments are bound before the statement is executed |
- Example:
1 stmt.prepare(
"insert into table (id, name) values (%v, %v)");
2 foreach hash h
in (l) {
3 stmt.exec(h.id, h.name);
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications or when the statement is executed; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::execArgs()
abstract nothing Qore::SQL::AbstractSQLStatement::execArgs |
( |
softlist |
vargs | ) |
|
|
pure virtual |
Executes the bound statement with any bound buffers, also optionally allows binding placeholder buffer specifications and values given as a list in the single argument to the method to buffers defined in AbstractSQLStatement::prepare()
If the statement has not previously been prepared with the DB API, it will be implicitly prepared by this method call. This means that this call will cause a connection to be dedicated from a DatasourcePool object or the transaction lock to be grabbed with a Datasource object, depending on the argument to AbstractSQLStatement::constructor().
Optional arguments to buffer specifications must be given in the same order as declared in the string given to the AbstractSQLStatement::prepare() method.
If bind arguments are provided, any arguments previously bound will be released when this call is made.
After calling this method to execute the statement, to retrieve information about the call or output values bound in the call, call AbstractSQLStatement::affectedRows(), AbstractSQLStatement::getOutput(), or AbstractSQLStatement::getOutputRows() as needed.
To retrieve rows from a select statement call either AbstractSQLStatement::next() and AbstractSQLStatement::fetchRow(), or AbstractSQLStatement::fetchRows() or AbstractSQLStatement::fetchColumns() as needed.
- Parameters
-
vargs | Optional arguments to placeholder specifications (if required by the underlying DBI driver) and bind by value arguments can be given in the call to the method; if present, arguments are bound before the statement is executed |
- Example:
1 stmt.prepare(
"insert into table (id, name) values (%v, %v)");
2 foreach hash h
in (l) {
3 list args = (h.id, h.name);
- Exceptions
-
- Note
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications or when the statement is executed; see the relevant DBI driver docs for more information
- See Also
- AbstractSQLStatement::exec()
abstract list Qore::SQL::AbstractSQLStatement::fetchRows |
( |
softint |
rows = -1 | ) |
|
|
pure virtual |
Retrieves a block of rows as a list of hashes with the maximum number of rows determined by the argument passed; automatically advances the row pointer; with this call it is not necessary to call AbstractSQLStatement::next()
If the argument passed is omitted or less than or equal to zero, then all available rows from the current row position are retrieved, also if fewer rows are available than requested then only the rows available are retrieved.
If no more rows are available then an empty list is returned.
- Parameters
-
rows | The maximum number of rows to retrieve, if this argument is omitted, negative, or equal to zero, then all available rows from the current row position are retrieved |
- Example:
1 list l = stmt.fetchRows(-1);
- Exceptions
-
- Note
- There is no need to call AbstractSQLStatement::next() when calling this method; the method automatically iterates through the given number of rows
- Exceptions could be thrown by the DBI driver when the statement is prepared or when attempting to bind the given arguments to buffer specifications or when the statement is executed or when row values are retrieved; see the relevant DBI driver docs for more information