| 1 | package Crop::Object::Warehouse::Lang::SQL::Query; | ||
| 2 | use base qw/ Crop::Object /; | ||
| 3 | |||
| 4 | =begin nd | ||
| 5 | Class: Crop::Object::Warehouse::Lang::SQL::Query | ||
| 6 | SQL query builder. | ||
| 7 | |||
| 8 | Compose SQL query based on an object related structure. | ||
| 9 | |||
| 10 | Many of the modules such Pg, MySQL, or MSSQL can use general SQL queries. | ||
| 11 | =cut | ||
| 12 | |||
| 13 | use v5.14; | ||
| 14 | use warnings; | ||
| 15 | no warnings 'experimental::smartmatch'; | ||
| 16 | |||
| 17 | use Crop::Error; | ||
| 18 | |||
| 19 | =begin nd | ||
| 20 | Variable: our %Attributes | ||
| 21 | Class members: | ||
| 22 | |||
| 23 | where - where clause in | ||
| 24 | # type - type of query such as 'select', 'update', etc. | ||
| 25 | =cut | ||
| 26 | our %Attributes = ( | ||
| 27 | ); | ||
| 28 | |||
| 29 | =begin nd | ||
| 30 | Constructor: new ( ) | ||
| 31 | Pure virtual class builder. | ||
| 32 | |||
| 33 | Prevents creation of this class. | ||
| 34 | =cut | ||
| 35 | sub new { | ||
| 36 | my $class = shift; | ||
| 37 | |||
| 38 | return warn 'DBASE: Query constructor must be redefined by subclass' if $class eq __PACKAGE__; | ||
| 39 | |||
| 40 | $class->SUPER::new(@_); | ||
| 41 | } | ||
| 42 | |||
| 43 | =begin nd | ||
| 44 | Method: print_sql ( ) | ||
| 45 | Print SQL string. | ||
| 46 | |||
| 47 | Pure virtual, must be redefined by subclass. | ||
| 48 | |||
| 49 | Returns: | ||
| 50 | undef | ||
| 51 | =cut | ||
| 52 | sub print_sql { warn 'DBASE: print_sql() must be redefined by subclass' } | ||
| 53 | |||
| 54 | 1; |