Quotes a value for insertion/update or selection when bound parameters are inappropriate or unavailable. Returns 'NULL' if $value is undef, otherwise calls quote( $value, $type ) on the DBI handle $db.

Drivers that do not implement the two-argument form of quote() should override this method.

Executes a SELECT. Return value depends on what you ask for. Many of the parameters are optional unless you pass in SQL to execute.

Parameters:

sql ($) (optional)

Full statement to execute, although you may put '?' in the where clause and pass values for substitution. (No quoting hassles...)

select (\@) (optional unless 'sql' defined)

Fields to select

select_modifier ($) (optional)

Clause to insert between 'SELECT' and fields (e.g., DISTINCT)

from (\@ or $) (optional unless 'sql' defined)

List of tables to select from. (You can pass a single tablename as a scalar if you wish.)

order ($) (optional)

Clause to order results by; if not given, the order depends entirely on the database.

group ($) (optional)

Clause to group results by (in a 'GROUP BY' clause). This is normally only done with 'COUNT(*)' and such features. See your favorite SQL reference for more info.

where ($) (optional unless 'sql' defined)

Clause to limit results. Note that you can use '?' for field values but they will get quoted as if they were a SQL_VARCHAR type of value.

return ($) (optional)

What the method should return. Potential values are:

'list': returns an arrayref of arrayrefs (default)

'single': returns a single arrayref

'hash': returns an arrayref of hashrefs

'single-list': returns an arrayref with the first value of each record as the element.

'sth': Returns a DBI statement handle that has been prepared and executed with the proper values. Use this if you are executing a query that may return a lot of rows but you only want to retrieve values for some of the rows.

value (\@) (optional unless you use '?' placeholders)

List of values to bind, all as SQL_VARCHAR; they must match order of '?' in the where clause either passed in or within the SQL statement passed in.

Create and execute an INSERT statement given the parameters passed in. Return value is true is insert was successful -- the exact value is whatever is returned from the execute() statement handle call from your database. (See DBI and your driver docs.)

Parameters:

sql ($) (optional)

Full SQL statement to run; you can still pass in values to quote/bind if you use '?' in the statement.

Create and execute an UPDATE statement given the parameters passed in. Return value is true is update was successful -- the exact value is whatever is returned from the execute() statement handle call from your database, which many times is the number of rows affected by the update. (See DBI and your driver docs -- in particular, note that the return value from an UPDATE can vary depending on the database being used as well as the number of records actually updated versus those that matched the criteria but were not updated because they already matched the value(s). In particular, see the discussion in DBD::mysql under 'mysql_client_found_rows'.)

Parameters:

sql ($) (optional)

Full SQL statement to run; note that you can use '?' for values and pass in the raw values via the 'value' parameter, and they will be quoted as necessary.

field (\@) (optional unless 'sql' defined)

List of fieldnames we are updating

value (\@) (optional unless you use '?' placeholders)

List of values corresponding to the fields we are updating and to parameters in the WHERE clause.

Removes the record indicated by \%params from the database. Return value is true is delete was successful -- the exact value is whatever is returned from the execute() statement handle call from your database. (See DBI)

Parameters:

sql ($) (optional)

Full SQL statement to execute directly, although you can use '?' for values and pass the actual values in via the 'value' parameter.

table ($) (optional unless 'sql' defined)

Name of table from which we are removing records.

where ($) (optional unless 'sql' defined)

Specify the records we are removing. Be careful: if you pass in the table but not the criteria, you will clear out your table! (Just like real SQL...)

value (\@) (optional unless you use '?' placeholders)

List of values to bind to '?' that may be found either in the where clause passed in or in the where clause found in the SQL statement.

Retrieve field type information for $table. Normally we simply issue a dummy query to a particular table to get its schema -- field names and field types. We cache the information (in a SPOPS::DBI::TypeInfo object) and then query it for the different field types as we need them.

If a DBD driver does not support the {TYPE} attribute of the DBI statement handle, you have to specify some simple types in your class configuration or provide them either in the call to db_discover_types() or in the object configuration using the key 'dbi_type_info' as listed in the parameters below. (See SPOPS::DBI::TypeInfo for an enumeration of the the values to use.)

The name of a particular table. Note that this routine is not smart enough to distinguish between: users and dbo.users even though they might refer to the same table in the database. It is not harmful if you use the same name twice in this manner, the module just has to do a little extra work.

If your DBD driver cannot retrieve type information from the database, you need to give this module a hint as to what type of datatypes you will be working with. See Fake Types in SPOPS::DBI::TypeInfo for the types you can use.