Alzabo::SQLMaker::MySQL(3pm) User Contributed Perl Documentation Alzabo::SQLMaker::MySQL(3pm)NAME
Alzabo::SQLMaker::MySQL - Alzabo SQL making class for MySQL
SYNOPSIS
use Alzabo::SQLMaker;
my $sql = Alzabo::SQLMaker->new( sql => 'MySQL' );
DESCRIPTION
This class implementes MySQL-specific SQL creation. MySQL does not allow subselects. Any attempt to use a subselect (by passing an "Alz-
abo::SQMaker" object in as parameter to a method) will result in an "Alzabo::Exception::SQL" error.
METHODS
Almost all of the functionality inherited from Alzabo::SQLMaker is used as is. The only overridden methods are "limit()" and
"get_limit()", as MySQL does allow for a "LIMIT" clause in its SQL.
EXPORTED SQL FUNCTIONS
SQL may be imported by name or by tags. They take arguments as documented in the MySQL documentation (version 3.23.39). The functions
(organized by tag) are:
:math
PI
RAND
MOD
ROUND
POW
POWER
ATAN2
ABS
SIGN
FLOOR
CEILING
EXP
LOG
LOG10
SQRT
COS
SIN
TAN
ACOS
ASIN
ATAN
COT
DEGREES
RADIANS
TRUNCATE
:string
CHAR
POSITION
INSTR
LEFT
RIGHT
FIND_IN_SET
REPEAT
LEAST
GREATEST
CONCAT
ELT
FIELD
MAKE_SET
LOCATE
SUBSTRING
CONV
LPAD
RPAD
MID
SUBSTRING_INDEX
REPLACE
CONCAT_WS
EXPORT_SET
INSERT
ASCII
ORD
BIN
OCT
HEX
LENGTH
OCTET_LENGTH
CHAR_LENGTH
CHARACTER_LENGTH
TRIM
LTRIM
RTRIM
SOUNDEX
SPACE
REVERSE
LCASE
LOWER
UCASE
UPPER
:datetime
CURDATE
CURRENT_DATE
CURTIME
CURRENT_TIME
NOW
SYSDATE
CURRENT_TIMESTAMP
UNIX_TIMESTAMP
WEEK
PERIOD_ADD
PERIOD_DIFF
DATE_ADD
DATE_SUB
ADDDATE
SUBDATE
DATE_FORMAT
TIME_FORMAT
FROM_UNIXTIME
DAYOFWEEK
WEEKDAY
DAYOFYEAR
MONTH
DAYNAME
MONTHNAME
QUARTER
YEAR
YEARWEEK
HOUR
MINUTE
SECOND
TO_DAYS
FROM_DAYS
SEC_TO_TIME
TIME_TO_SEC
:aggregate
These are functions which operate on an aggregate set of values all at once.
COUNT
AVG
MIN
MAX
SUM
STD
STDDEV
:system
These are functions which return information about the MySQL server.
DATABASE
USER
SYSTEM_USER
SESSION_USER
VERSION
CONNECTION_ID
LAST_INSERT_ID
GET_LOCK
RELEASE_LOCK
BENCHMARK
MASTER_POS_WAIT
:control
These are flow control functions:
IFNULL
NULLIF
IF
:misc
These are functions which don't fit into any other categories.
ENCRYPT
ENCODE
DECODE
FORMAT
INET_NTOA
INET_ATON
BIT_OR
BIT_AND
PASSWORD
MD5
LOAD_FILE
:fulltext
These are functions related to MySQL's fulltext searching capabilities.
MATCH
AGAINST
IN_BOOLEAN_MODE
NOTE: In MySQL 4.0 and greater, it is possible to say that a search is in boolean mode in order to change how MySQL handles the argument
given to AGAINST. This will not work with earlier versions.
:common
These are functions from other groups that are most commonly used.
NOW
COUNT
AVG
MIN
MAX
SUM
DISTINCT
AUTHOR
Dave Rolsky, <dave@urth.org>
perl v5.8.8 2007-12-23 Alzabo::SQLMaker::MySQL(3pm)
Check Out this Related Man Page
Alzabo::Create::Index(3pm) User Contributed Perl Documentation Alzabo::Create::Index(3pm)NAME
Alzabo::Create::Index - Index objects for schema creation
SYNOPSIS
use Alzabo::Create::Index;
DESCRIPTION
This object represents an index on a table. Indexes consist of columns and optional prefixes for each column. The prefix specifies how
many characters of the columns should be indexes (the first X chars). Some RDBMS's do not have a concept of index prefixes. Not all col-
umn types are likely to allow prefixes though this depends on the RDBMS. The order of the columns is significant.
INHERITS FROM
"Alzabo::Index"
Note: all relevant documentation from the superclass has been merged into this document.
METHODS
new
The constructor takes the following parameters:
* table => "Alzabo::Create::Table" object
The table that this index is indexing.
* columns => [ "Alzabo::Create::Column" object, .. ]
* columns => [ { column => "Alzabo::Create::Column" object, prefix => $prefix }, repeat as needed ... ]
This parameter indicates which columns that are being indexed. It can either be an array reference of column objects, or an array ref-
erence of hash references, each with a key called column and one called prefix.
The prefix key is optional.
* unique => $boolean
Indicates whether or not this is a unique index.
* fulltext => $boolean
Indicates whether or not this is a fulltext index.
* function => $string
This can be used to create a function index where supported. The value of this parameter should be the full function, with column
names, such as "LCASE( username )".
The "columns" parameter should include all the columns used in the function.
Returns a new "Alzabo::Create::Index" object.
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
table
Returns the "Alzabo::Create::Table" object to which the index belongs.
columns
Returns an ordered list of the "Alzabo::Create::Column" objects that are being indexed.
add_column
Adds a column to the index.
This method takes the following parameters:
* column => "Alzabo::Create::Column" object
* prefix => $prefix (optional)
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
delete_column ("Alzabo::Create::Column" object)
Deletes the given column from the index.
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
prefix ("Alzabo::Create::Column" object)
A column prefix is, to the best of my knowledge, a MySQL specific concept, and as such cannot be set when using an RDBMSRules module for a
different RDBMS. However, it is important enough for MySQL to have the functionality be present. It allows you to specify that the index
should only look at a certain portion of a field (the first N characters). This prefix is required to index any sort of BLOB column in
MySQL.
This method returns the prefix for the column in the index. If there is no prefix for this column in the index, then it returns undef.
set_prefix
This method takes the following parameters:
* column => "Alzabo::Create::Column" object
* prefix => $prefix
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
unique
Returns a boolean value indicating whether the index is a unique index.
set_unique ($boolean)
Sets whether or not the index is a unique index.
fulltext
Returns a boolean value indicating whether the index is a fulltext index.
set_fulltext ($boolean)
Set whether or not the index is a fulltext index.
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
register_column_name_change
This method takes the following parameters:
* column => "Alzabo::Create::Column" object
The column (with the new name already set).
* old_name => $old_name
This method is called by the table object which owns the index when a column name changes. You should never need to call this yourself.
Throws: "Alzabo::Exception::Params"
id
The id is generated from the table, column and prefix information for the index. This is useful as a canonical name for a hash key, for
example.
Returns a string that is the id which uniquely identifies the index in this schema.
AUTHOR
Dave Rolsky, <autarch@urth.org>
perl v5.8.8 2007-12-23 Alzabo::Create::Index(3pm)