Qore jni Module  1.0.1
org.qore.lang.AbstractDatasource Class Reference

Java wrapper for the Qore::SQL::AbstractDatasource class in Qore. More...

Inheritance diagram for org.qore.lang.AbstractDatasource:
org.qore.jni.QoreObjectWrapper org.qore.lang.DatasourcePool

Public Member Methods

 AbstractDatasource (QoreObject ds)
 creates the object
 
void commit () throws Throwable
 Commits the current transaction and releases any thread resources associated with the transaction. More...
 
void rollback () throws Throwable
 Rolls the current transaction back and releases any thread resources associated with the transaction. More...
 
Object exec (String sql) throws Throwable
 Executes an SQL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values) More...
 
Object exec (String sql, Object... args) throws Throwable
 Executes an SQL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values) More...
 
Object vexec (String sql, Object[] vargs) throws Throwable
 Executes an SQL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values), taking a list for all bind arguments. More...
 
Object execRaw (String sql) throws Throwable
 Executes an SQL command on the server and returns either the row count (for example, for updates and inserts) or the data retrieved (for example, if a stored procedure is executed that returns values) More...
 
Object select (String sql) throws Throwable
 Executes an SQL select statement on the server and (normally) returns the result as a hash (column names) of lists (column values per row) More...
 
Object select (String sql, Object... args) throws Throwable
 Executes an SQL select statement on the server and (normally) returns the result as a hash (column names) of lists (column values per row) More...
 
Object selectRow (String sql) throws Throwable
 Executes an SQL select statement on the server and returns the first row as a hash (the column values) More...
 
Object selectRow (String sql, Object... args) throws Throwable
 Executes an SQL select statement on the server and returns the first row as a hash (the column values) More...
 
Object selectRows (String sql) throws Throwable
 Executes an SQL select statement on the server and returns the result as a list (rows) of hashes (the column values) More...
 
Object selectRows (String sql, Object... args) throws Throwable
 Executes an SQL select statement on the server and returns the result as a list (rows) of hashes (the column values) More...
 
Object vselect (String sql, Object[] vargs) throws Throwable
 Executes a select statement on the server and returns the results in a hash (column names) of lists (column values per row), taking a list for all bind arguments. More...
 
Object vselectRow (String sql, Object[] vargs) throws Throwable
 Executes a select statement on the server and returns the first row as a hash (column names and values), taking a list for all bind arguments. More...
 
Object vselectRows (String sql, Object[] vargs) throws Throwable
 Executes a select statement on the server and returns the results in a list (rows) of hashes (column names and values), taking a list for all bind arguments. More...
 
void beginTransaction () throws Throwable
 Manually signals the start of transaction management on the AbstractDatasource. More...
 
String getUserName () throws Throwable
 Returns the username parameter as a string or null if none is set. More...
 
String getPassword () throws Throwable
 Returns the password parameter as a string or null if none is set. More...
 
String getDBName () throws Throwable
 Returns the database name parameter as a string or null if none is set. More...
 
String getDBEncoding () throws Throwable
 Retrieves the database-specific charset set encoding for the object. More...
 
String getOSEncoding () throws Throwable
 Returns the Qore character encoding name for the object as a string or null if none is set. More...
 
String getHostName () throws Throwable
 Returns the hostname parameter as a string or null if none is set. More...
 
Integer getPort () throws Throwable
 Gets the port number that will be used for the next connection to the server. More...
 
String getDriverName () throws Throwable
 Returns the name of the driver used for the object. More...
 
Object getServerVersion () throws Throwable
 Returns the driver-specific server version data for the current connection. More...
 
Object getClientVersion () throws Throwable
 Retrieves the driver-specific client library version information. More...
 
boolean inTransaction () throws Throwable
 Returns True if a transaction is currently in progress. More...
 
HashMap< String, Object > getConfigHash () throws Throwable
 Returns a datasource hash describing the configuration of the current object. More...
 
String getConfigString () throws Throwable
 Returns a string giving the configuration of the current object in a format that can be parsed by parse_datasource() More...
 
boolean currentThreadInTransaction () throws Throwable
 Should return True if the current thread is in a transaction with this object, must be re-implemented in subclasses to provide the desired functionality. More...
 
AbstractSQLStatement getSQLStatement () throws Throwable
 Returns an AbstractSQLStatement object based on the current database connection object. More...
 
