Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require DBIx::Class::Storage; # loaded for type constraint
use DBIx::Class::DeploymentHandler::Types;

use Path::Class qw(file dir);
use utf8;

with 'DBIx::Class::DeploymentHandler::HandlesDeploy';

Expand Down Expand Up @@ -803,6 +804,7 @@ sub prepare_protoschema {

open my $file, q(>), $filename;
binmode $file;
utf8::encode($yml);
print {$file} $yml;
close $file;
}
Expand Down
7 changes: 6 additions & 1 deletion t/deploy_methods/sql_translator.t
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ VERSION3: {
ok( $dm, 'DBIC::DH::SQL::Translator w/3.0 instantiates correctly');

my $version = $s->schema_version();
$dm->prepare_deploy;
{
my @warns;
local $SIG{__WARN__} = sub { push @warns, shift };
$dm->prepare_deploy;
ok scalar @warns == 0, "UTF handled correctly. No 'Wide character in print' warning.";
}
ok(
-f file($sql_dir, qw(SQLite deploy 3.0 001-auto.sql )),
'2.0 schema gets generated properly'
Expand Down
29 changes: 29 additions & 0 deletions t/lib/DBICVersion_v3.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package DBICVersion::Foo;

use utf8;
use base 'DBIx::Class::Core';
use strict;
use warnings;
Expand Down Expand Up @@ -29,6 +30,34 @@ __PACKAGE__->add_columns(

__PACKAGE__->set_primary_key('foo');


sub sqlt_deploy_hook {
my( $self, $sqlt_table ) = @_;

$sqlt_table->schema->add_procedure(
name => 'test_utf',
parameters => [ name => '_string', type => 'text' ],
extra => {
returns => { type => 'VOID' },
definitions => [
{ language => 'sql' },
{ quote => '$$', body => 'SELECT "перевірка ЮТФ/check UTF"' },
]
}
);

$sqlt_table->schema->add_trigger(
name => 'test_utf',
perform_action_when => 'before',
database_events => 'update',
on_table => $sqlt_table->name,
scope => 'row',
action => q!EXECUTE PROCEDURE test_utf("перевірка ЮТФ/check UTF")!
);

}


package DBICVersion::Schema;
use base 'DBIx::Class::Schema';
use strict;
Expand Down