DBIx::EnumConstraints 0.01
Sponsored Links
DBIx::EnumConstraints 0.01 Ranking & Summary
File size:
0.010 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
822
Date added:
2007-07-24
Publisher:
Boris Sukholitko
DBIx::EnumConstraints 0.01 description
DBIx::EnumConstraints is a Perl module that generates enum-like SQL constraints.
SYNOPSIS
use DBIx::EnumConstraints;
my $ec = DBIx::EnumConstraints->new({
name => kind, fields => [ [ k1, a, b ]
, [ k2, b ] ]
});
# get enum field definition
my $edef = $ec->enum_definition;
# $edef is now kind smallint not null check (kind > 0 and kind < 2)
# get constraints array
my @cons = $ec->constraints;
# @cons is now (
# constraint k1_has_a check (kind <> 1 or a is not null)
# , constraint k1_has_b check (kind <> 1 or a is not null)
# , constraint k2_has_b check (kind <> 2 or b is not null)
# , constraint k2_has_no_a check (kind <> 2 or a is null))
This module generates SQL statements for enforcing enum semantics on the database columns.
Enum columns is the column which can get one of 1 .. k values. For each of those values there are other columns which should or should not be null.
For example in the SYNOPSIS above, when kind column is 1 the row should have both of a and b columns not null. When kind column is 2 the row should have a but no b columns.
CONSTRUCTORS
$class->new($args)
$args should be HASH reference containing the following parameters:
name
The name of the enum.
fields
Array of arrays describing fields dependent on the enum. Each row is index is the possible value of enum minus 1 (e.g. row number 1 is for enum value 2).
First item in the array is the state name. The rest of the items are field names. There is a possibility to mark optional fields by using trailing ? (e.g. b? denotes an optional b field.
METHODS
$self->enum_definition
Returns the definition of enum column. See SYNOPSIS for example.
$self->for_each_kind($callback)
Runs $callback over registered enum states. For each state passes state name, fields which are in the state and fields which are out of the state.
The fields are passed as ARRAY references.
$self->constraints
Returns the list of generated constraints. See SYNOPSIS above for an example.
SYNOPSIS
use DBIx::EnumConstraints;
my $ec = DBIx::EnumConstraints->new({
name => kind, fields => [ [ k1, a, b ]
, [ k2, b ] ]
});
# get enum field definition
my $edef = $ec->enum_definition;
# $edef is now kind smallint not null check (kind > 0 and kind < 2)
# get constraints array
my @cons = $ec->constraints;
# @cons is now (
# constraint k1_has_a check (kind <> 1 or a is not null)
# , constraint k1_has_b check (kind <> 1 or a is not null)
# , constraint k2_has_b check (kind <> 2 or b is not null)
# , constraint k2_has_no_a check (kind <> 2 or a is null))
This module generates SQL statements for enforcing enum semantics on the database columns.
Enum columns is the column which can get one of 1 .. k values. For each of those values there are other columns which should or should not be null.
For example in the SYNOPSIS above, when kind column is 1 the row should have both of a and b columns not null. When kind column is 2 the row should have a but no b columns.
CONSTRUCTORS
$class->new($args)
$args should be HASH reference containing the following parameters:
name
The name of the enum.
fields
Array of arrays describing fields dependent on the enum. Each row is index is the possible value of enum minus 1 (e.g. row number 1 is for enum value 2).
First item in the array is the state name. The rest of the items are field names. There is a possibility to mark optional fields by using trailing ? (e.g. b? denotes an optional b field.
METHODS
$self->enum_definition
Returns the definition of enum column. See SYNOPSIS for example.
$self->for_each_kind($callback)
Runs $callback over registered enum states. For each state passes state name, fields which are in the state and fields which are out of the state.
The fields are passed as ARRAY references.
$self->constraints
Returns the list of generated constraints. See SYNOPSIS above for an example.
DBIx::EnumConstraints 0.01 Screenshot
DBIx::EnumConstraints 0.01 Keywords
DBIx
EnumConstraints
SQL
SYNOPSIS
EnumConstraints 0.01
NOT NULL
sql constraints
Perl module
ENUM
kind
b
constraints
fields
null
DBIx::EnumConstraints
DBIxEnumConstraints
Bookmark DBIx::EnumConstraints 0.01
DBIx::EnumConstraints 0.01 Copyright
WareSeeker periodically updates pricing and software information of DBIx::EnumConstraints 0.01 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of DBIx::EnumConstraints 0.01 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
theory of constraints
constraints in sql
definition of constraints
sql not null
ethyl benzene constraints
constraints inventor
project constraints
constraints definition
not null sql
define constraints
theory constraints
kinder
enumclaw hospital
constraints in oracle
example of constraints
time constraints
oracle not null
fieldstone mortgage
Related Software
Declare::Constraints::Simple is a Perl module for Declarative Validation of Data Structures. Free Download
DBIx::CGITables is a Perl module for easy DB access from a CGI. Free Download
DBIx::Version is a Perl extension for getting database software name and version. Free Download
DBIx::Wrapper::Config Perl module allows the use of a configuration file in XML specifying information. Free Download
DBIx::SQL::Abstract is a Perl module that provides a convenient abstraction layer to a database. Free Download
DBIx::Recordset is a Perl extension for DBI recordsets. Free Download
DBIx::DBStag is a Perl module for Relational Database to Hierarchical (Stag/XML) Mapping. Free Download
Data::FormValidator::Constraints is a Perl module with basic sets of constraints on input profile. Free Download
Latest Software
Popular Software
Favourite Software