- Public Member Methods inherited from org.qore.jni.QoreObjectWrapper
 QoreObjectWrapper (QoreObject obj)
 creates the wrapper object with the Qore object
 
void release ()
 releases the Qore object; do not call any further methods on the object after this call
 
QoreObject getQoreObject ()
 returns the Qore object
 
String className ()
 returns the class name for the Qore object
 
boolean instanceOf (String class_name)
 returns true if the object is an instance of the given class
 

Additional Inherited Members

- Private Attributes inherited from org.qore.jni.QoreObjectWrapper
QoreObject obj
 the wrapper Qore object
 

Detailed Description

Java wrapper for the Qore::SQL::AbstractDatasource class in Qore.

Member Function Documentation

◆ beginTransaction()

void org.qore.lang.AbstractDatasource.beginTransaction ( ) throws Throwable
inline

Manually signals the start of transaction management on the AbstractDatasource.

This method should be called when the AbstractDatasource object will be shared between more than 1 thread, and a transaction will be started with a select() method or the like.

This method does not make any communication with the server to start a transaction; it only allocates the transaction lock to the current thread in Qore.

Example:
datasource.beginTransaction();

◆ commit()

void org.qore.lang.AbstractDatasource.commit ( ) throws Throwable
inline

Commits the current transaction and releases any thread resources associated with the transaction.

Example:
datasource.commit();

◆ currentThreadInTransaction()

boolean org.qore.lang.AbstractDatasource.currentThreadInTransaction ( ) throws Throwable
inline

Should return True if the current thread is in a transaction with this object, must be re-implemented in subclasses to provide the desired functionality.

Note
  • this is reimplemented as Datasource::currentThreadInTransaction() and DatasourcePool::currentThreadInTransaction()
  • this method was added as a non-abstract method in Qore 0.8.10 to avoid breaking existing subclasses of AbstractDatasource
Since
Qore 0.8.10

◆ exec() [1/2]

Object org.qore.lang.AbstractDatasource.exec ( String  sql) throws Throwable
inline

Executes an SQL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values)

Parameters
sqlThe SQL command to execute on the server
Returns
The return value depends on the DBI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the SQL statement. For all other commands, normally an integer row count is returned. However, some DBI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
Example:
int rows = datasource.exec("insert into table (varchar_col, timestamp_col, blob_col, numeric_col) values (%v, %v, %v, %d)", string, ZonedDateTime.now(), binary, 100);

◆ exec() [2/2]

Object org.qore.lang.AbstractDatasource.exec ( String  sql,
Object...  args 
) throws Throwable
inline

Executes an SQL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values)

Parameters
sqlThe SQL command to execute on the server
argsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
The return value depends on the DBI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the SQL statement. For all other commands, normally an integer row count is returned. However, some DBI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
Example:
int rows = datasource.exec("insert into table (varchar_col, timestamp_col, blob_col, numeric_col) values (%v, %v, %v, %d)", string, ZonedDateTime.now(), binary, 100);

◆ execRaw()

Object org.qore.lang.AbstractDatasource.execRaw ( String  sql) throws Throwable
inline

Executes an SQL command on the server and returns either the row count (for example, for updates and inserts) or the data retrieved (for example, if a stored procedure is executed that returns values)

This method does not do any variable binding, so it's useful for example for DDL statements etc

Warning:
Using this method to execute pure dynamic SQL many times with different SQL strings (as opposed to using the same string and binding by value instead of dynamic SQL) can affect application performance by prohibiting the efficient usage of the DB server's statement cache. See DB server documentation for variable binding and the SQL statement cache for more information.
Parameters
sqlThe SQL command to execute on the server; this string will not be subjected to any transformations for variable binding
Returns
The return value depends on the DBI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the SQL statement. For all other commands, normally an integer row count is returned. However, some DBI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
Example:
datasource.execRaw("create table my_tab (id number, some_text varchar2(30))");

◆ getClientVersion()

Object org.qore.lang.AbstractDatasource.getClientVersion ( ) throws Throwable
inline

Retrieves the driver-specific client library version information.

Returns
the driver-specific client library version information
Example:
Object ver = datasource.getClientVersion();
Note
see the documentation for the DBI driver being used for possible exceptions

◆ getConfigHash()

HashMap<String, Object> org.qore.lang.AbstractDatasource.getConfigHash ( ) throws Throwable
inline

