.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Alzabo::QuickRef 3pm" .TH Alzabo::QuickRef 3pm "2013-12-26" "perl v5.18.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Alzabo::QuickRef \- A quick reference to methods in the Alzabo classes .SH "GENERAL" .IX Header "GENERAL" This reference is intended to provide a quick reference to \fIsome\fR of the more commonly used methods that Alzabo provides. In addition, this reference can give you an idea of what classes contain certain \&\fItypes\fR of methods, so you have an idea of where to look in order to figure out how to achieve a certain task. .SS "Alzabo, Alzabo::Create, and Alzabo::Runtime" .IX Subsection "Alzabo, Alzabo::Create, and Alzabo::Runtime" These modules are mostly used just to load other modules. The \&\f(CW\*(C`Alzabo::Runtime\*(C'\fR module can be used to preload schemas at compile time by doing: .PP .Vb 1 \& use Alzabo::Runtime qw( schema1 schema2 schema3 ); .Ve .SS "Alzabo::MethodMaker" .IX Subsection "Alzabo::MethodMaker" This module can be used to generate many useful convenience methods. This is done by auto-generating methods in new packages and re-blessing some of the schema objects into these packages. To have it generate all the possible methods for a schema you would do: .PP .Vb 5 \& use Alzabo::MethodMaker ( schema => \*(Aqsome_schema\*(Aq, \& # Root for new packages \& class_root => \*(AqMy::Data\*(Aq, \& # Make all possible methods \& all => 1 ); .Ve .PP This will make convenience methods for such things as getting table and column objects, following various types of foreign keys, and getting data from row objects. .SH "METHODS" .IX Header "METHODS" .SS "Retrieving data" .IX Subsection "Retrieving data" \fIAlzabo::Runtime::Schema\fR .IX Subsection "Alzabo::Runtime::Schema" .PP This object allows you to connect to the database. It contains several data retrieval methods including \&\f(CW\*(C`join\*(C'\fR. .IP "\(bu" 4 load_from_file .Sp Load an existing schema object from disk. Returns a new schema object. .IP "\(bu" 4 set_user ($user) .Sp Set the username to be used when connecting to the database. .IP "\(bu" 4 set_password ($password) .Sp Set the password to be used when connecting to the database. .IP "\(bu" 4 set_host ($host) .Sp Set the host to be used when connecting to the database. .IP "\(bu" 4 connect (%params) .Sp Connect to the \s-1RDBMS. \s0 This will use the previously set username/password/host, though these can be overridden by the \&\f(CW%params\fR given to the call. .Sp \&\fBImportant\fR: This method must be called before any data retrieval is attempted. .IP "\(bu" 4 join .Sp Fetch rows from one or more tables based on a table join. Returns either a \f(CW\*(C`Alzabo::Runtime::RowCursor\*(C'\fR or \f(CW\*(C`Alzabo::Runtime::JoinCursor\*(C'\fR object. .IP "\(bu" 4 function/select .Sp Allows you to execute arbitrary column aggregate \s-1SQL\s0 functions such as \&\f(CW\*(C`AVG\*(C'\fR or \f(CW\*(C`MAX\*(C'\fR with a multi-table join. .IP "\(bu" 4 table ($name) .Sp Returns an \f(CW\*(C`Alzabo::Runtime::Table\*(C'\fR object. This is important because most of the row fetching operations are table object methods. .PP \fIAlzabo::Runtime::Table\fR .IX Subsection "Alzabo::Runtime::Table" .PP Objects in this class have methods allowing you to insert new rows as well as retrieving exist data in the form of \&\f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR or \&\f(CW\*(C`Alzabo::Runtime::RowCursor\*(C'\fR objects. .PP All methods that return a single row return an \&\f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR object. .PP All methods that return multiple rows return an \&\f(CW\*(C`Alzabo::Runtime::RowCursor\*(C'\fR object. .PP All methods that return rows can be given the \f(CW\*(C`no_cache\*(C'\fR parameter, which ensures that the row(s) returned will not be cached. Rows obtained in this manner should not be updated or deleted, as this will play havoc with the caching system. See the \&\f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR documentation for more details. .PP All methods that return multiple rows in the form of a cursor object can take an \f(CW\*(C`order_by\*(C'\fR parameter. See the \&\f(CW\*(C`Alzabo::Runtime::Table\*(C'\fR documentation for more details. .IP "\(bu" 4 insert .Sp Insert a new row and return it. .IP "\(bu" 4 row_by_pk .Sp Returns the row identified by the primary key give. .IP "\(bu" 4 rows_where .Sp Retrieves a set of rows based on a where clause. Please see the method documentation for details on how where clauses are constructed. .IP "\(bu" 4 all_rows .Sp Retrieves all the rows in the table. .IP "\(bu" 4 function/select .Sp Allows you to execute arbitrary column aggregate \s-1SQL\s0 functions such as \&\f(CW\*(C`AVG\*(C'\fR or \f(CW\*(C`MAX\*(C'\fR. .IP "\(bu" 4 potential_row .Sp Make a new \f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR in the \&\*(L"potential\*(R" state. .PP \fIAlzabo::Runtime::Row\fR .IX Subsection "Alzabo::Runtime::Row" .PP Objects in this class represent a single row of data. You can retrieve the actual column values from it, update it, or delete it. .IP "\(bu" 4 select (@list_of_column_names) .Sp Given a list of column names, this method returns the values for those columns. .IP "\(bu" 4 update (%hash_of_columns_and_values) .Sp Given a hash of columns and values, this method will update the database and the object to match those values. .IP "\(bu" 4 delete .Sp Deletes the row from the database. Further attempts to retrieve data from this row will throw an exception. .IP "\(bu" 4 rows_by_foreign_key .Sp Given a foreign key object from the row's table to another table, returns either an \f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR object or an \&\f(CW\*(C`Alzabo::Runtime::RowCursor\*(C'\fR object for the row(s) in the table to which the relationship exists, based on the value of the relevant column(s) in the current row. .Sp This method can also take a \f(CW\*(C`no_cache\*(C'\fR and/or \f(CW\*(C`order_by\*(C'\fR parameter. .PP \fIAlzabo::Runtime::RowCursor\fR .IX Subsection "Alzabo::Runtime::RowCursor" .PP Objects in this class are used to return multiple rows as a cursor, rather than as a list. This is much more efficient, at the expense of a few extra lines in your code. .IP "\(bu" 4 next .Sp Returns the next \f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR object, or undef if there are no more. .IP "\(bu" 4 all_rows .Sp Returns a list of all the remaining \&\f(CW\*(C`Alzabo::Runtime::Row\*(C'\fR objects, or an empty list if there are no more. .SS "Creating/removing a schema" .IX Subsection "Creating/removing a schema" \fIAlzabo::Create::Schema\fR .IX Subsection "Alzabo::Create::Schema" .PP This object represents a schema, and contains one or more table objects. It is only used when creating or altering a schema, as opposed to when fetching data. Data manipulation is done via the \&\f(CW\*(C`Alzabo::Runtime::*\*(C'\fR classes. .IP "\(bu" 4 reverse_engineer .Sp Connect to a database and reverse engineer a schema. Returns a new schema object. .IP "\(bu" 4 load_from_file .Sp Load an existing schema object from disk. Returns a new schema object. .IP "\(bu" 4 create .Sp If the schema has not yet been instantiated in an \s-1RDBMS,\s0 this method will instantiate the schema. If it has been previously instantiated, it will bring the schema in the \s-1RDBMS\s0 into sync with its object representation (altering tables/columns, etc.) Where possible, exist data will be preserved. .IP "\(bu" 4 make_sql .Sp Returns an array, each element of which is a \s-1SQL\s0 statement. The \s-1SQL\s0 is either the \s-1SQL\s0 to create the schema from scratch or the \s-1SQL\s0 needed to update the \s-1RDBMS\s0 to match the current object. See the \&\f(CW\*(C`create\*(C'\fR method for more details. .IP "\(bu" 4 drop .Sp Drop the database from the \s-1RDBMS\s0 where it was created. Does not remove the schema object itself from disk. .IP "\(bu" 4 delete .Sp Delete the schema object files from disk. Does not drop the database from the \s-1RDBMS.\s0 .SH "AUTHOR" .IX Header "AUTHOR" Dave Rolsky,