view release on metacpan or search on metacpan
t/40blobs.t view on Meta::CPAN
my $size= 128;
ok $dbh->do("DROP TABLE IF EXISTS $table"), "Drop table if exists $table";
$dbh->{mysql_enable_utf8}=1;
my $create = <<EOT;
CREATE TABLE $table (
id INT NOT NULL DEFAULT 0,
name BLOB)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/mysql.pm view on Meta::CPAN
You can also set or unset the C<mysql_use_result> setting on your statement
handle, when creating the statement handle or after it has been created.
See L</"STATEMENT HANDLES">.
=item mysql_enable_utf8
This attribute determines whether DBD::mysql should assume strings
stored in the database are utf8. This feature defaults to off.
When set, a data retrieved from a textual column type (char, varchar,
lib/DBD/mysql.pm view on Meta::CPAN
my $wide_string_param = "Andr\x{E9}"; # Andre with LATIN SMALL LETTER E WITH ACUTE (U+E9)
my $byte_param = "\x{D8}\x{A0}\x{39}\x{F8}"; # some bytes (binary data)
my $dbh = DBI->connect('DBI:mysql:database', 'username', 'pass', { mysql_enable_utf8mb4 => 1 });
utf8::upgrade($statement); # UTF-8 fix for DBD::mysql
my $sth = $dbh->prepare($statement);
utf8::upgrade($wide_string_param); # UTF-8 fix for DBD::mysql
lib/DBD/mysql.pm view on Meta::CPAN
$sth->execute();
my $output = $sth->fetchall_arrayref();
# returned data in $output reference should be already UTF-8 decoded as appropriate
=item mysql_enable_utf8mb4
This is similar to mysql_enable_utf8, but is capable of handling 4-byte
UTF-8 characters.
=item mysql_bind_type_guessing
This attribute causes the driver (emulated prepare statements)
view all matches for this distribution
view release on metacpan or search on metacpan
ex/unicode_test.pl view on Meta::CPAN
elsif ($driver eq 'Pg') {
$unicode_column_type = 'varchar';
}
elsif ($driver eq 'mysql') {
# does not support type_info_all
$h->{mysql_enable_utf8} = 1;
#####$blob_column_type = 'blob';
#####$blob_bind_type = SQL_BLOB;
#####$unicode_column_type = 'varchar';
$length_fn = 'char_length';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/DeploymentAdapter.pm view on Meta::CPAN
my $args = {
schema => $schema,
script_directory => './share/migrations',
databases => ['MySQL'],
sql_translator_args => { mysql_enable_utf8 => 1 },
};
$args->{to_version} = $to_version if $to_version;
$args->{force_overwrite} = $force_overwrite if $force_overwrite;
lib/DBIx/Class/DeploymentAdapter.pm view on Meta::CPAN
return unless $args && $args->{schema};
$args->{script_directory} ||= "./share/migrations";
$args->{databases} ||= ["MySQL"];
$args->{sql_translator_args} ||= { mysql_enable_utf8 => 1 };
my $dh = DBIx::Class::DeploymentHandler->new($args);
$self->dh_store($dh);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Role/MySQL.pm view on Meta::CPAN
sub connect_info {
my $self = shift;
return ( $self->database->dsn( dbname => 'test' ), undef, undef,
{
mysql_enable_utf8 => 1,
on_connect_call => 'set_strict_mode',
quote_names => 1,
}
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/UTF8Columns.pm view on Meta::CPAN
to further discuss your concerns with the team.
=head2 Warning - Native Database Unicode Support
If your database natively supports Unicode (as does SQLite with the
C<sqlite_unicode> connect flag, MySQL with C<mysql_enable_utf8>
connect flag or Postgres with the C<pg_enable_utf8> connect flag),
then this component should B<not> be used, and will corrupt unicode
data in a subtle and unexpected manner.
It is far better to do Unicode support within the database if
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Custom.pm view on Meta::CPAN
# Connect
my $dbi = DBIx::Custom->connect(
"dbi:mysql:database=dbname",
'ken',
'!LFKD%$&',
{mysql_enable_utf8 => 1}
);
# Create model
$dbi->create_model('book');
lib/DBIx/Custom.pm view on Meta::CPAN
# DBI compatible arguments
my $dbi = DBIx::Custom->connect(
"dbi:mysql:database=dbname",
'ken',
'!LFKD%$&',
{mysql_enable_utf8 => 1}
);
# pass DBIx::Custom attributes
my $dbi = DBIx::Custom->connect(
dsn => "dbi:mysql:database=dbname",
user => 'ken',
password => '!LFKD%$&',
option => {mysql_enable_utf8 => 1}
);
Connect to the database and create a new L<DBIx::Custom> object.
L<DBIx::Custom> is a wrapper of L<DBI>.
lib/DBIx/Custom.pm view on Meta::CPAN
my $dbi = DBIx::Custom->new(
dsn => "dbi:mysql:database=dbname",
user => 'ken',
password => '!LFKD%$&',
option => {mysql_enable_utf8 => 1}
);
Create a new L<DBIx::Custom> object.
=head2 not_exists
view all matches for this distribution
view release on metacpan or search on metacpan
undef,
undef,
{
AutoCommit => 1,
RaiseError => 1,
mysql_enable_utf8 => 1,
quote_char => '`',
name_sep => '.',
},
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/DBFlow.pm view on Meta::CPAN
undef,
undef,
{
AutoCommit => 1,
RaiseError => 1,
mysql_enable_utf8 => 1,
quote_char => '`',
name_sep => '.',
},
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-dbix-datafactory.t view on Meta::CPAN
my $factory_maker = DBIx::DataFactory->new({
username => 'root',
password => '',
dsn => $self->mysqld->dsn(dbname => 'test_factory'),
connect_attr => {
mysql_enable_utf8 => 1,
on_connect_do => [
"SET NAMES 'utf8'",
"SET CHARACTER SET 'utf8'"
],
},
view all matches for this distribution
view release on metacpan or search on metacpan
Sybase => 'database', ODBC => '', XBase => '');
my %kwhostmap = (mSQL => 'host', mysql => 'host', Pg => 'host',
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
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Fast.pm view on Meta::CPAN
trace => $args->{trace} // '',
profile => $args->{profile} // '',
abstract => $args->{abstract} // 1
};
$DConf->{DBI}->{mysql_enable_utf8} = 1 if $args->{mysql_enable_utf8};
$self->_set_args($DConf);
$self->Q( SQL::Abstract->new ) if $self->args->{abstract};
view all matches for this distribution
view release on metacpan or search on metacpan
t/03_mysql.t view on Meta::CPAN
use DBI;
use DBIx::FixtureLoader;
use Test::Requires 'Test::mysqld';
my $mysqld = Test::mysqld->new(my_cnf => {'skip-networking' => ''}) or plan skip_all => $Test::mysqld::errstr;
my $dbh = DBI->connect($mysqld->dsn, '', '', {RaiseError => 1, mysql_enable_utf8 => 1}) or die 'cannot connect to db';
for my $cond ([], [bulk_insert => 0]) {
my @cond = @$cond;
my $bulk = @cond ? 'no bulk' : 'bulk insert';
note $bulk;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/dbix_replicate view on Meta::CPAN
Examples:
# copy using DBIx::Replicate::Strategy::CopyBy
$0 \
--src='dbi:mysql:test;table=t;host=db1;user=root;mysql_enable_utf8=1' \
--dest='dbi:mysql:test;table=t;host=db2;user=root;mysql_enable_utf8=1' \
--copy-by='id,subid'
# copy using DBIx::Replicate::Strategy::PK
$0 \
--src='dbi:mysql:test;table=t;host=db1;user=root;mysql_enable_utf8=1' \
--dest='dbi:mysql:test;table=t;host=db2;user=root;mysql_enable_utf8=1' \
--primary-key='id' \
--columns='subid,name,flags'
EOT
;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/dsc_dump_schema.pl view on Meta::CPAN
dsc_dump_schema.pl - script to dump a schema from a database
=head1 SYNOPSIS
#dump all tables
dsc_dump_schema.pl --dsn DBI:mysql:database=mydb;host=127.0.0.1;mysql_enable_utf8=1 \
-u me -p mypassword --overwrite 1 --lib_root ./lib
#dump only the "users" table - using short options and choosing a namespace
dsc_dump_schema.pl -dsn dbi:SQLite:database=etc/ado.sqlite -n Ado::Model -l lib -t users
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Simple/DataSection.pm view on Meta::CPAN
my $driver_name = $self->{dbd};
if ( $driver_name eq 'Pg' ) {
$self->{dbh}->{pg_enable_utf8} = 1;
}
elsif ( $driver_name eq 'mysql' ) {
$self->{dbh}->{mysql_enable_utf8} = 1;
}
elsif ( $driver_name eq 'SQLite' ) {
$self->{dbh}->{unicode} = 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Simplish.pm view on Meta::CPAN
my $self = shift;
my $options = $self->options;
$options->{PrintError} = 0 unless exists $options->{PrintError};
$options->{RaiseError} = 1 unless exists $options->{RaiseError};
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(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Struct.pm view on Meta::CPAN
my ($driver) = $dsn =~ /^dbi:(\w*?)(?:\((.*?)\))?:/i;
if ($driver) {
if ($driver eq 'Pg') {
$connect_attrs->{pg_enable_utf8} = 1;
} elsif ($driver eq 'mysql') {
$connect_attrs->{mysql_enable_utf8} = 1;
} elsif ($driver eq 'SQLite') {
$connect_attrs->{sqlite_unicode} = 1;
}
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Sunny.pm view on Meta::CPAN
$attr->{AutoInactiveDestroy} = 1;
if ($dsn =~ /^(?i:dbi):SQLite:/) {
$attr->{sqlite_use_immediate_transaction} = 1;
$attr->{sqlite_unicode} = 1 unless exists $attr->{sqlite_unicode};
}
if ($dsn =~ /^(?i:dbi):mysql:/ && ! exists $attr->{mysql_enable_utf8} && ! exists $attr->{mysql_enable_utf8mb4} ) {
$attr->{mysql_enable_utf8} = 1;
}
if ($dsn =~ /^(?i:dbi):Pg:/ && ! exists $attr->{pg_enable_utf8}) {
$attr->{pg_enable_utf8} = 1;
}
$class->SUPER::connect($dsn, $user, $pass, $attr);
lib/DBIx/Sunny.pm view on Meta::CPAN
$dbh->do("PRAGMA journal_mode = WAL");
$dbh->do("PRAGMA synchronous = NORMAL");
}
if ($dsn =~ /^dbi:mysql:/ && ! exists $attr->{mysql_enable_utf8} && ! exists $attr->{mysql_enable_utf8mb4} ) {
$dbh->{mysql_enable_utf8} = 1;
$dbh->do("SET NAMES utf8");
}
if ($dsn =~ /^dbi:mysql:/) {
$dbh->{mysql_auto_reconnect} = 0;
}
lib/DBIx/Sunny.pm view on Meta::CPAN
DBIx::Sunny sets AutoInactiveDestroy as true.
=item [SQLite/MySQL/Pg] Auto encode/decode UTF-8
DBIx::Sunny sets sqlite_unicode, mysql_enable_utf8 and pg_enable_utf8 automatically.
=item [SQLite] Performance tuning
DBIx::Sunny sets sqlite_use_immediate_transaction to true, and executes these PRAGMA statements
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/TempDB/Util.pm view on Meta::CPAN
$opt{AutoCommit} //= 1;
$opt{AutoInactiveDestroy} //= 1;
$opt{PrintError} //= 0;
$opt{RaiseError} //= 1;
$opt{mysql_enable_utf8} //= 1;
return $dsn, @userinfo[0, 1], \%opt;
}
sub _dsn_for_pg {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBQuery.pm view on Meta::CPAN
sub connect
{
my $self = shift;
if ($_[0] && $self->{driver} eq 'mysql') {
$self->{dbh} = DBI->connect($self->{dsn}, $self->{user}, $self->{pass}, {'RaiseError' => 1, 'mysql_enable_utf8' => 1});
} else {
$self->{dbh} = DBI->connect($self->{dsn}, $self->{user}, $self->{pass}, {'RaiseError' => 1});
}
if ($self->{driver} eq 'mysql') {
$self->{dbh}->{mysql_auto_reconnect} = $self->{pconnect} ? 1 : 0;
$self->{dbh}->{mysql_enable_utf8} = $self->{utf8} ? 1 : 0;
$self->{dbh}->{mysql_no_autocommit_cmd} = $self->{autocommit} ? 0 : 1;
} elsif ($self->{driver} eq 'Oracle') {
$self->{dbh}->{LongReadLen} = $self->{LongReadLen};
$self->{dbh}->{LongTruncOk} = $self->{LongTruncOk};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Database/Core.pm view on Meta::CPAN
if (lc $app_charset eq 'utf-8' && $auto_utf8) {
# The option to pass to the DBI->connect call depends on the driver:
my %param_for_driver = (
SQLite => 'sqlite_unicode',
mysql => 'mysql_enable_utf8',
Pg => 'pg_enable_utf8',
);
my $param = $param_for_driver{$driver};
view all matches for this distribution
view release on metacpan or search on metacpan
t/environment/mysql.yml view on Meta::CPAN
plugins:
DBIC:
default:
options:
mysql_enable_utf8: 1
on_connect_call: set_strict_mode
quote_names: 1
session: DBIC
engines:
session:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/FIAS/SQL.pm view on Meta::CPAN
password => 'pass',
},
# ÐпÑионалÑнÑе паÑамеÑÑÑ
additional_connection_params => {
# вÑÑÑавлÑем Ñлаг UTF-8 Ð´Ð»Ñ Ð½Ð¾ÑмалÑной ÑабоÑÑ Ñ unicode( опÑионалÑно)
mysql_enable_utf8 => 1,
}
);
# авÑомаÑиÑеÑкое ÑкаÑивание и ÑаÑпаковка пока не ÑеализованÑ
# ÑÐ°Ð¹Ð»Ñ Ð±ÑаÑÑ Ð·Ð´ÐµÑÑ https://fias.nalog.ru/Updates.aspx ( ÐÐ¾Ð»Ð½Ð°Ñ ÐРФÐÐС, DBF )
lib/FIAS/SQL.pm view on Meta::CPAN
login -- логин Ð´Ð»Ñ Ð¿Ð¾Ð´ÐºÐ»ÑÑÐµÐ½Ð¸Ñ Ðº базе
password -- паÑÐ¾Ð»Ñ Ð´Ð»Ñ Ð¿Ð¾Ð´ÐºÐ»ÑÑÐµÐ½Ð¸Ñ Ðº базе
# ÐпÑионалÑно
additional_connection_params {
# Ñлаг Ð´Ð»Ñ Ð¿Ð¾Ð´ÐºÐ»ÑÑÐµÐ½Ð¸Ñ Ðº MySQL базе( опÑионалÑно )
mysql_enable_utf8 => 1
}
=item B<load_files>
ÐеÑод Ð´Ð»Ñ Ð·Ð°Ð³ÑÑзки dbf Ñайлов в базÑ
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Fey/DBIManager/Source.pm view on Meta::CPAN
=item * post_connect
This is an optional subroutine reference which will be called after a
handle is created with C<< DBI->connect() >>. This is a handy way to
set connection info or to set driver-specific attributes like
"mysql_enable_utf8" or "pg_auto_escape".
=item * auto_refresh
A boolean value. The default is true, which means that whenever you
call C<< $source->dbh() >>, the source ensures that the database
view all matches for this distribution
view release on metacpan or search on metacpan
lib/FirewallManager.pm view on Meta::CPAN
my $db_params = {
"dsn" => "DBI:MariaDB:database=eladmin",
"username" => "careline",
"password" => "Cisc0123",
#"options" => { mysql_enable_utf8 => 1 }
};
my $headers = Mojo::Headers->new;
$headers->access_control_allow_origin;
# Load configuration from hash returned by config file
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gearman/Driver.pm view on Meta::CPAN
worker_options => {
'GLOBAL' => {
'config' => $config,
},
'My::Workers::MysqlPing' => {
'dsn' => 'DBI:mysql:database=test;host=localhost;mysql_auto_reconnect=1;mysql_enable_utf8=1;mysql_server_prepare=1;',
},
'My::Workers::ImageThumbnail' => {
'default_format' => 'jpeg',
'default_size => ' 133 x 100 ',
}
lib/Gearman/Driver.pm view on Meta::CPAN
You should define these in a runtime config (See also L</configfile>), might be:
---
worker_options:
'My::App::Worker::MysqlPing':
'dsn': 'DBI:mysql:database=test;host=localhost;mysql_auto_reconnect=1;mysql_enable_utf8=1;mysql_server_prepare=1;'
'user': 'root'
'password:': ''
'My::App::Worker::ImageThumbnail':
'default_format': 'jpeg'
'default_size': '133x100'
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/FormFu/Manual/Unicode.pod view on Meta::CPAN
best options, as it will decode all input retrieved from the database -
see L</DBIx::Class Configuration>.
In other cases (i.e. plain DBI), you still need to decode the string data
coming from the database. This varies depending on the database server.
For MySQL, for instance, you can use the C<mysql_enable_utf8> attribute:
see L<DBD::mysql> documentation for details.
=head2 Your template files
Set TT to decode all template files - see L</TT Configuration>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hailo/Storage/MySQL.pm view on Meta::CPAN
sub _build_dbd { return 'mysql' };
override _build_dbd_options => sub {
return {
%{ super() },
mysql_enable_utf8 => 1,
};
};
sub _build_dbi_options {
my ($self) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Interchange6/Test/Role/MySQL.pm view on Meta::CPAN
my $self = shift;
return (
$self->database->dsn( dbname => 'test' ),
undef, undef,
{
mysql_enable_utf8 => 1,
on_connect_call => 'set_strict_mode',
quote_names => 1,
}
);
}
view all matches for this distribution