DBIx::Renderer::Constants - constants for the DBI rendering framework


NAME

DBIx::Renderer::Constants - constants for the DBI rendering framework


SYNOPSIS

    use DBIx::Renderer ':all';
    # mandatory name
    use constant TYPE_MANDNAME => ( VARCHAR(255), NOTNULL );
    my $struct = [
            category => [
                    id        => { TYPE_ID },
                    name      => { TYPE_MANDNAME },
                    parent_id => { INT4, INDEX },
                ],
    ];


DESCRIPTION

This module defines a range of constants and helper functions for use in writing and talking to DBI renderers. Typically you won't use this module directly, but import ':all' from DBIx::Renderer, which passes this module's exports along.


EXPORTS

The following constants and functions are exported:

INT4 FLOAT4 TEXT BOOL TIMESTAMP
Constants for those data types; specific DBI renderers can then decide how to render these constants in their SQL dialect. Actually they return a hash element consisting of the key 'type' and the actual constant as the value, so it doesn't make sense to specify more than one type; the last one specified wins.

CHAR($size) VARCHAR($size)
These aren't actually constants but functions that take the size as a parameter, as shown in the synopsis. In addition to the 'type' hash key and its value, these functions also return a 'size' hash key and its value.

DEFAULT
Like CHAR and VARCHAR, this function returns a hash element with 'DEFAULT' as its key (as every field can have only one default value) and the actual default as its value.

NOTNULL UNIQUE PK INDEX
Defines constants for marking a field to be not nullable or to be unique, or for specifying that this field is a primary key or that it should be indexed. Per usual, these constants are a hash element with the constant's name as the key and 1 as its value.

TYPE_ID TYPE_FK
These two are ``complex'' types; a TYPE_ID being a not-nullable primary key of type int4, and TYPE_FK being a notnullable int4 used as a foreign key into some other table.

get_types()
Returns a list of all possible data types.

get_attrs()
Returns a list of all possible field attributes (such as 'not nullable', 'unique value', 'has a default value').

get_markers()
Returns a list of all field markers (such as 'primary key' or 'indexed field').


BUGS

None known so far. If you find any bugs or oddities, please do inform the author.


AUTHOR

Marcel Grünauer <marcel@codewerk.com>


COPYRIGHT

Copyright 2001 Marcel Grünauer. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


SEE ALSO

perl(1), DBI(3pm), DBIx::Renderer(3pm).

 DBIx::Renderer::Constants - constants for the DBI rendering framework