[Bast-commits] r9240 - SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract

dhoss at dev.catalyst.perl.org dhoss at dev.catalyst.perl.org
Tue Apr 27 18:15:49 GMT 2010


Author: dhoss
Date: 2010-04-27 19:15:49 +0100 (Tue, 27 Apr 2010)
New Revision: 9240

Added:
   SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm
Log:
initial commit

Added: SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm
===================================================================
--- SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm	                        (rev 0)
+++ SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm	2010-04-27 18:15:49 UTC (rev 9240)
@@ -0,0 +1,85 @@
+package SQL::Abstract::Tree;
+use strict;
+use warnings;
+
+use Data::Dumper;
+use Carp;
+use Moose;
+use namespace::autoclean;
+with 'MooseX::Getopt';
+has 'case_sensitive' => ( 
+	is => 'rw', 
+	traits => [qw/Getopt/], 
+	required => 1, lazy => 1, 
+	default => 0 
+);
+
+has 'parenthesis_significant' => ( 
+	is => 'rw', 
+	traits => [qw/Getopt/], 
+	required => 1, 
+	lazy => 1, 
+	default => 0 
+);
+
+has 'sql_differ' => ( 
+	is => 'rw', 
+	traits => [qw/NoGetopt/], 
+	required => 1, 
+	lazy_build => 1
+);    # keeps track of differing portion between SQLs
+
+sub _build_sql_differ {} # figure this out later
+
+has 'tb' => ( 
+	is => 'rw', 
+	traits => [qw/NoGetopt/],
+	lazy_build => 1,
+	required => 1,
+);
+
+has 'expression_terminator_sql_keywords' => (
+	is => 'ro', 
+	required => 1,
+	lazy_build => 1
+);
+
+sub _build_expression_terminator_sql_keywords {
+	return (
+	  'SELECT',
+	  'FROM',
+	  '(?:
+	    (?:
+	        (?: \b (?: LEFT | RIGHT | FULL ) \s+ )?
+	        (?: \b (?: CROSS | INNER | OUTER ) \s+ )?
+	    )?
+	    JOIN
+	  )',
+	  'ON',
+	  'WHERE',
+	  'EXISTS',
+	  'GROUP \s+ BY',
+	  'HAVING',
+	  'ORDER \s+ BY',
+	  'LIMIT',
+	  'OFFSET',
+	  'FOR',
+	  'UNION',
+	  'INTERSECT',
+	  'EXCEPT',
+	  'RETURNING',
+	);
+}
+
+sub _build_tb {
+	return __PACKAGE__->builder;
+}
+
+# Parser states for _recurse_parse()
+use constant PARSE_TOP_LEVEL => 0;
+use constant PARSE_IN_EXPR => 1;
+use constant PARSE_IN_PARENS => 2;
+use constant PARSE_RHS => 3;
+
+__PACKAGE__->meta->make_immutable;
+1;




More information about the Bast-commits mailing list