view release on metacpan or search on metacpan
ALL - turn on all DBI and driver flags (not recommended)
SQL - trace SQL statements executed
(not yet implemented in DBI but implemented in some DBDs)
CON - trace connection process
ENC - trace encoding (unicode translations etc)
(not yet implemented in DBI but implemented in some DBDs)
DBD - trace only DBD messages
(not implemented by all DBDs yet)
TXN - trace transactions
(not implemented in all DBDs yet)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBICx/TestDatabase.pm view on Meta::CPAN
(undef, $filename) = tempfile;
push @TMPFILES, $filename;
}
my $schema = $schema_class->connect( "DBI:SQLite:$filename", '', '',
{ sqlite_unicode => 1 } )
or die "failed to connect to DBI:SQLite:$filename ($schema_class)";
$schema->deploy unless $opts->{nodeploy};
return $schema;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/MySQL/DDL.pm view on Meta::CPAN
join(', ', map { _quote_ident($_) } @to);
}
my $engine = ($result_class->can('mysql_engine') && $result_class->mysql_engine) || 'InnoDB';
my $charset = ($result_class->can('mysql_charset') && $result_class->mysql_charset) || 'utf8mb4';
my $collate = ($result_class->can('mysql_collate') && $result_class->mysql_collate) || 'utf8mb4_unicode_ci';
push @stmts, sprintf "CREATE TABLE %s (\n%s\n) ENGINE=%s DEFAULT CHARSET=%s COLLATE=%s;",
_quote_ident($table_name),
join(",\n", @col_defs),
$engine, $charset, $collate;
lib/DBIO/MySQL/DDL.pm view on Meta::CPAN
my $ddl = DBIO::MySQL::DDL->install_ddl($schema);
The generated DDL is plain SQL, one C<CREATE TABLE> per source. Tables
default to C<ENGINE=InnoDB> and C<CHARSET=utf8mb4 COLLATE
utf8mb4_unicode_ci>. Result classes can override per-table via
C<mysql_engine>, C<mysql_charset>, C<mysql_collate> attributes.
=head1 METHODS
=head2 install_ddl
view all matches for this distribution
view release on metacpan or search on metacpan
$new_row->discard_changes;
ok utf8::is_utf8($new_row->content), 'DBIO CREATE: utf8 flag after discard_changes';
is $new_row->content, $new_str, 'DBIO CREATE: content correct after reload';
}
# --- Part 5: LIKE search with unicode pattern ---
{
my $count = $rs->search({ content => { like => "%\x{1f600}%" } })->count;
cmp_ok $count, '>=', 1, 'LIKE search with unicode pattern returns results';
}
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
share/skills/dbio-sqlite-database/SKILL.md view on Meta::CPAN
## DBD::SQLite
- Bundles SQLite â no external dep
- In-memory: `dbi:SQLite:dbname=:memory:`
- `sqlite_unicode => 1` â enable UTF-8
- Connections NOT shareable across threads
## Type Affinity (advisory, not enforced)
| Affinity | Trigger | Examples |
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/Storage/DBI.pm view on Meta::CPAN
# try to use dsn to not require being connected, the driver may still
# force a connection later in _rebless to determine version
# (dsn may not be supplied at all if all we do is make a mock-schema)
#
# Use the same regex as the one used by DBI itself (even if the use of
# \w is odd given unicode):
# https://metacpan.org/source/TIMB/DBI-1.634/DBI.pm#L621
#
# DO NOT use https://metacpan.org/source/TIMB/DBI-1.634/DBI.pm#L559-566
# as there is a long-standing precedent of not loading DBI.pm until the
# very moment we are actually connecting
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Admin/TableInfo.pm view on Meta::CPAN
use Text::Table::Manifold ':constants';
# ---------------------
my($attr) = {};
$$attr{sqlite_unicode} = 1 if ($ENV{DBI_DSN} =~ /SQLite/i);
my($dbh) = DBI -> connect($ENV{DBI_DSN}, $ENV{DBI_USER}, $ENV{DBI_PASS}, $attr);
my($vendor_name) = uc $dbh -> get_info(17);
my($info) = DBIx::Admin::TableInfo -> new(dbh => $dbh) -> info;
$dbh -> do('pragma foreign_keys = on') if ($ENV{DBI_DSN} =~ /SQLite/i);
lib/DBIx/Admin/TableInfo.pm view on Meta::CPAN
align_left,
align_left,
align_left,
align_left,
],
format => format_text_unicodebox_table,
headers => \@header,
join => "\n",
);
my(%type) =
(
view all matches for this distribution
view release on metacpan or search on metacpan
my $dir = tempdir(CLEANUP => 1);
my (undef, $db) = tempfile(DIR => $dir, SUFFIX => '.db');
my $dbh = DBI->connect(
"dbi:SQLite:dbname=$db" , '', '', {
sqlite_unicode => 1,
},
);
$dbh->do('CREATE TABLE item (
id INTEGER PRIMARY KEY AUTOINCREMENT,
view all matches for this distribution
view release on metacpan or search on metacpan
Debian_CPANTS.txt view on Meta::CPAN
"libtree-dagnode-perl", "Tree-DAG_Node", "1.06", "0", "0"
"libtree-redblack-perl", "Tree-RedBlack", "0.5", "0", "0"
"libtree-simple-perl", "Tree-Simple", "1.18", "0", "0"
"libtree-simple-visitorfactory-perl", "Tree-Simple-VisitorFactory", "0.10", "0", "0"
"libtry-tiny-perl", "Try-Tiny", "0.02", "0", "0"
"libunicode-map-perl", "Unicode-Map", "0.112", "1", "0"
"libunicode-map8-perl-dfsg", "Unicode-Map8", "0.12", "0", "0"
"libunicode-maputf8-perl", "Unicode-MapUTF8", "1.11", "0", "0"
"libunicode-string-perl", "Unicode-String", "2.09", "0", "0"
"libuniversal-can-perl", "UNIVERSAL-can", "1.15", "0", "0"
"libuniversal-isa-perl", "UNIVERSAL-isa", "1.02", "0", "0"
"libuniversal-moniker-perl", "UNIVERSAL-moniker", "0.08", "0", "0"
"libuniversal-require-perl", "UNIVERSAL-require", "0.13", "0", "0"
"libunix-syslog-perl", "Unix-Syslog", "1.1", "0", "0"
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/DBICTest.pm view on Meta::CPAN
my $dbuser = $args{"user"} || '';
my $dbpass = $args{"pass"} || '';
my $schema;
my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1, sqlite_unicode => 1 });
if ($args{compose_connection}) {
$schema = DBICTest::Schema->compose_connection(
'DBICTest', @connect_info
);
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/I18NTest.pm view on Meta::CPAN
$schema_class ||= 'I18NTest::Schema';
eval "require $schema_class"
or die "failed to require $schema_class: $@";
my $schema = $schema_class->connect("DBI:SQLite::memory:",'','', { sqlite_unicode => 1 })
or die "failed to connect to DBI:SQLite::memory: ($schema_class)";
$schema->deploy;
return $schema;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/testlib/TestDB.pm view on Meta::CPAN
my $dbh = DBI->connect(
"dbi:SQLite:dbname=:memory:",
"", "",
{ RaiseError => 1,
sqlite_unicode => 1,
}
);
$dbh->do( "
CREATE TABLE test (
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/DBICTest.pm view on Meta::CPAN
my $dsn = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file}";
my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1, sqlite_unicode => 1, %args });
return @connect_info;
}
sub init_schema {
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t
t/basic.t
t/lib/TestSchema.pm
t/lib/TestSchema.sql
t/lib/TestSchema/Result/Foo.pm
t/unicode.t
xt/author/00-compile.t
xt/author/changes_has_content.t
xt/author/clean-namespaces.t
xt/author/eol.t
xt/author/kwalitee.t
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
# Same API for the others
nchar ... data_type => 'nchar' ...
bit ... data_type => 'bit' ...
C<nchar> (SQL Server unicode char array) has an identical API but
returns C<< data_type => 'nchar' >>
Note that Postgres allows C<"bit"> to have a size, like C<char($size)> but SQL Server
uses C<"bit"> only to represent a single bit.
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
# MySQL specific variants:
tinytext data_type => 'tinytext', size => 0xFF
mediumtext data_type => 'mediumtext', size => 0xFFFFFF
longtext data_type => 'longtext', size => 0xFFFFFFFF
# SQL Server unicode variant:
ntext data_type => 'ntext', size => 0x3FFFFFFF
ntext($size) data_type => 'ntext', size => $size
See MySQL notes in C<blob>. For SQL Server, you might want C<ntext> or C<< nvarchar(MAX) >>
instead. Postgres does not use a size, and allows arrays of this type.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Schema/Loader/DBI/InterBase.pm view on Meta::CPAN
if ($sub_type_name eq 'BINARY') {
$info->{data_type} = 'blob';
}
elsif ($sub_type_name eq 'TEXT') {
if (defined $char_set_id && $char_set_id == 3) {
$info->{data_type} = 'blob sub_type text character set unicode_fss';
}
else {
$info->{data_type} = 'blob sub_type text';
}
}
lib/DBIx/Class/Schema/Loader/DBI/InterBase.pm view on Meta::CPAN
if ($data_type =~ /^(?:char|varchar)\z/) {
$info->{size} = $char_length;
if (defined $char_set_id && $char_set_id == 3) {
$info->{data_type} .= '(x) character set unicode_fss';
}
}
elsif ($data_type !~ /^(?:numeric|decimal)\z/) {
delete $info->{size};
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Pod/Markdown.pm view on Meta::CPAN
$section =~ s/^\s+//;
$section =~ s/\s+$//;
$section =~ tr/ /_/;
$section =~ tr/\x00-\x1F\x80-\x9F//d if 'A' eq chr(65); # drop crazy characters
#$section = $self->unicode_escape_url($section);
# unicode_escape_url {
$section =~ s/([^\x00-\xFF])/'('.ord($1).')'/eg;
# Turn char 1234 into "(1234)"
# }
$section = '_' unless length $section;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Role/MySQL.pm view on Meta::CPAN
my $self = shift;
no warnings 'once'; # prevent: "Test::mysqld::errstr" used only once
my $mysqld = Test::mysqld->new(
my_cnf => {
'character-set-server' => 'utf8',
'collation-server' => 'utf8_unicode_ci',
'skip-networking' => '',
}
) or die $Test::mysqld::errstr;
return $mysqld;
}
view all matches for this distribution
view release on metacpan or search on metacpan
0.1.3
* Pass plain "BLOB" type as binary.
0.1.2
* Fix breaking of non-ASCII unicode in previous release.
0.1.1
* Pass BLOBs correctly.
* Make Kwalitee happier.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class.pm view on Meta::CPAN
# as the distbuild-time injected author list is utf8 encoded
# Without this pod2text output is less than ideal
#
# A bit regarding selection/compatiblity:
# Before 5.8.7 UTF-8 was == utf8, both behaving like the (lax) utf8 we know today
# Then https://www.nntp.perl.org/group/perl.unicode/2004/12/msg2705.html happened
# Encode way way before 5.8.0 supported UTF-8: https://metacpan.org/source/DANKOGAI/Encode-1.00/lib/Encode/Supported.pod#L44
# so it is safe for the oldest toolchains.
# Additionally we inject all the utf8 programattically and test its well-formedness
# so all is well
#
view all matches for this distribution
view release on metacpan or search on metacpan
{
{
my $dbi = DBIx::Custom->connect(
dsn => 'dbi:SQLite:dbname=:memory:',
option => {
$DBD::SQLite::VERSION > 1.26 ? (sqlite_unicode => 1) : (unicode => 1)
}
);
my $binary = pack("I3", 1, 2, 3);
eval { $dbi->execute('drop table table1') };
$dbi->execute('create table table1(key1, key2)');
}
{
my $dbi = DBIx::Custom->connect(
dsn => 'dbi:SQLite:dbname=:memory:',
option => {
$DBD::SQLite::VERSION > 1.26 ? (sqlite_unicode => 1) : (unicode => 1)
}
);
my $binary = pack("I3", 1, 2, 3);
eval { $dbi->execute('drop table table1') };
$dbi->execute('create table table1(key1, key2)');
view all matches for this distribution
view release on metacpan or search on metacpan
Sybase => 'server', ODBC => '', XBase => '');
my %kwportmap = (mysql => 'port', Pg => 'port');
my %kwutf8map = (mysql => 'mysql_enable_utf8',
Pg => 'pg_enable_utf8',
SQLite => 'sqlite_unicode',
Sybase => 'syb_enable_utf8');
# Whether the DBMS supports transactions
my %transactmap = (mSQL => 0, mysql => 0, Pg => 1, Sybase => 'server',
ODBC => 0, XBase => 0);
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_utf8.t view on Meta::CPAN
note 'Text::CSV';
note sprintf(" %-${_column_width}s : %s", 'VERSION', Text::CSV->VERSION);
note sprintf(" %-${_column_width}s : %s", 'Backend', Text::CSV->module);
note sprintf(" %-${_column_width}s : %s", 'Backend::VERSION', Text::CSV->version);
my $dbh = DBI->connect("dbi:SQLite::memory:", '', '', {RaiseError => 1, sqlite_unicode => 1}) or die 'cannot connect to db';
$dbh->do(q{
CREATE TABLE item (
id INTEGER PRIMARY KEY,
name VARCHAR(255)
);
view all matches for this distribution
view release on metacpan or search on metacpan
pad_sv|||
pad_swipe|||
pad_tidy|||
pad_undef|||
parse_body|||
parse_unicode_opts|||
path_is_absolute|||
peep|||
pending_ident|||
perl_alloc_using|||n
perl_alloc|||n
view all matches for this distribution
view release on metacpan or search on metacpan
my $file = shift || ':memory:';
DBI->connect('dbi:SQLite:'.$file,'','',{
RaiseError => 1,
PrintError => 0,
AutoCommit => 1,
sqlite_unicode => 1,
});
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01records.t view on Meta::CPAN
($val,$msg) = $rec->SetName('1234567890123456789012345678901234567890');
ok(!$val, $msg);
is($msg, 'That is already the current value', 'No update for same value');
is($rec->Name, '12345678901234', "Value is the same");
# Test unicode truncation:
my $univalue = "鿝忏¬è©¦";
($val,$msg) = $rec->SetName($univalue.$univalue);
ok($val, $msg) ;
is($rec->Name, '鿝忏¬');
view all matches for this distribution
view release on metacpan or search on metacpan
examples/lib/My/App.pm view on Meta::CPAN
my $app = shift;
DBIx::Simple::Class->DEBUG(1);
my $dbix = DBIx::Simple->connect(
"dbi:SQLite:dbname=$ENV{users_HOME}/db.sqlite",
{sqlite_unicode => 1, RaiseError => 1}
) || die $DBI::errstr;
DBIx::Simple::Class->dbix($dbix);
$dbix->query(<<"TAB");
CREATE TABLE IF NOT EXISTS groups(
id INTEGER PRIMARY KEY AUTOINCREMENT,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Simple/DataSection.pm view on Meta::CPAN
}
elsif ( $driver_name eq 'mysql' ) {
$self->{dbh}->{mysql_enable_utf8} = 1;
}
elsif ( $driver_name eq 'SQLite' ) {
$self->{dbh}->{unicode} = 1;
}
}
sub connect {
my $self = shift->SUPER::connect(@_);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Simplish.pm view on Meta::CPAN
if ($self->_is_mysql) {
$options->{mysql_enable_utf8} = 1 unless exists $options->{mysql_enable_utf8};
$options->{mysql_enable_utf8mb4} = 1 unless exists $options->{mysql_enable_utf8mb4};
} elsif ($self->_is_sqlite) {
$options->{sqlite_use_immediate_transaction} = 1 unless exists $options->{sqlite_use_immediate_transaction};
$options->{sqlite_unicode} = 1 unless exists $options->{sqlite_unicode};
}
my $connector = DBIx::Connector->new(
$self->dsn,
$self->user,
$self->password,
view all matches for this distribution
view release on metacpan or search on metacpan
examples/01.pl view on Meta::CPAN
"",
"",
{
PrintError => !!0,
RaiseError => !!1,
sqlite_unicode => !!1,
},
);
};
get_artist_id_by_name do {
view all matches for this distribution