Returns a datasource hash describing the configuration of the current object.

Example:
Map<String, Object> h = obj.getConfigHash();
Returns
a datasource hash describing the configuration of the current object
Since
Qore 0.8.8

◆ getConfigString()

String org.qore.lang.AbstractDatasource.getConfigString ( ) throws Throwable
inline

Returns a string giving the configuration of the current object in a format that can be parsed by parse_datasource()

Example:
String str = obj.getConfigString();
Returns
a string giving the configuration of the current object in a format that can be parsed by parse_datasource()
Since
Qore 0.8.8

◆ getDBEncoding()

String org.qore.lang.AbstractDatasource.getDBEncoding ( ) throws Throwable
inline

Retrieves the database-specific charset set encoding for the object.

Returns
the database-specific charset set encoding for the object
Example:
String enc = datasource.getDBEncoding();
See also
getOSEncoding();

◆ getDBName()

String org.qore.lang.AbstractDatasource.getDBName ( ) throws Throwable
inline

Returns the database name parameter as a string or null if none is set.

Returns
the database name parameter as a string or null if none is set
Example:
String db = datasource.getDBName();

◆ getDriverName()

String org.qore.lang.AbstractDatasource.getDriverName ( ) throws Throwable
inline

Returns the name of the driver used for the object.

Returns
the name of the driver used for the object
Example:
String driver = datasource.getDriverName();

◆ getHostName()

String org.qore.lang.AbstractDatasource.getHostName ( ) throws Throwable
inline

Returns the hostname parameter as a string or null if none is set.

Returns
the hostname parameter as a string or null if none is set
Example:
String host = datasource.getHostName();

◆ getOSEncoding()

String org.qore.lang.AbstractDatasource.getOSEncoding ( ) throws Throwable
inline

Returns the Qore character encoding name for the object as a string or null if none is set.

Returns
the Qore character encoding name for the object as a string or null if none is set
Example:
String enc = datasource.getOSEncoding();

◆ getPassword()

String org.qore.lang.AbstractDatasource.getPassword ( ) throws Throwable
inline

Returns the password parameter as a string or null if none is set.

Returns
the password parameter as a string or null if none is set
Example:
String pass = datasource.getPassword();

◆ getPort()

Integer org.qore.lang.AbstractDatasource.getPort ( ) throws Throwable
inline

Gets the port number that will be used for the next connection to the server.

Invalid port numbers will cause an exception to be thrown when the connection is opened

Example:
Integer port = datasource.getPort();

◆ getServerVersion()

Object org.qore.lang.AbstractDatasource.getServerVersion ( ) throws Throwable
inline

Returns the driver-specific server version data for the current connection.

Returns
the driver-specific server version data for the current connection
Example:
Object ver = datasource.getServerVersion();
Note
see the documentation for the DBI driver being used for additional possible exceptions

◆ getSQLStatement()

AbstractSQLStatement org.qore.lang.AbstractDatasource.getSQLStatement ( ) throws Throwable
inline

Returns an AbstractSQLStatement object based on the current database connection object.

Note
  • this is reimplemented as Datasource::getSQLStatement() and DatasourcePool::getSQLStatement()
  • this method was added as a non-abstract method in Qore 0.9.0 to avoid breaking existing subclasses of AbstractDatasource
Since
Qore 0.9.0

◆ getUserName()

String org.qore.lang.AbstractDatasource.getUserName ( ) throws Throwable
inline

Returns the username parameter as a string or null if none is set.

Returns
the username parameter as a string or null if none is set
Example:
String user = datasource.getUserName();

◆ inTransaction()

boolean org.qore.lang.AbstractDatasource.inTransaction ( ) throws Throwable
inline

Returns True if a transaction is currently in progress.

Returns
True if a transaction is currently in progress
Example:
boolean b = datasource.inTransaction();

◆ rollback()

void org.qore.lang.AbstractDatasource.rollback ( ) throws Throwable
inline

Rolls the current transaction back and releases any thread resources associated with the transaction.

Example:
datasource.rollback();

◆ select() [1/2]

Object org.qore.lang.AbstractDatasource.select ( String  sql) throws Throwable
inline

Executes an SQL select statement on the server and (normally) returns the result as a hash (column names) of lists (column values per row)

