SQL::Engine::Grammar::Mysql - Grammar For MySQL
SQL::Engine Grammar For MySQL
use SQL::Engine::Grammar::Mysql; my $grammar = SQL::Engine::Grammar::Mysql->new( schema => { select => { from => { table => 'users' }, columns => [ { column => '*' } ] } } ); # $grammar->execute;
This package provides methods for converting json-sql data structures into MySQL statements.
This package inherits behaviors from:
SQL::Engine::Grammar
This package uses type constraints from:
Types::Standard
This package implements the following methods:
column_change(HashRef $data) : Object
The column_change method generates SQL statements to change a column definition.
my $grammar = SQL::Engine::Grammar::Mysql->new( schema => { 'column-change' => { for => { table => 'users' }, column => { name => 'accessed', type => 'datetime', nullable => 1 } } } ); $grammar->column_change($grammar->schema->{'column-change'});
transaction(HashRef $data) : Object
The transaction method generates SQL statements to commit an atomic database transaction.
my $grammar = SQL::Engine::Grammar::Mysql->new( schema => { 'transaction' => { queries => [ { 'table-create' => { name => 'users', columns => [ { name => 'id', type => 'integer', primary => 1 } ] } } ] } } ); $grammar->transaction($grammar->schema->{'transaction'});
type_binary(HashRef $data) : Str
The type_binary method returns the SQL expression representing a binary data type.
# given: synopsis $grammar->type_binary({}); # blob
type_boolean(HashRef $data) : Str
The type_boolean method returns the SQL expression representing a boolean data type.
# given: synopsis $grammar->type_boolean({}); # tinyint(1)
type_char(HashRef $data) : Str
The type_char method returns the SQL expression representing a char data type.
# given: synopsis $grammar->type_char({}); # char(1)
type_date(HashRef $data) : Str
The type_date method returns the SQL expression representing a date data type.
# given: synopsis $grammar->type_date({}); # date
type_datetime(HashRef $data) : Str
The type_datetime method returns the SQL expression representing a datetime data type.
# given: synopsis $grammar->type_datetime({}); # datetime
type_datetime_wtz(HashRef $data) : Str
The type_datetime_wtz method returns the SQL expression representing a datetime (and timezone) data type.
# given: synopsis $grammar->type_datetime_wtz({}); # datetime
type_decimal(HashRef $data) : Str
The type_decimal method returns the SQL expression representing a decimal data type.
# given: synopsis $grammar->type_decimal({}); # decimal(5, 2)
type_double(HashRef $data) : Str
The type_double method returns the SQL expression representing a double data type.
# given: synopsis $grammar->type_double({}); # double(5, 2)
type_enum(HashRef $data) : Str
The type_enum method returns the SQL expression representing a enum data type.
# given: synopsis $grammar->type_enum({ options => ['light', 'dark'] }); # enum('light', 'dark')
type_float(HashRef $data) : Str
The type_float method returns the SQL expression representing a float data type.
# given: synopsis $grammar->type_float({}); # double(1, 1)
type_integer(HashRef $data) : Str
The type_integer method returns the SQL expression representing a integer data type.
# given: synopsis $grammar->type_integer({}); # int
type_integer_big(HashRef $data) : Str
The type_integer_big method returns the SQL expression representing a big-integer data type.
# given: synopsis $grammar->type_integer_big({}); # bigint
type_integer_big_unsigned(HashRef $data) : Str
The type_integer_big_unsigned method returns the SQL expression representing a big unsigned integer data type.
# given: synopsis $grammar->type_integer_big_unsigned({}); # bigint unsigned
type_integer_medium(HashRef $data) : Str
The type_integer_medium method returns the SQL expression representing a medium integer data type.
# given: synopsis $grammar->type_integer_medium({}); # mediumint
type_integer_medium_unsigned(HashRef $data) : Str
The type_integer_medium_unsigned method returns the SQL expression representing a unsigned medium integer data type.
# given: synopsis $grammar->type_integer_medium_unsigned({}); # mediumint unsigned
type_integer_small(HashRef $data) : Str
The type_integer_small method returns the SQL expression representing a small integer data type.
# given: synopsis $grammar->type_integer_small({}); # smallint
type_integer_small_unsigned(HashRef $data) : Str
The type_integer_small_unsigned method returns the SQL expression representing a unsigned small integer data type.
# given: synopsis $grammar->type_integer_small_unsigned({}); # smallint unsigned
type_integer_tiny(HashRef $data) : Str
The type_integer_tiny method returns the SQL expression representing a tiny integer data type.
# given: synopsis $grammar->type_integer_tiny({}); # tinyint
type_integer_tiny_unsigned(HashRef $data) : Str
The type_integer_tiny_unsigned method returns the SQL expression representing a unsigned tiny integer data type.
# given: synopsis $grammar->type_integer_tiny_unsigned({}); # tinyint unsigned
type_integer_unsigned(HashRef $data) : Str
The type_integer_unsigned method returns the SQL expression representing a unsigned integer data type.
# given: synopsis $grammar->type_integer_unsigned({}); # int unsigned
type_json(HashRef $data) : Str
The type_json method returns the SQL expression representing a json data type.
# given: synopsis $grammar->type_json({}); # json
type_number(HashRef $data) : Str
The type_number method returns the SQL expression representing a number data type.
# given: synopsis $grammar->type_number({}); # int
type_string(HashRef $data) : Str
The type_string method returns the SQL expression representing a string data type.
# given: synopsis $grammar->type_string({}); # varchar(255)
type_text(HashRef $data) : Str
The type_text method returns the SQL expression representing a text data type.
# given: synopsis $grammar->type_text({}); # text
type_text_long(HashRef $data) : Str
The type_text_long method returns the SQL expression representing a long text data type.
# given: synopsis $grammar->type_text_long({}); # longtext
type_text_medium(HashRef $data) : Str
The type_text_medium method returns the SQL expression representing a medium text data type.
# given: synopsis $grammar->type_text_medium({}); # mediumtext
type_time(HashRef $data) : Str
The type_time method returns the SQL expression representing a time data type.
# given: synopsis $grammar->type_time({}); # time
type_time_wtz(HashRef $data) : Str
The type_time_wtz method returns the SQL expression representing a time (and timezone) data type.
# given: synopsis $grammar->type_time_wtz({}); # time
type_timestamp(HashRef $data) : Str
The type_timestamp method returns the SQL expression representing a timestamp data type.
# given: synopsis $grammar->type_timestamp({}); # timestamp
type_timestamp_wtz(HashRef $data) : Str
The type_timestamp_wtz method returns the SQL expression representing a timestamp (and timezone) data type.
# given: synopsis $grammar->type_timestamp_wtz({}); # timestamp
type_uuid(HashRef $data) : Str
The type_uuid method returns the SQL expression representing a uuid data type.
# given: synopsis $grammar->type_uuid({}); # char(36)
wrap(Str $name) : Str
The wrap method returns a SQL-escaped string.
# given: synopsis $grammar->wrap('field'); # "field"
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install SQL::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::Engine
CPAN shell
perl -MCPAN -e shell install SQL::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.