view release on metacpan or search on metacpan
"runtime" : {
"requires" : {
"DBD::SQLite" : "1.4",
"DBI" : "1.632",
"Exception::Class" : "0",
"File::Slurp" : "9999.19",
"File::Spec" : "0",
"Hash::MD5" : "0.08",
"Perl::Version" : "0",
"Readonly" : "0",
"Ref::Util" : "0",
"SQL::Abstract" : "0",
"Test::Builder" : "0",
"Test::Exception" : "0",
"Time::Piece" : "1.27",
"perl" : "5.010000"
}
},
"test" : {
"requires" : {}
}
- inc
requires:
DBD::SQLite: '1.4'
DBI: '1.632'
Exception::Class: '0'
File::Slurp: '9999.19'
File::Spec: '0'
Hash::MD5: '0.08'
Perl::Version: '0'
Readonly: '0'
Ref::Util: '0'
SQL::Abstract: '0'
Test::Builder: '0'
Test::Exception: '0'
Time::Piece: '1.27'
perl: '5.010000'
resources:
repository: https://codeberg.org/GeoffreyDB/Geoffrey.git
version: '0.000206'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
Makefile.PL view on Meta::CPAN
EXE_FILES => [],
CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => 0, },
PREREQ_PM => {
'DBI', => 1.632,
'DBD::SQLite', => 1.4,
'Exception::Class', => 0,
'File::Slurp', => 9999.19,
'File::Spec', => 0,
'Hash::MD5', => 0.08,
'Perl::Version', => 0,
'Ref::Util', => 0,
'Readonly', => 0,
'SQL::Abstract', => 0,
'Test::Builder', => 0,
'Time::Piece', => 1.27,
'Test::Exception', => 0,
},
TEST_REQUIRES => {},
META_MERGE => {
'meta-spec' => { version => 2 },
resources => {
requires 'DBI', '>= 1.632';
requires 'DBD::SQLite', '>= 1.4';
requires 'Exception::Class', '>= 0';
requires 'File::Slurp', '>= 9999.19';
requires 'File::Spec', '>= 0';
requires 'Hash::MD5', '>= 0.08';
requires 'Perl::Version', '>= 0';
requires 'Ref::Util', '>= 0';
requires 'Readonly', '>= 0';
requires 'SQL::Abstract', '>= 0';
requires 'Test::Builder', '>= 0';
requires 'Time::Piece', '>= 1.27';
requires 'Test::Exception', '>= 0';
lib/Geoffrey/Action/Column.pm view on Meta::CPAN
use 5.016;
use strict;
use warnings;
$Geoffrey::Action::Column::VERSION = '0.000206';
use parent 'Geoffrey::Role::Action';
sub add {
my ($self, $hr_params, $constraint) = @_;
require Ref::Util;
if (!Ref::Util::is_hashref($hr_params)) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref(__PACKAGE__ . '::add', 'hash');
}
return $self->appending($hr_params->{table}, $hr_params, $constraint) if $self->for_table;
my $tables = $self->converter->table;
if (!$tables || !$tables->can('add_column')) {
require Geoffrey::Exception::NotSupportedException;
Geoffrey::Exception::NotSupportedException::throw_column('add', $self->converter);
}
if (defined $hr_params->{primarykey}) {
lib/Geoffrey/Action/Column.pm view on Meta::CPAN
join q/ /,
(
$hr_params->{name}, $self->converter()->type($hr_params),
$constraint // (), $self->defaults($hr_params) // ()))]);
return $self->do($sql);
}
sub drop {
my ($self, $hr_params) = @_;
require Ref::Util;
if (!Ref::Util::is_hashref($hr_params)) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref(__PACKAGE__ . '::drop', 'hash');
}
my $table = $self->converter->table;
if (!$table || !$table->can('drop_column')) {
require Geoffrey::Exception::NotSupportedException;
Geoffrey::Exception::NotSupportedException::throw_column('drop', $self->converter);
}
require Geoffrey::Utils;
return [
lib/Geoffrey/Action/Constraint.pm view on Meta::CPAN
sub add {
my ($self, $s_table_name, $hr_params, $ar_constraint_params) = @_;
return $self->create_table_column($s_table_name, $hr_params, $ar_constraint_params)
if $self->for_table;
require Geoffrey::Exception::General;
return Geoffrey::Exception::General::throw_unknown_action('add constraint');
}
sub alter {
my ($self, $hr_params) = @_;
require Ref::Util;
if (!Ref::Util::is_hashref($hr_params)) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref(__PACKAGE__ . '::alter', 'hash');
}
return $self->_collective_do('alter', delete $hr_params->{table}, $hr_params->{constraints});
}
sub drop {
my ($self, $s_table_name, $hr_params) = @_;
if (!$s_table_name) {
require Geoffrey::Exception::RequiredValue;
lib/Geoffrey/Action/Constraint.pm view on Meta::CPAN
my $consts = $self->converter->constraints;
my $not_null = ($hr_column_params->{notnull}) ? $consts->{not_null} : q~~;
my $primarykey = (defined $hr_column_params->{primarykey}) ? $consts->{primary_key} : q~~;
$o_foreign_key->for_table(0);
return qq~$not_null $primarykey~;
}
sub _uniques_to_add {
my ($self, $hr_unique_params) = @_;
return () if !$hr_unique_params->{unique};
require Ref::Util;
my $hr_to_add
= Ref::Util::is_hashref($hr_unique_params->{unique})
? $hr_unique_params->{unique}
: {columns => [$hr_unique_params->{column}]};
return $self->_obj_unique->add($hr_unique_params->{table}, $hr_to_add);
}
1;
__END__
=pod
lib/Geoffrey/Action/Constraint/ForeignKey.pm view on Meta::CPAN
use 5.016;
use strict;
use warnings;
$Geoffrey::Action::Constraint::ForeignKey::VERSION = '0.000206';
use parent 'Geoffrey::Role::Action';
sub add {
my ($self, $hr_params) = @_;
require Ref::Util;
if (!Ref::Util::is_hashref($hr_params)) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref(__PACKAGE__ . '::add', 'hash');
}
if (!$self->converter->foreign_key) {
require Geoffrey::Exception::NotSupportedException;
Geoffrey::Exception::NotSupportedException::throw_foreignkey('add', $self->converter);
}
if (!exists $hr_params->{table}) {
require Geoffrey::Exception::RequiredValue;
Geoffrey::Exception::RequiredValue::throw_table_name();
lib/Geoffrey/Action/Constraint/Index.pm view on Meta::CPAN
return $self->do( $self->converter->index->add($hr_params) );
}
sub alter {
my ( $self, $hr_params ) = @_;
return [ $self->drop($hr_params), $self->add($hr_params) ];
}
sub drop {
my ( $self, $hr_params ) = @_;
require Ref::Util;
my $s_name = Ref::Util::is_hashref($hr_params) ? $hr_params->{name} : undef;
if ( !$s_name ) {
require Geoffrey::Exception::RequiredValue;
Geoffrey::Exception::RequiredValue::throw_index_name('to drop');
}
return $self->do( $self->converter->index->drop($s_name) );
}
sub list_from_schema {
my ( $self, $schema ) = @_;
my $converter = $self->converter;
lib/Geoffrey/Action/Constraint/Unique.pm view on Meta::CPAN
package Geoffrey::Action::Constraint::Unique;
use utf8;
use 5.016;
use strict;
use warnings;
use Ref::Util;
use Time::HiRes qw/ time /;
$Geoffrey::Action::Constraint::Unique::VERSION = '0.000206';
use parent 'Geoffrey::Role::Action';
sub add {
my ( $self, $s_table_name, $hr_params ) = @_;
my $unique = $self->converter->unique;
if ( !$unique ) {
require Geoffrey::Exception::NotSupportedException;
Geoffrey::Exception::NotSupportedException::throw_unique( 'add', $self->converter );
}
if ( !$s_table_name ) {
require Geoffrey::Exception::RequiredValue;
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::add' );
}
return () unless $hr_params;
if ( !Ref::Util::is_hashref($hr_params) ) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref( __PACKAGE__ . '::add', 'hash' );
}
if ( !$hr_params->{columns} || scalar @{ $hr_params->{columns} } == 0 ) {
require Geoffrey::Exception::RequiredValue;
Geoffrey::Exception::RequiredValue::throw_table_column( __PACKAGE__ . '::add' );
}
$s_table_name =~ s/"//g;
my $gentime = time;
lib/Geoffrey/Action/Function.pm view on Meta::CPAN
my ( $self, $hr_params ) = @_;
my $function = $self->converter->function;
if ( !$function ) {
require Geoffrey::Exception::NotSupportedException;
Geoffrey::Exception::NotSupportedException::throw_converter_type();
}
if ( !$function->add ) {
require Geoffrey::Exception::NotSupportedException;
Geoffrey::Exception::NotSupportedException::throw_action();
}
require Ref::Util;
if ( !Ref::Util::is_hashref($hr_params) ) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref( __PACKAGE__ . '::add', 'hash' );
}
my $args = join q/,/, @{ $hr_params->{args} };
require Geoffrey::Utils;
return $self->do(
Geoffrey::Utils::replace_spare(
$function->add,
[
$hr_params->{name}, $args,
lib/Geoffrey/Action/Table.pm view on Meta::CPAN
my $sql = Geoffrey::Utils::replace_spare( $self->converter->table->add, [
($hr_params->{schema} ? $hr_params->{schema} . q/./ : q//) . $self->prefix . $hr_params->{name} . $self->postfix,
join(q/,/, @columns),
$hr_params->{engine}, $hr_params->{charset}
]);
return $self->do($sql);
}
sub alter {
my ($self, $hr_params) = @_;
require Ref::Util;
if (!Ref::Util::is_hashref($hr_params)) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_wrong_ref(__PACKAGE__ . '::alter', 'hash');
}
if (!$hr_params->{name}) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_no_table_name('to alter');
}
my @ar_result = ();
require Geoffrey::Utils;
for (@{$hr_params->{alter}}) {
lib/Geoffrey/Action/Table.pm view on Meta::CPAN
Geoffrey::Exception::RequiredValue::throw_action_sub($s_action);
}
$_->{table} = $hr_params->{name};
push @ar_result, $obj_action->$s_sub($_);
}
return \@ar_result;
}
sub drop {
my ($self, $hr_params) = @_;
require Ref::Util;
my $s_name = Ref::Util::is_hashref($hr_params) ? $hr_params->{name} : undef;
if (!$s_name) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_no_table_name('to drop');
}
require Geoffrey::Utils;
return $self->do(Geoffrey::Utils::replace_spare($self->converter->table->drop, [$s_name]));
}
sub list_from_schema {
my ($self, $schema) = @_;
lib/Geoffrey/Action/View.pm view on Meta::CPAN
}
sub alter {
my ( $self, $params ) = @_;
return [ $self->drop( $params->{name} ), $self->add($params) ];
}
sub drop {
my ( $self, $hr_params ) = @_;
require Geoffrey::Utils;
require Ref::Util;
my $s_name = Ref::Util::is_hashref($hr_params) ? delete $hr_params->{name} : $hr_params;
if ( !$s_name ) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_no_table_name('to drop');
}
return $self->do( Geoffrey::Utils::replace_spare( $self->converter->view->drop, [$s_name] ) );
}
sub list_from_schema {
my ( $self, $schema ) = @_;
my $converter = $self->converter;
lib/Geoffrey/Converter/SQLite/Index.pm view on Meta::CPAN
Geoffrey::Exception::General::throw_no_params();
}
if ( !$params->{table} ) {
require Geoffrey::Exception::RequiredValue;
Geoffrey::Exception::RequiredValue::throw_table_name();
}
if ( !$params->{column} ) {
require Geoffrey::Exception::RequiredValue;
Geoffrey::Exception::RequiredValue::throw_refcolumn_missing();
}
require Ref::Util;
require Geoffrey::Utils;
return Geoffrey::Utils::replace_spare(
q~CREATE INDEX {0} ON {1} ({2})~,
[ Geoffrey::Utils::add_name(
{ prefix => 'ix',
name => $params->{name},
context => $params->{table}
}
),
$params->{table},
( join ', ',
Ref::Util::is_arrayref( $params->{column} )
? @{ $params->{column} }
: ( $params->{column} )
)
]
);
}
sub drop {
my ( $self, $name ) = @_;
if ( !$name ) {