The usual return format of this method is suitable for use with context statements, for easy iteration and processing of query results. Alternatively, the HashListIterator class can be used to iterate the return value of this method.

Additionally, this format is a more efficient format than that returned by the selectRows() method, because the column names are not repeated for each row returned. Therefore, for retrieving anything greater than small amounts of data, it is recommended to use this method instead of selectRows().

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
...Include any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
This method returns a hash (the keys are the column names) of lists (the column data per row) when executed with an SQL select statement, however some DBI drivers allow any SQL to be executed through this method, in which case other data types can be returned (such as an integer for a row count or a hash for output parameters when executing a stored procedure). If no rows are found, a hash of column names assigned to empty lists is returned.
Example:
Map<String, Object> query = (Map<String, Object>)datasource.select("select * from table where varchar_column = 'col'");
Note
This method returns all the data available immediately; to process query data piecewise, use the SQLStatement class

◆ select() [2/2]

Object org.qore.lang.AbstractDatasource.select ( String  sql,
Object...  args 
) throws Throwable
inline

Executes an SQL select statement on the server and (normally) returns the result as a hash (column names) of lists (column values per row)

The usual return format of this method is suitable for use with context statements, for easy iteration and processing of query results. Alternatively, the HashListIterator class can be used to iterate the return value of this method.

Additionally, this format is a more efficient format than that returned by the selectRows() method, because the column names are not repeated for each row returned. Therefore, for retrieving anything greater than small amounts of data, it is recommended to use this method instead of selectRows().

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
argsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
This method returns a hash (the keys are the column names) of lists (the column data per row) when executed with an SQL select statement, however some DBI drivers allow any SQL to be executed through this method, in which case other data types can be returned (such as an integer for a row count or a hash for output parameters when executing a stored procedure). If no rows are found, a hash of column names assigned to empty lists is returned.
Example:
// bind a string and a date/time value by value in a query
Map<String, Object> query = (Map<String, Object>)datasource.select("select * from table where varchar_column = %v and timestamp_column > %v", string, ZonedDateTime::parse("2007-10-11T15:31:26.289+02:00");
Note
This method returns all the data available immediately; to process query data piecewise, use the SQLStatement class

◆ selectRow() [1/2]

Object org.qore.lang.AbstractDatasource.selectRow ( String  sql) throws Throwable
inline

Executes an SQL select statement on the server and returns the first row as a hash (the column values)

If more than one row is returned, then it is treated as an error and a DBI-SELECT-ROW-ERROR is returned (however the DBI driver should raise its own exception here to avoid retrieving more than one row from the server). For a similar method taking a list for all bind arguments, see vselectRow().

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
Returns
This method normally returns a hash (the keys are the column names) of row data or null if no row is found for the query when executed with an SQL select statement, however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned
Example:
Map<String, Object> h = (Map<String, Object>)datasource.selectRow("select * from example_table where id = 1");
Exceptions
DBI-SELECT-ROW-ERRORmore than 1 row retrieved from the server

◆ selectRow() [2/2]

Object org.qore.lang.AbstractDatasource.selectRow ( String  sql,
Object...  args 
) throws Throwable
inline

Executes an SQL select statement on the server and returns the first row as a hash (the column values)

If more than one row is returned, then it is treated as an error and a DBI-SELECT-ROW-ERROR is returned (however the DBI driver should raise its own exception here to avoid retrieving more than one row from the server). For a similar method taking a list for all bind arguments, see vselectRow().

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
argsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
This method normally returns a hash (the keys are the column names) of row data or null if no row is found for the query when executed with an SQL select statement, however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned
Example:
Map<String, Object> h = (Map<String, Object>)datasource.selectRow("select * from example_table where id = 1");
Exceptions
DBI-SELECT-ROW-ERRORmore than 1 row retrieved from the server

◆ selectRows() [1/2]

Object org.qore.lang.AbstractDatasource.selectRows ( String  sql) throws Throwable
inline

Executes an SQL select statement on the server and returns the result as a list (rows) of hashes (the column values)

The return format of this method is not as memory efficient as that returned by the select() method, therefore for larger amounts of data, it is recommended to use select(). The usual return value of this method can be iterated with the ListHashIterator class.

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
Returns
Normally returns a list (rows) of hash (where the keys are the column names of each row) or null if no rows are found for the query, however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned
Example:
Objeect[] list = (Object[])datasource.selectRows("select * from example_table");
See also
select()
Note
This method returns all the data available immediately; to process query data piecewise, use the SQLStatement class

◆ selectRows() [2/2]

Object org.qore.lang.AbstractDatasource.selectRows ( String  sql,
Object...  args 
) throws Throwable
inline

Executes an SQL select statement on the server and returns the result as a list (rows) of hashes (the column values)

The return format of this method is not as memory efficient as that returned by the select() method, therefore for larger amounts of data, it is recommended to use select(). The usual return value of this method can be iterated with the ListHashIterator class.

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
argsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
Normally returns a list (rows) of hash (where the keys are the column names of each row) or null if no rows are found for the query, however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned
Example:
Objeect[] list = (Object[])datasource.selectRows("select * from example_table");
See also
select()
Note
This method returns all the data available immediately; to process query data piecewise, use the SQLStatement class

◆ vexec()

Object org.qore.lang.AbstractDatasource.vexec ( String  sql,
Object []  vargs 
) throws Throwable
inline

Executes an SQL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values), taking a list for all bind arguments.

