NAME
SQL::SyntaxModel::SkipID - Use SQL::SyntaxModels without inputting Node IDs
COPYRIGHT AND LICENSE
This file is an optional part of the SQL::SyntaxModel library (libSQLSM).
SQL::SyntaxModel is Copyright (c) 1999-2003, Darren R. Duncan. All rights reserved. Address comments, suggestions, and bug reports to perl@DarrenDuncan.net, or visit "http://www.DarrenDuncan.net" for more information.
SQL::SyntaxModel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) version 2 as published by the Free Software Foundation (http://www.fsf.org/). You should have received a copy of the GPL as part of the SQL::SyntaxModel distribution, in the file named "LICENSE"; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
Any versions of SQL::SyntaxModel that you modify and distribute must carry prominent notices stating that you changed the files and the date of any changes, in addition to preserving this original copyright notice and other credits. SQL::SyntaxModel is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL for more details.
Linking SQL::SyntaxModel statically or dynamically with other modules is making a combined work based on SQL::SyntaxModel. Thus, the terms and conditions of the GPL cover the whole combination.
As a special exception, the copyright holders of SQL::SyntaxModel give you permission to link SQL::SyntaxModel with independent modules that are interfaces to or implementations of databases, regardless of the license terms of these independent modules, and to copy and distribute the resulting combined work under terms of your choice, provided that every copy of the combined work is accompanied by a complete copy of the source code of SQL::SyntaxModel (the version of SQL::SyntaxModel used to produce the combined work), being distributed under the terms of the GPL plus this exception. An independent module is a module which is not derived from or based on SQL::SyntaxModel, and which is fully useable when not linked to SQL::SyntaxModel in any form.
Note that people who make modified versions of SQL::SyntaxModel are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GPL gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
While it is by no means required, the copyright holders of SQL::SyntaxModel would appreciate being informed any time you create a modified version of SQL::SyntaxModel that you are willing to distribute, because that is a practical way of suggesting improvements to the standard version.
DEPENDENCIES
Perl Version:
5.004
Standard Modules:
Carp
Nonstandard Modules:
SQL::SyntaxModel 0.06 (parent class)
SYNOPSIS
use strict;
use warnings;
use SQL::SyntaxModel::SkipID;
my $model = SQL::SyntaxModel::SkipID->new();
$model->create_nodes( [ map { { 'NODE_TYPE' => 'data_type', 'ATTRS' => $_ } } (
{ 'name' => 'bin1k' , 'basic_type' => 'bin', 'size_in_bytes' => 1_000, },
{ 'name' => 'bin32k', 'basic_type' => 'bin', 'size_in_bytes' => 32_000, },
{ 'name' => 'str4' , 'basic_type' => 'str', 'size_in_chars' => 4, 'store_fixed' => 1,
'str_encoding' => 'asc', 'str_trim_white' => 1, 'str_latin_case' => 'uc',
'str_pad_char' => ' ', 'str_trim_pad' => 1, },
{ 'name' => 'str10' , 'basic_type' => 'str', 'size_in_chars' => 10, 'store_fixed' => 1,
'str_encoding' => 'asc', 'str_trim_white' => 1, 'str_latin_case' => 'pr',
'str_pad_char' => ' ', 'str_trim_pad' => 1, },
{ 'name' => 'str30' , 'basic_type' => 'str', 'size_in_chars' => 30,
'str_encoding' => 'asc', 'str_trim_white' => 1, },
{ 'name' => 'str2k' , 'basic_type' => 'str', 'size_in_chars' => 2_000, 'str_encoding' => 'u16', },
{ 'name' => 'byte' , 'basic_type' => 'num', 'size_in_bytes' => 1, 'num_precision' => 0, }, # 3 digits
{ 'name' => 'short', 'basic_type' => 'num', 'size_in_bytes' => 2, 'num_precision' => 0, }, # 5 digits
{ 'name' => 'int' , 'basic_type' => 'num', 'size_in_bytes' => 4, 'num_precision' => 0, }, # 10 digits
{ 'name' => 'long' , 'basic_type' => 'num', 'size_in_bytes' => 8, 'num_precision' => 0, }, # 19 digits
{ 'name' => 'ubyte' , 'basic_type' => 'num', 'size_in_bytes' => 1,
'num_unsigned' => 1, 'num_precision' => 0, }, # 3 digits
{ 'name' => 'ushort', 'basic_type' => 'num', 'size_in_bytes' => 2,
'num_unsigned' => 1, 'num_precision' => 0, }, # 5 digits
{ 'name' => 'uint' , 'basic_type' => 'num', 'size_in_bytes' => 4,
'num_unsigned' => 1, 'num_precision' => 0, }, # 10 digits
{ 'name' => 'ulong' , 'basic_type' => 'num', 'size_in_bytes' => 8,
'num_unsigned' => 1, 'num_precision' => 0, }, # 19 digits
{ 'name' => 'float' , 'basic_type' => 'num', 'size_in_bytes' => 4, },
{ 'name' => 'double', 'basic_type' => 'num', 'size_in_bytes' => 8, },
{ 'name' => 'dec10p2', 'basic_type' => 'num', 'size_in_digits' => 10, 'num_precision' => 2, },
{ 'name' => 'dec255' , 'basic_type' => 'num', 'size_in_digits' => 255, },
{ 'name' => 'boolean', 'basic_type' => 'bool', },
{ 'name' => 'datetime', 'basic_type' => 'datetime', 'datetime_calendar' => 'abs', },
{ 'name' => 'dtchines', 'basic_type' => 'datetime', 'datetime_calendar' => 'chi', },
{ 'name' => 'str1' , 'basic_type' => 'str', 'size_in_chars' => 1, },
{ 'name' => 'str20' , 'basic_type' => 'str', 'size_in_chars' => 20, },
{ 'name' => 'str100', 'basic_type' => 'str', 'size_in_chars' => 100, },
{ 'name' => 'str250', 'basic_type' => 'str', 'size_in_chars' => 250, },
{ 'name' => 'entitynm', 'basic_type' => 'str', 'size_in_chars' => 30, },
{ 'name' => 'generic' , 'basic_type' => 'str', 'size_in_chars' => 250, },
) ] );
$model->create_nodes( ['database', 'namespace'] );
my $tbl_person = $model->create_node( { 'NODE_TYPE' => 'table',
'ATTRS' => { 'name' => 'person', 'public_syn' => 'person',
'storage_file' => 'person', }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'table_col', 'ATTRS' => $_ } } (
{
'name' => 'person_id', 'data_type' => 'int', 'required_val' => 1,
'default_val' => 1, 'auto_inc' => 1,
},
{ 'name' => 'alternate_id', 'data_type' => 'str20' , },
{ 'name' => 'name' , 'data_type' => 'str100', 'required_val' => 1, },
{ 'name' => 'sex' , 'data_type' => 'str1' , },
{ 'name' => 'father_id' , 'data_type' => 'int' , },
{ 'name' => 'mother_id' , 'data_type' => 'int' , },
) ),
( map { { 'NODE_TYPE' => 'table_ind', 'ATTRS' => $_->[0],
'CHILDREN' => { 'NODE_TYPE' => 'table_ind_col', 'ATTRS' => $_->[1] } } } (
[ { 'name' => 'primary' , 'ind_type' => 'unique', }, 'person_id' ],
[ { 'name' => 'ak_alternate_id', 'ind_type' => 'unique', }, 'alternate_id' ],
[ { 'name' => 'fk_father', 'ind_type' => 'foreign', 'f_table' => 'person', },
{ 'table_col' => 'father_id', 'f_table_col' => 'person_id' } ],
[ { 'name' => 'fk_mother', 'ind_type' => 'foreign', 'f_table' => 'person', },
{ 'table_col' => 'mother_id', 'f_table_col' => 'person_id' } ],
) ),
] } );
my $vw_person = $model->create_node( { 'NODE_TYPE' => 'view',
'ATTRS' => { 'name' => 'person', 'may_write' => 1, 'match_table' => 'person' }, } );
my $vw_person_with_parents = $model->create_node( { 'NODE_TYPE' => 'view',
'ATTRS' => { 'name' => 'person_with_parents', 'may_write' => 0, }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'view_col', 'ATTRS' => $_ } } (
{ 'name' => 'self_id' , 'data_type' => 'int' , },
{ 'name' => 'self_name' , 'data_type' => 'str100', },
{ 'name' => 'father_id' , 'data_type' => 'int' , },
{ 'name' => 'father_name', 'data_type' => 'str100', },
{ 'name' => 'mother_id' , 'data_type' => 'int' , },
{ 'name' => 'mother_name', 'data_type' => 'str100', },
) ),
{ 'NODE_TYPE' => 'view_rowset', 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'view_src', 'ATTRS' => { 'name' => $_, 'match_table' => 'person', },
'CHILDREN' => [ map { { 'NODE_TYPE' => 'view_src_col', 'ATTRS' => $_ } } qw( person_id name father_id mother_id ) ]
} } qw( self ) ),
( map { { 'NODE_TYPE' => 'view_src', 'ATTRS' => { 'name' => $_, 'match_table' => 'person', },
'CHILDREN' => [ map { { 'NODE_TYPE' => 'view_src_col', 'ATTRS' => $_ } } qw( person_id name ) ]
} } qw( father mother ) ),
{ 'NODE_TYPE' => 'view_join', 'ATTRS' => { 'lhs_src' => 'self',
'rhs_src' => 'father', 'join_type' => 'left', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_join_col', 'ATTRS' => { 'lhs_src_col' => 'father_id',
'rhs_src_col' => 'person_id', } },
] },
{ 'NODE_TYPE' => 'view_join', 'ATTRS' => { 'lhs_src' => 'self',
'rhs_src' => 'mother', 'join_type' => 'left', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_join_col', 'ATTRS' => { 'lhs_src_col' => 'mother_id',
'rhs_src_col' => 'person_id', } },
] },
( map { { 'NODE_TYPE' => 'view_col_def', 'ATTRS' => $_ } } (
{ 'view_col' => 'self_id' , 'expr_type' => 'col', 'src_col' => ['person_id','self'], },
{ 'view_col' => 'self_name' , 'expr_type' => 'col', 'src_col' => ['name' ,'self'], },
{ 'view_col' => 'father_id' , 'expr_type' => 'col', 'src_col' => ['person_id','father'], },
{ 'view_col' => 'father_name', 'expr_type' => 'col', 'src_col' => ['name' ,'father'], },
{ 'view_col' => 'mother_id' , 'expr_type' => 'col', 'src_col' => ['person_id','mother'], },
{ 'view_col' => 'mother_name', 'expr_type' => 'col', 'src_col' => ['name' ,'mother'], },
) ),
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => { 'view_part' => 'where',
'expr_type' => 'sfunc', 'sfunc' => 'and', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'sfunc', 'sfunc' => 'like', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'col', 'src_col' => ['name','father'], }, },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'var', 'command_var' => 'srchw_fa', }, },
] },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'sfunc', 'sfunc' => 'like', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'col', 'src_col' => ['name','mother'], }, },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'var', 'command_var' => 'srchw_mo', }, },
] },
] },
] },
] } );
my $tbl_user_auth = $model->create_node( { 'NODE_TYPE' => 'table',
'ATTRS' => { 'name' => 'user_auth', 'public_syn' => 'user_auth',
'storage_file' => 'user', }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'table_col', 'ATTRS' => $_ } } (
{
'name' => 'user_id', 'data_type' => 'int', 'required_val' => 1,
'default_val' => 1, 'auto_inc' => 1,
},
{ 'name' => 'login_name' , 'data_type' => 'str20' , 'required_val' => 1, },
{ 'name' => 'login_pass' , 'data_type' => 'str20' , 'required_val' => 1, },
{ 'name' => 'private_name' , 'data_type' => 'str100' , 'required_val' => 1, },
{ 'name' => 'private_email', 'data_type' => 'str100' , 'required_val' => 1, },
{ 'name' => 'may_login' , 'data_type' => 'boolean', 'required_val' => 1, },
{
'name' => 'max_sessions', 'data_type' => 'byte', 'required_val' => 1,
'default_val' => 3,
},
) ),
( map { { 'NODE_TYPE' => 'table_ind', 'ATTRS' => $_->[0],
'CHILDREN' => { 'NODE_TYPE' => 'table_ind_col', 'ATTRS' => $_->[1] } } } (
[ { 'name' => 'primary' , 'ind_type' => 'unique', }, 'user_id' ],
[ { 'name' => 'ak_login_name' , 'ind_type' => 'unique', }, 'login_name' ],
[ { 'name' => 'ak_private_email', 'ind_type' => 'unique', }, 'private_email' ],
) ),
] } );
my $tbl_user_profile = $model->create_node( { 'NODE_TYPE' => 'table',
'ATTRS' => { 'name' => 'user_profile', 'public_syn' => 'user_profile',
'storage_file' => 'user', }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'table_col', 'ATTRS' => $_ } } (
{ 'name' => 'user_id' , 'data_type' => 'int' , 'required_val' => 1, },
{ 'name' => 'public_name' , 'data_type' => 'str250', 'required_val' => 1, },
{ 'name' => 'public_email', 'data_type' => 'str250', 'required_val' => 0, },
{ 'name' => 'web_url' , 'data_type' => 'str250', 'required_val' => 0, },
{ 'name' => 'contact_net' , 'data_type' => 'str250', 'required_val' => 0, },
{ 'name' => 'contact_phy' , 'data_type' => 'str250', 'required_val' => 0, },
{ 'name' => 'bio' , 'data_type' => 'str250', 'required_val' => 0, },
{ 'name' => 'plan' , 'data_type' => 'str250', 'required_val' => 0, },
{ 'name' => 'comments' , 'data_type' => 'str250', 'required_val' => 0, },
) ),
( map { { 'NODE_TYPE' => 'table_ind', 'ATTRS' => $_->[0],
'CHILDREN' => { 'NODE_TYPE' => 'table_ind_col', 'ATTRS' => $_->[1] } } } (
[ { 'name' => 'primary' , 'ind_type' => 'unique', }, 'user_id' ],
[ { 'name' => 'ak_public_name', 'ind_type' => 'unique', }, 'public_name' ],
[ { 'name' => 'fk_user', 'ind_type' => 'foreign', 'f_table' => 'user_auth', },
{ 'table_col' => 'user_id', 'f_table_col' => 'user_id' } ],
) ),
] } );
my $vw_user = $model->create_node( { 'NODE_TYPE' => 'view',
'ATTRS' => { 'name' => 'user', 'may_write' => 1, }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'view_col', 'ATTRS' => $_ } } (
{ 'name' => 'user_id' , 'data_type' => 'int' , },
{ 'name' => 'login_name' , 'data_type' => 'str20' , },
{ 'name' => 'login_pass' , 'data_type' => 'str20' , },
{ 'name' => 'private_name' , 'data_type' => 'str100' , },
{ 'name' => 'private_email', 'data_type' => 'str100' , },
{ 'name' => 'may_login' , 'data_type' => 'boolean', },
{ 'name' => 'max_sessions' , 'data_type' => 'byte' , },
{ 'name' => 'public_name' , 'data_type' => 'str250' , },
{ 'name' => 'public_email' , 'data_type' => 'str250' , },
{ 'name' => 'web_url' , 'data_type' => 'str250' , },
{ 'name' => 'contact_net' , 'data_type' => 'str250' , },
{ 'name' => 'contact_phy' , 'data_type' => 'str250' , },
{ 'name' => 'bio' , 'data_type' => 'str250' , },
{ 'name' => 'plan' , 'data_type' => 'str250' , },
{ 'name' => 'comments' , 'data_type' => 'str250' , },
) ),
{ 'NODE_TYPE' => 'view_rowset', 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_src', 'ATTRS' => { 'name' => 'user_auth',
'match_table' => 'user_auth', }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'view_src_col', 'ATTRS' => $_ } } qw(
user_id login_name login_pass private_name private_email may_login max_sessions
) ),
] },
{ 'NODE_TYPE' => 'view_src', 'ATTRS' => { 'name' => 'user_profile',
'match_table' => 'user_profile', }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'view_src_col', 'ATTRS' => $_ } } qw(
user_id public_name public_email web_url contact_net contact_phy bio plan comments
) ),
] },
{ 'NODE_TYPE' => 'view_join', 'ATTRS' => { 'lhs_src' => 'user_auth',
'rhs_src' => 'user_profile', 'join_type' => 'left', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_join_col', 'ATTRS' => { 'lhs_src_col' => 'user_id',
'rhs_src_col' => 'user_id', } },
] },
( map { { 'NODE_TYPE' => 'view_col_def', 'ATTRS' => $_ } } (
{ 'view_col' => 'user_id' , 'expr_type' => 'col', 'src_col' => ['user_id' ,'user_auth' ], },
{ 'view_col' => 'login_name' , 'expr_type' => 'col', 'src_col' => ['login_name' ,'user_auth' ], },
{ 'view_col' => 'login_pass' , 'expr_type' => 'col', 'src_col' => ['login_pass' ,'user_auth' ], },
{ 'view_col' => 'private_name' , 'expr_type' => 'col', 'src_col' => ['private_name' ,'user_auth' ], },
{ 'view_col' => 'private_email', 'expr_type' => 'col', 'src_col' => ['private_email','user_auth' ], },
{ 'view_col' => 'may_login' , 'expr_type' => 'col', 'src_col' => ['may_login' ,'user_auth' ], },
{ 'view_col' => 'max_sessions' , 'expr_type' => 'col', 'src_col' => ['max_sessions' ,'user_auth' ], },
{ 'view_col' => 'public_name' , 'expr_type' => 'col', 'src_col' => ['public_name' ,'user_profile'], },
{ 'view_col' => 'public_email' , 'expr_type' => 'col', 'src_col' => ['public_email' ,'user_profile'], },
{ 'view_col' => 'web_url' , 'expr_type' => 'col', 'src_col' => ['web_url' ,'user_profile'], },
{ 'view_col' => 'contact_net' , 'expr_type' => 'col', 'src_col' => ['contact_net' ,'user_profile'], },
{ 'view_col' => 'contact_phy' , 'expr_type' => 'col', 'src_col' => ['contact_phy' ,'user_profile'], },
{ 'view_col' => 'bio' , 'expr_type' => 'col', 'src_col' => ['bio' ,'user_profile'], },
{ 'view_col' => 'plan' , 'expr_type' => 'col', 'src_col' => ['plan' ,'user_profile'], },
{ 'view_col' => 'comments' , 'expr_type' => 'col', 'src_col' => ['comments' ,'user_profile'], },
) ),
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => { 'view_part' => 'where',
'expr_type' => 'sfunc', 'sfunc' => 'eq', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'col', 'src_col' => ['user_id','user_auth'], }, },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'var', 'command_var' => 'curr_uid', }, },
] },
] },
] } );
my $tbl_user_pref = $model->create_node( { 'NODE_TYPE' => 'table',
'ATTRS' => { 'name' => 'user_pref', 'public_syn' => 'user_pref',
'storage_file' => 'user', }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'table_col', 'ATTRS' => $_ } } (
{ 'name' => 'user_id' , 'data_type' => 'int' , 'required_val' => 1, },
{ 'name' => 'pref_name' , 'data_type' => 'entitynm', 'required_val' => 1, },
{ 'name' => 'pref_value', 'data_type' => 'generic' , 'required_val' => 0, },
) ),
( map { { 'NODE_TYPE' => 'table_ind', 'ATTRS' => $_->[0], 'CHILDREN' => [
map { { 'NODE_TYPE' => 'table_ind_col', 'ATTRS' => $_ } } @{$_->[1]}
] } } (
[ { 'name' => 'primary', 'ind_type' => 'unique', }, [ 'user_id', 'pref_name', ], ],
[ { 'name' => 'fk_user', 'ind_type' => 'foreign', 'f_table' => 'user_auth', },
[ { 'table_col' => 'user_id', 'f_table_col' => 'user_id' }, ], ],
) ),
] } );
my $vw_user_theme = $model->create_node( { 'NODE_TYPE' => 'view',
'ATTRS' => { 'name' => 'user_theme', 'may_write' => 0, }, 'CHILDREN' => [
( map { { 'NODE_TYPE' => 'view_col', 'ATTRS' => $_ } } (
{ 'name' => 'theme_name' , 'data_type' => 'generic', },
{ 'name' => 'theme_count', 'data_type' => 'int' , },
) ),
{ 'NODE_TYPE' => 'view_rowset', 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_src', 'ATTRS' => { 'name' => 'user_pref', 'match_table' => 'user_pref', },
'CHILDREN' => [ map { { 'NODE_TYPE' => 'view_src_col', 'ATTRS' => $_ } } qw( pref_name pref_value ) ]
},
{ 'NODE_TYPE' => 'view_col_def', 'ATTRS' => { 'view_col' => 'theme_name',
'expr_type' => 'col', 'src_col' => ['pref_value','user_pref'], }, },
{ 'NODE_TYPE' => 'view_col_def', 'ATTRS' => { 'view_col' => 'theme_count',
'expr_type' => 'sfunc', 'sfunc' => 'gcount', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_col_def', 'ATTRS' => {
'expr_type' => 'col', 'src_col' => ['pref_value','user_pref'], }, },
] },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => { 'view_part' => 'where',
'expr_type' => 'sfunc', 'sfunc' => 'eq', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'col', 'src_col' => ['pref_name','user_pref'], }, },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'lit', 'lit_val' => 'theme', }, },
] },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => { 'view_part' => 'group',
'expr_type' => 'col', 'src_col' => ['pref_value','user_pref'], }, },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => { 'view_part' => 'havin',
'expr_type' => 'sfunc', 'sfunc' => 'gt', }, 'CHILDREN' => [
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'sfunc', 'sfunc' => 'gcount', }, },
{ 'NODE_TYPE' => 'view_part_def', 'ATTRS' => {
'expr_type' => 'lit', 'lit_val' => '1', }, },
] },
] },
] } );
DESCRIPTION
This Perl 5 object class is a completely optional extension to SQL::SyntaxModel, and is implemented as a sub-class of that module. The public interface to this module is essentially the same as the other one, with the difference being that SQL::SyntaxModel::SkipID will accept a wider variety of input data formats into its methods. Therefore, this module's documentation does not list or explain its methods (see the parent class for that), but it will mention any differences from the parent.
The extension is intended to be fully parent-compatible, meaning that if you provide it input which would be acceptable to the stricter bare parent class, then you will get the same behaviour. Where you will see the difference is when you provide certain kinds of input which would cause the parent class to return an error and/or throw an exception.
One significant added feature, which is part of this module's name-sake, is that it will automatically generate (by serial number) a new Node's "id" attribute when your input doesn't provide one. A related name-sake feature is that, when you want to refer to an earlier created Node by a later one, for purposes of linking them, you can refer to the earlier Node by a more human-readable attribute than the Node's "id" (or Node ref), such as its 'name' (which is also what actual SQL uses). Between these two name-sake features, it is possible to use SQL::SyntaxModel without ever having to explicitely see a Node's "id" attribute.
Note that, for the sake of avoiding conflicts, you should not be explicitely setting ids for some Nodes of a type, and having others auto-generated, unless you take extra precautions. This is because while auto-generated Node ids will not conflict with prior explicit ones, later provided explicit ones may conflict with auto-generated ones. How you can resolve this is to use the parent class' get_node() method to see if the id you want is already in use. The same caveats apply as if the auto-generator was a second concurrent user editing the object. This said, you can mix references from one Node to another between id and non-id ref types without further consequence, because they don't change the id of a Node.
Another added feature is that this class can automatically assign a parent Node for a newly created Node that doesn't explicitely specify a parent in some way, such as in a create_node() argument or by the fact you are calling add_child_node(). This automatic assignment is context-sensitive, whereby the most recent previously-created Node which is capable of becoming the new one's parent will do so.
This module's added features can make it "easier to use" in some circumstances than the bare-bones SQL::SyntaxModel, including an appearance more like actual SQL strings, because matching descriptive terms can be used in multiple places.
However, the functionality has its added cost in code complexity and reliability; for example, since non-id attributes are not unique, the module can "guess wrong" about what you wanted to do, and it won't work at all in some circumstances. Additionally, since your code, by using this module, would use descriptive attributes to link Nodes together, you will have to update every place you use the attribute value when you change the original, so they continue to match; this is unlike the bare parent class, which always uses non-descriptive attributes for links, which you are unlikely to ever change. The added logic also makes the code slower and use more memory.
BUGS
First of all, see the BUGS main documentation section of the SQL::SyntaxModel, as everything said there applies to this module also. Exceptions are below.
This module is currently in alpha development status. All of the code in the SYNOPSIS section has been executed, which tests most internal functions and data, but no other tests have been made.
The mechanisms for automatically linking nodes to each other, and particularly for resolving parent-child node relationships, are under-developed (somewhat hackish) at the moment and probably won't work properly in all situations. However, they do work for the sample code. This linking code will gradually be improved if there is a need.
Please note that SkipID.pm is not a priority for me in further development, and it mainly exists for historical sake, so that some older functionality that I went to the trouble to create for SQL::SyntaxModel in versions 0.01 thru 0.05 would not simply vanish when I trimmed it from the core module. Those who want the older functionality can still use it. Any further development on my part will be limited mainly to keeping it compatible with changes to SQL::SyntaxModel such that it can still execute its SYNOPSIS Perl code correctly. I have no plans to add significant new features to this module.
Likewise, if you would like to adopt SQL::SyntaxModel::SkipID with respect to CPAN and become the primary maintainer, then please write me to arrange it. The main things that I ask in return are to be credited as the original author, and for you to keep the module functionally compatible with new versions of the parent module as they are released (I will try to make it easy).
SEE ALSO
SQL::SyntaxModel, and other items in its SEE ALSO documentation.