App-AltSQL
view release on metacpan or search on metacpan
lib/App/AltSQL/Model/MySQL.pm view on Meta::CPAN
## Update autocomplete entries
if ($self->database) {
$self->current_database($self->database);
$self->update_autocomplete_entries($self->database);
}
$self->update_db_types();
}
sub update_autocomplete_entries {
my ($self, $database) = @_;
return if $self->no_auto_rehash;
my $cache_key = 'autocomplete_' . $database;
if (! $self->{_cache}{$cache_key}) {
$self->log_debug("Reading table information for completion of table and column names\nYou can turn off this feature to get a quicker startup with -A\n");
my %autocomplete;
my $rows = $self->dbh->selectall_arrayref("select TABLE_NAME, COLUMN_NAME from information_schema.COLUMNS where TABLE_SCHEMA = ?", {}, $database);
foreach my $row (@$rows) {
lib/App/AltSQL/Model/MySQL.pm view on Meta::CPAN
};
if (my $error = $self->dbh->errstr || $@) {
$self->log_error($error);
return;
}
return $sth;
}
sub update_db_types {
my $self = shift;
## Collect type info from the handle
my %types;
my $type_info_all = $self->{dbh}->type_info_all();
my %key_map = %{ shift @$type_info_all };
$types{unknown} = { map { $_ => 'unknown' } keys %key_map };
( run in 0.287 second using v1.01-cache-2.11-cpan-95122f20152 )