view release on metacpan or search on metacpan
2.410 2024-05-04
- Derived table/Cte: bugfix in 'choose_query'.
- Bugfix in 'Operators.pm'.
- Refactoring and cleanup.
- SQLite does not have the operators ANY and ALL.
- Term::Choose minimum version 1.765.
2.409 2024-04-28
- SQLite plugin: new option to set the busy timeout.
- SQLite: Renamed and modified the user defined scalar function 'truncate'.
Now 'trunc' treats any value that looks like a number as a number.
- Bugfix in the limit/offset submenu.
- New input filter 'convert datetime'.
- Quote entered numbers if the data type is not numeric and no placeholders are used.
- Added scalar convert functions.
- Epoch_to_DateTime: bugfix and updates.
- Data import: if chosen a deleted directory warn and remove the directory from history.
2.408_05 2024-04-21
- sqlite_busy_timeout.
- Bugfix limit, offset.
bin/db-browser view on Meta::CPAN
=head4 Column/Value/Argument Extensions
Not all of these extensions are available everywhere.
=over
=item Value
Enter a constant value.
If the data type is numeric or unknown and the literal looks like a number, the literal is not enclosed in quotation
marks. In all other cases, the entered literal is enclosed in quotation marks.
=item SQL
Selecting C<SQL> opens the subqueries menu.
See L<Subquery> for the different possibilities to enter a subquery or any other SQL text.
Entries beginning with SELECT or WITH followed by a space are automatically enclosed in parentheses.
bin/db-browser view on Meta::CPAN
Subqueries created with the 'SQL Menu': Allow editing.
When enabled, subqueries created using the 'SQL Menu' can be edited before they are used.
=item
Pg: Convert to C<text> automatically when required.
If the driver is C<Pg>: Convert columns in string functions automatically to C<text> if the datatype of the column is
not a char like datatype. If the datatype is unknown and the value looks like a number, it is also converted to C<text>.
=back
=head2 Create-Table
=head3 Enable Options
=over
=item
lib/App/DBBrowser/Auxil.pm view on Meta::CPAN
package # hide from PAUSE
App::DBBrowser::Auxil;
use warnings;
use strict;
use 5.016;
use Scalar::Util qw( looks_like_number );
use JSON::MaybeXS qw( decode_json );
use List::MoreUtils qw( none uniq );
use Term::Choose qw();
use Term::Choose::Constants qw( EXTRA_W );
use Term::Choose::LineFold qw( line_fold );
use Term::Choose::Screen qw( clear_screen );
use Term::Choose::Util qw( insert_sep get_term_width get_term_height unicode_sprintf );
use Term::Form::ReadLine qw();
lib/App/DBBrowser/Auxil.pm view on Meta::CPAN
$is_numeric = 1;
}
return $is_numeric;
}
sub is_char_datatype {
my ( $sf, $sql, $col ) = @_;
my $is_char;
if ( ! defined $sql->{data_types}{$col} ) {
if ( looks_like_number $col ) { ##
$is_char = 0;
}
elsif ( $col =~ /^(?:AVG|COUNT|MAX|MIN|SUM)\(/ ) {
$is_char = 0;
}
}
else {
# 1 CHAR, 12 VARCHAR
if ( $sql->{data_types}{$col} == 1 || $sql->{data_types}{$col} == 12 ) {
$is_char = 1;
lib/App/DBBrowser/Auxil.pm view on Meta::CPAN
sub unquote_identifier {
my ( $sf, $identifier ) = @_;
my $qc = quotemeta( $sf->{d}{identifier_quote_char} );
$identifier =~ s/$qc(?=(?:$qc$qc)*(?:[^$qc]|\z))//g;
return $identifier;
}
sub quote_constant {
my ( $sf, $value ) = @_;
if ( looks_like_number $value ) {
return $value;
}
else {
return $sf->{d}{dbh}->quote( $value );
}
}
sub unquote_constant {
my ( $sf, $constant ) = @_;
lib/App/DBBrowser/DB.pm view on Meta::CPAN
package # hide from PAUSE
App::DBBrowser::DB;
use warnings;
use strict;
use 5.016;
our $VERSION = '2.431';
#use bytes; # required
use Scalar::Util qw( looks_like_number );
sub new {
my ( $class, $info, $opt ) = @_;
my $db_module = $info->{plugin};
eval "require $db_module" or die $@;
my $plugin = $db_module->new( $info, $opt );
bless { Plugin => $plugin }, $class;
}
lib/App/DBBrowser/DB.pm view on Meta::CPAN
if ( $dbh->{Driver}{Name} eq 'SQLite' ) {
$dbh->sqlite_create_function( 'regexp', 3, sub {
my ( $regex, $string, $case_sensitive ) = @_;
$string = '' if ! defined $string;
return $string =~ m/$regex/sm if $case_sensitive;
return $string =~ m/$regex/ism;
}
);
$dbh->sqlite_create_function( 'trunc', -1, sub {
my ( $number, $places ) = @_;
return $number if ! looks_like_number( $number );
$places //= 0;
return int( $number * 10 ** $places ) / 10 ** $places;
}
);
$dbh->sqlite_create_function( 'octet_length', 1, sub {
require bytes;
return if ! defined $_[0];
return bytes::length $_[0];
}
);
lib/App/DBBrowser/DB/SQLite.pm view on Meta::CPAN
my $read_attributes = $db_opt_get->get_read_attributes( $db, $db_opt );
my $set_attributes = $db_opt_get->get_set_attributes( $db, $db_opt );
my $dsn = "dbi:$sf->{i}{driver}:dbname=$db";
my $dbh = DBI->connect( $dsn, '', '', {
PrintError => 0,
RaiseError => 1,
AutoCommit => 1,
ShowErrorStatement => 1,
%$set_attributes,
} );
if ( DBI::looks_like_number( $read_attributes->{sqlite_busy_timeout} ) ) {
$dbh->sqlite_busy_timeout( 0 + $read_attributes->{sqlite_busy_timeout} );
}
return $dbh;
}
sub get_databases {
my ( $sf ) = @_;
return \@ARGV if @ARGV;
my $cache_sqlite_files = catfile $sf->{i}{app_dir}, 'cache_SQLite_files.json';
lib/App/DBBrowser/Table/Extensions/ScalarFunctions/To/EpochTo.pm view on Meta::CPAN
package # hide from PAUSE
App::DBBrowser::Table::Extensions::ScalarFunctions::To::EpochTo;
use warnings;
use strict;
use 5.016;
use Scalar::Util qw( looks_like_number );
use List::MoreUtils qw( minmax );
use Term::Choose qw();
use Term::Choose::Util qw( get_term_height );
use App::DBBrowser::Auxil;
sub new {
lib/App/DBBrowser/Table/Extensions/ScalarFunctions/To/EpochTo.pm view on Meta::CPAN
}
sub __guess_interval {
my ( $sf, $sql, $func, $col, $epochs, $max_examples ) = @_;
my ( $function_stmt, $example_results );
if ( ! eval {
my %count;
for my $epoch ( @$epochs ) {
if ( ! looks_like_number( $epoch ) ) {
return;
}
++$count{length( $epoch )};
}
if ( keys %count != 1 ) {
return;
}
my $epoch_w = ( keys %count )[0];
my $interval;
if ( $epoch_w <= 10 ) {