Same as exec() except takes an explicit list for bind arguments

Parameters
sqlThe SQL command to execute on the server
vargsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
The return value depends on the DBI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the SQL statement. For all other commands, normally an integer row count is returned. However, some DBI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
Example:
int rows = datasource.vexec("insert into example_table value (%v, %v, %v)", arg_list);

◆ vselect()

Object org.qore.lang.AbstractDatasource.vselect ( String  sql,
Object []  vargs 
) throws Throwable
inline

Executes a select statement on the server and returns the results in a hash (column names) of lists (column values per row), taking a list for all bind arguments.

The usual return format of this method is suitable for use with context statements, for easy iteration and processing of query results. Alternatively, the HashListIterator class can be used to iterate the return value of this method.

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
vargsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
Normally returns a hash (the keys are the column names) of list (each hash key's value is a list giving the row data), however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned. If no rows are found, a hash of column names assigned to empty lists is returned.
Example:
Map<String, Object> query = (Map<String, Object>)datasource.vselect("select * from example_table where id = %v and name = %v", arg_list);
See also
select()
Note
This method returns all the data available immediately; to process query data piecewise, use the SQLStatement class

◆ vselectRow()

Object org.qore.lang.AbstractDatasource.vselectRow ( String  sql,
Object []  vargs 
) throws Throwable
inline

Executes a select statement on the server and returns the first row as a hash (column names and values), taking a list for all bind arguments.

This method is the same as the selectRow() method, except this method takes a single argument after the SQL command giving the list of bind value parameters

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute on the server
vargsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
This method normally returns a hash (the keys are the column names) of row data or null if no row is found for the query when executed with an SQL select statement, however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned
Example:
Map<String, Object> h = (Map<String, Object>)datasource.vselectRow("select * from example_table where id = %v and type = %v", arg_list);
See also
selectRow()

◆ vselectRows()

Object org.qore.lang.AbstractDatasource.vselectRows ( String  sql,
Object []  vargs 
) throws Throwable
inline

Executes a select statement on the server and returns the results in a list (rows) of hashes (column names and values), taking a list for all bind arguments.

Same as the selectRows() method, except this method takes a single argument after the SQL command giving the list of bind value parameters.

The usual return value of this method can be iterated with the ListHashIterator class.

The return format of this method is not as memory efficient as that returned by the select() method, therefore for larger amounts of data, it is recommended to use select().

This method also accepts all bind parameters (%d, %v, etc) as documented in Binding by Value and Placeholder

To execute select statements that begin a transaction (such as "select for update"), execute beginTransaction() first to signal that a transaction is starting; this is particularly important when the object is shared among more than one thread.

Parameters
sqlThe SQL command to execute
vargsInclude any values to be bound (using v in the command string) or placeholder specifications (using :key_name in the command string) in order after the command string
Returns
Normally returns a list (rows) of hash (where the keys are the column names of each row) or null if no rows are found for the query, however some DBI drivers allow any SQL statement to be executed through this method (not only select statements), in this case other data types can be returned
Example:
Object[] list = (Object[])datasource.vselectRows("select * from example_table where id = %v and type = %v", arg_list);
See also
selectRows()
Note
This method returns all the data available immediately; to process query data piecewise, use the SQLStatement class

The documentation for this class was generated from the following file: