return $array;
}
+sub sqlGetColumnData {
+ my($self, $table, $col) = @_;
+ return unless $table;
+
+ $self->sqlConnect() or return undef;
+ my $hr = $self->{_dbh}->selectall_hashref("SHOW COLUMNS FROM $table", 'Field');
+ if ($col) {
+ # Return only one column's data.
+ return exists($hr->{$col}) ? $hr->{$col} : undef;
+ }
+ # Return all columns' data in a big hashref.
+ return $hr;
+}
+
+{ # closure
+my $_textcollen_hr = { };
+sub sqlGetCharColumnLength {
+ my($self, $table, $col) = @_;
+ return undef unless $table && $col;
+ return $_textcollen_hr->{$table}{$col} if exists $_textcollen_hr->{$table}{$col};
+ $self->sqlConnect() or return undef;
+ my $hr = $self->sqlGetColumnData($table, $col);
+ return $_textcollen_hr->{$table}{$col} = undef if !$hr;
+ my $type = $hr->{Type};
+ return $_textcollen_hr->{$table}{$col} = undef unless $type && $type =~ /^(?:var)?char\((\d+)\)$/i;
+ return $_textcollen_hr->{$table}{$col} = $1;
+}
+} # end closure
+
1;