Author: spadkins
Date: Thu Oct 11 13:18:23 2012
New Revision: 15442
Modified:
p5ee/trunk/App-Repository/CHANGES
p5ee/trunk/App-Repository/lib/App/Authentication/Repository.pm
p5ee/trunk/App-Repository/lib/App/Repository.pm
p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm
p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm
p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm
p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm
p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTableColumns.pm
p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTables.pm
Log:
latest. remove throws comments. --debug_sql=-1. select hints.
Modified: p5ee/trunk/App-Repository/CHANGES
==============================================================================
--- p5ee/trunk/App-Repository/CHANGES (original)
+++ p5ee/trunk/App-Repository/CHANGES Thu Oct 11 13:18:23 2012
@@ -12,6 +12,9 @@
for a list of the tables and for the list and definition of types. Every
time it accessed a table, it would query the database
for the columns (and possibly also the keys/unique indexes). Now, using the
dbmetadata tool, you can extract this metadata
from the database and save a lot of overhead.
+ x removed the "throws" comments (which were not accurate)
+ x added --debug_sql=-1 to show SQL select statements but not execute them
+ x add select hints. i.e. get_rows($table, $params, $cols, { hint =>
"/*+parallel(8)*/" })
0.968
x summary_tables are now implemented
Modified: p5ee/trunk/App-Repository/lib/App/Authentication/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Authentication/Repository.pm
(original)
+++ p5ee/trunk/App-Repository/lib/App/Authentication/Repository.pm Thu Oct
11 13:18:23 2012
@@ -53,8 +53,6 @@
* Signature: $username = $auth->validate_password();
* Param: void
* Return: $username string
- * Throws: App::Exception::Authentication
- * Since: 0.01
Sample Usage:
Modified: p5ee/trunk/App-Repository/lib/App/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository.pm Thu Oct 11 13:18:23 2012
@@ -226,9 +226,6 @@
A Repository is a means by which data may be stored somewhere without
knowing what underlying technology is storing the data.
- * Throws: App::Exception::Repository
- * Since: 0.01
-
=head2 Class Design
...
@@ -305,8 +302,6 @@
* Signature: $repository->_connect();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -333,8 +328,6 @@
* Signature: $repository->_disconnect();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -369,8 +362,6 @@
* Signature: $connected = $repository->_is_connected();
* Param: void
* Return: $connected integer
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -404,8 +395,6 @@
* Signature: $errormsg = $repository->error();
* Param: void
* Return: $errormsg string
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -439,8 +428,6 @@
* Signature: $nrows = $repository->numrows();
* Param: void
* Return: $numrows integer
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -478,8 +465,6 @@
* Param: $options undef,HASH
* Return: $value any
* Return: @row any
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -535,8 +520,6 @@
* Param: $value any
* Param: $options undef,HASH
* Return: $nrows integer
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -576,8 +559,6 @@
* Param: $cols ARRAY
* Param: $options undef,HASH
* Return: $row ARRAY
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -752,8 +733,6 @@
* Param: $params undef,HASH
* Param: $options undef,HASH
* Return: $nrows integer
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -858,8 +837,6 @@
* Param: $col string
* Param: $options undef,HASH
* Return: $colvalues ARRAY
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -896,8 +873,6 @@
* Param: $cols ARRAY
* Param: $options undef,HASH
* Return: $rows ARRAY
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1243,8 +1218,6 @@
* Param: $rows ARRAY
* Param: $options undef,HASH
* Return: $nrows integer
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1292,8 +1265,6 @@
* Param: $params undef,HASH
* Param: $options undef,HASH
* Return: $values HASH
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1339,8 +1310,6 @@
* Param: $params undef,HASH
* Param: $options undef,HASH
* Return: $hashes ARRAY
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1386,8 +1355,6 @@
* Param: $rows ARRAY of ARRAYs
* Param: $cols ARRAY,undef
* Return: $hashes ARRAY of HASH
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1432,8 +1399,6 @@
* Param: $params undef,HASH
* Param: $options undef,HASH
* Return: $object App::RepositoryObject
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1526,8 +1491,6 @@
* Param: $params undef,HASH
* Param: $options undef,HASH
* Return: $objects ARRAY
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1640,8 +1603,6 @@
* Param: $keycol string
* Param: $options undef,HASH
* Return: $hash HASH
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1678,8 +1639,6 @@
* Param: $keycol string
* Param: $options undef,HASH
* Return: $hash HASH
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -1774,7 +1733,23 @@
my (%value_seen, $value);
my $is_array_of_arrays = ($#$rows > -1 && ref($rows->[0]) eq "ARRAY") ? 1
: 0;
if ($is_array_of_arrays) {
- # TBD
+ my ($idx);
+ if ($key_column =~ /^\d+$/) {
+ $idx = $key_column;
+ }
+ elsif ($options->{colidx} && $options->{colidx}{$key_column}) {
+ $idx = $options->{colidx}{$key_column};
+ }
+ else {
+ die "ERROR: get_column_values() was passed an array of arrays, a
column name [$key_column], and no options->{colidx} [$options->{colidx}] lookup
table";
+ }
+ foreach my $row (@$rows) {
+ $value = $row->[$idx];
+ if (!defined $value_seen{$value}) {
+ $value_seen{$value} = 1;
+ push(@$values, $value);
+ }
+ }
}
else {
foreach my $row (@$rows) {
@@ -1847,8 +1822,6 @@
* Param: $cols ARRAY,undef
* Param: $options undef,HASH
* Return: $nrows integer
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -2438,9 +2411,14 @@
}
if ($hashes) {
my (@cols, @rows, $col, $row);
- foreach $col (@$columns) {
- if (exists $hash->{$col}) {
- push(@cols, $col);
+ if ($cols) {
+ @cols = @$cols;
+ }
+ else {
+ foreach $col (@$columns) {
+ if (exists $hash->{$col}) {
+ push(@cols, $col);
+ }
}
}
foreach $hash (@$hashes) {
@@ -2597,8 +2575,6 @@
* Signature: $date = $repository->format_repdate($freeform_date);
* Param: $freeform_date string
* Return: $date string
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2679,8 +2655,6 @@
* Signature: $typenames = $repository->get_type_names();
* Param: void
* Return: $typenames []
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2715,8 +2689,6 @@
* Signature: $typelabels = $repository->get_type_labels();
* Param: void
* Return: $typelabels {}
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2754,8 +2726,6 @@
* Signature: $typedef = $rep->get_type_def($typename);
* Param: $typename string
* Return: $typedef {}
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2782,8 +2752,6 @@
* Signature: $tablenames = $rep->get_table_names();
* Param: void
* Return: $tablenames []
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2808,8 +2776,6 @@
* Signature: $tablelabels = $rep->get_table_labels();
* Param: void
* Return: $tablelabels {}
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2838,8 +2804,6 @@
* Signature: $table_def = $rep->get_table_def($tablename);
* Param: $tablename string
* Return: $table_def {}
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2891,8 +2855,6 @@
* Signature: $columnnames = $rep->get_column_names($tablename);
* Param: $tablename string
* Return: $columnnames []
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2926,8 +2888,6 @@
* Signature: $columnlabels = $rep->get_column_labels($tablename);
* Param: $tablename string
* Return: $columnlabels {}
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2969,8 +2929,6 @@
* Param: $tablename string
* Param: $columnname string
* Return: $column_def {}
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3047,8 +3005,6 @@
* Signature: $rep->begin_work();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3069,8 +3025,6 @@
* Signature: $rep->commit();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3135,8 +3089,6 @@
* Signature: $rep->rollback();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3173,8 +3125,6 @@
* Param: field_quote char character which optionally encloses
the fields in the file (i.e. '"')
* Param: field_escape char character which escapes the quote
chars within quotes (i.e. "\")
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3251,8 +3201,6 @@
* Param: field_quote char character which optionally encloses
the fields in the file (i.e. '"')
* Param: field_escape char character which escapes the quote
chars within quotes (i.e. "\")
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3418,8 +3366,6 @@
* Param: $summary_keys []
* Param: $formulas {}
* Return: $summarized_rows []
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -3819,8 +3765,6 @@
* Param: $sorttype []
* Param: $sortdir []
* Return: $sorted_rows []
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage: (to sort arrayrefs)
@@ -3893,8 +3837,6 @@
* Param: $rows ARRAY
* Param: $options undef,HASH
* Return: $nrows integer
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -4165,8 +4107,6 @@
* Signature: $serial_num = $repository->serial($category);
* Param: $category string
* Return: $serial_num integer
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4207,8 +4147,6 @@
* Signature: $repository->_load_rep_metadata();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4327,8 +4265,6 @@
* Signature: $repository->_load_rep_metadata_from_source();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4357,8 +4293,6 @@
* Signature: $self->_load_table_metadata();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4610,8 +4544,6 @@
* Signature: $repository->_load_table_metadata_from_source();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4687,8 +4619,6 @@
* Signature: $repository->_init();
* Param: defer_connection integer
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4735,8 +4665,6 @@
* Signature: $repository->_init2();
* Param: defer_connection integer
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4763,7 +4691,6 @@
* Signature: $service_type = App::Repository->service_type();
* Param: void
* Return: $service_type string
- * Since: 0.01
$service_type = $widget->service_type();
@@ -4782,7 +4709,6 @@
* Signature: $current_datetime = App::Repository->current_datetime();
* Param: void
* Return: $current_datetime string
- * Since: 0.01
$current_datetime = $widget->current_datetime();
@@ -4802,8 +4728,6 @@
* Param: $a []
* Param: $b []
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4858,8 +4782,6 @@
* Param: $a []
* Param: $b []
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -4955,8 +4877,6 @@
* Signature: $self->DESTROY();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
Modified: p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm Thu Oct 11 13:18:23 2012
@@ -155,8 +155,6 @@
* Signature: $repository->_connect();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -298,8 +296,6 @@
* Signature: $repository->_disconnect();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.50
Sample Usage:
@@ -562,7 +558,12 @@
my ($column, %deserializer, $deserializer_name, $serializer);
my $column_defs = $self->{table}{$table}{column};
eval {
- $rows = $self->_selectrange_arrayref($sql, $startrow, $endrow);
+ if ($debug_sql && $debug_sql < 0) {
+ $rows = [];
+ }
+ else {
+ $rows = $self->_selectrange_arrayref($sql, $startrow, $endrow);
+ }
foreach my $row (@$rows) {
for (my $i = 0; $i <= $#$cols; $i++) {
$column = $cols->[$i];
@@ -1046,7 +1047,8 @@
$order_by = $options->{order_by} || $options->{ordercols} || []; #
{ordercols} is deprecated
$order_by = [$order_by] if (!ref($order_by));
$direction = $options->{direction} || $options->{directions}; #
{directions} is deprecated
- my $modifier = $options->{distinct} ? " distinct" : "";
+ my $modifier = ($options->{hint} ? " $options->{hint}" : "") .
+ ($options->{distinct} ? " distinct" : "");
$sql = "select$modifier\n " . join(",\n ", @$cols) . "\nfrom $table\n";
$sql .= $self->_mk_where_clause($table, $params, $options);
@@ -1097,7 +1099,8 @@
$order_by = $options->{order_by} || $options->{ordercols} || []; #
{ordercols} is deprecated
$order_by = [$order_by] if (!ref($order_by));
$direction = $options->{direction} || $options->{directions}; #
{directions} is deprecated
- my $modifier = $options->{distinct} ? " distinct" : "";
+ my $modifier = ($options->{hint} ? " $options->{hint}" : "") .
+ ($options->{distinct} ? " distinct" : "");
my (@where_conditions, $value);
@@ -2797,8 +2800,6 @@
* Signature: $rep->begin_work();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2826,8 +2827,6 @@
* Signature: $rep->commit();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2854,8 +2853,6 @@
* Signature: $rep->rollback();
* Param: void
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
@@ -2892,8 +2889,6 @@
* Return: @results ARRAY (if $return_type is "LIST")
* Return: $row ARRAY (if $return_type is "ROW")
* Return: $rows ARRAY (if $return_type is "ROWS")
- * Throws: App::Exception::Repository
- * Since: 0.01
There is no standard way to call stored procedures in the DBI.
This is an attempt to provide access to them.
Modified: p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm Thu Oct 11
13:18:23 2012
@@ -541,8 +541,6 @@
* Param: field_quote char character which optionally encloses
the fields in the file (i.e. '"')
* Param: field_escape char character which escapes the quote
chars within quotes (i.e. "\")
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Note: If you want to call this with $options->{local}, you will probably
need to make sure that mysql_local_infile=1 is in your DSN. This might
@@ -646,8 +644,6 @@
* Param: field_quote char character which optionally encloses
the fields in the file (i.e. '"')
* Param: field_escape char character which escapes the quote
chars within quotes (i.e. "\")
* Return: void
- * Throws: App::Exception::Repository
- * Since: 0.01
Sample Usage:
Modified: p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm Thu Oct 11
13:18:23 2012
@@ -63,8 +63,6 @@
* Signature: $value = $obj->get($attrib, $options);
* Param: $attrib string,ARRAY
* Return: $value any,ARRAY
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
@@ -118,8 +116,6 @@
* Param: $attrib string,ARRAY
* Param: $value any,ARRAY
* Param: $options any,ARRAY
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
@@ -168,8 +164,6 @@
* Signature: $obj->delete();
* Signature: $obj->delete($options);
* Param: $options ARRAY
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
@@ -194,8 +188,6 @@
=head2 TO_JSON()
* Signature: $obj->TO_JSON();
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
@@ -244,8 +236,6 @@
* Signature: $obj->_init();
* Param: void
* Return: void
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
Modified: p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm Thu Oct 11
13:18:23 2012
@@ -52,8 +52,6 @@
* Signature: $self->_load($values_string)
* Param: $values_string string
* Return: void
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
Modified:
p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTableColumns.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTableColumns.pm
(original)
+++ p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTableColumns.pm
Thu Oct 11 13:18:23 2012
@@ -60,8 +60,6 @@
* Signature: $self->_load($values_string)
* Param: $values_string string
* Return: void
- * Throws: App::Exception
- * Since: 0.01
Sample Usage:
Modified: p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTables.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTables.pm
(original)
+++ p5ee/trunk/App-Repository/lib/App/ValueDomain/RepositoryTables.pm Thu Oct
11 13:18:23 2012
@@ -60,8 +60,6 @@
* Signature: $self->_load($values_string)
* Param: $values_string string
* Return: void
- * Throws: App::Exception
- * Since: 0.01
Sample Usage: