| Alzabo::SQLMaker(3pm) | User Contributed Perl Documentation | Alzabo::SQLMaker(3pm) |
NAME¶
Alzabo::SQLMaker - Alzabo base class for RDBMS driversSYNOPSIS¶
use Alzabo::SQLMaker::MySQL;
my $sql = Alzabo::SQLMaker::MySQL->new( driver => $driver_object );
# or better yet
my $sql = $runtime_schema->sqlmaker;
DESCRIPTION¶
This is the base class for all Alzabo::SQLMaker modules. To instantiate a driver call this class's "new" method. See "SUBCLASSING Alzabo::SQLMaker" for information on how to make a driver for the RDBMS of your choice.METHODS¶
available Returns A list of names representing the available "Alzabo::SQLMaker" subclasses. Any one of these names would be appropriate as a parameter for the "Alzabo::SQLMaker->load()" method.- * driver
- The driver object being used by the schema.
- * quote_identifiers
- A boolean value indicating whether or not identifiers should be quoted. This defaults to false.
GENERATING SQL¶
This class can be used to generate SQL by calling methods that are the same as those used in SQL ("select()", "update()", etc.) in sequence, with the appropriate parameters. There are four entry point methods, "select()", "insert()", "update()", and "delete()". Attempting to call any other method without first calling one of these is an error."from()"
"** function"
"into()"
"set()"
"from()"
Alzabo::SQLMaker->select($column)->from($table)->where($other_column, '>', 2);
"select()"
"** function"
"delete()"
Followed by:
"where()"">
"order_by()"
Throws: "Alzabo::Exception::SQL"
"from()"
Followed by:
"and()"
"or()"
"order_by()"
Throws: "Alzabo::Exception::SQL"
"where()"">
"and()"
"or()"
Followed by:
"and()"
"or()"
"order_by()"
Throws: "Alzabo::Exception::SQL"
"from()"
"where()"">
"and()"
"or()"
Followed by:
"limit()"
Throws: "Alzabo::Exception::SQL"
"from()"
"where()"">
"and()"
"or()"
"order_by()"
"Alzabo::Exception::SQL"
"insert()"
Followed by:
"values()"
Throws: "Alzabo::Exception::SQL"
"into()"
Throws: "Alzabo::Exception::SQL"
"update()"
Followed by:
"where()"">
Throws: "Alzabo::Exception::SQL"
RETRIEVING SQL FROM THE OBJECT¶
sql This method can be called at any time, though obviously it will not return valid SQL unless called at a natural end point. In the future, an exception may be thrown if called when the SQL is not in a valid state. Returns the SQL generated so far as a string.SUBCLASSING Alzabo::SQLMaker¶
To create a subclass of "Alzabo::SQLMaker" for your particular RDBMS requires only that the virtual methods listed below be implemented. In addition, you may choose to override any of the other methods described in this documentation. For example, the MySQL subclass override the "_subselect()" method because MySQL cannot support sub-selects. Subclasses are also expected to offer for export various sets of functions matching SQL functions. See the "Alzabo::SQLMaker::MySQL" subclass implementation for details.VIRTUAL METHODS¶
The following methods must be implemented by the subclass:AUTHOR¶
Dave Rolsky, <dave@urth.org>| 2007-12-23 | perl v5.8.8 |