1 package DBIx::Class::Schema::Loader::DBI::Sybase::Common;
5 use base 'DBIx::Class::Schema::Loader::DBI';
6 use Carp::Clan qw/^DBIx::Class/;
9 our $VERSION = '0.07000';
13 DBIx::Class::Schema::Loader::DBI::Sybase::Common - Common methods for Sybase
18 See L<DBIx::Class::Schema::Loader> and L<DBIx::Class::Schema::Loader::Base>.
22 # DBD::Sybase doesn't implement get_info properly
23 sub _build_quoter { '"' }
24 sub _build_namesep { '.' }
29 $self->next::method(@_);
31 $self->schema->storage->sql_maker->quote_char([qw/[ ]/]);
32 $self->schema->storage->sql_maker->name_sep('.');
33 $self->{db_schema} ||= $self->_build_db_schema;
36 sub _build_db_schema {
38 my $dbh = $self->schema->storage->dbh;
40 local $dbh->{FetchHashKeyName} = 'NAME_lc';
42 my $test_table = "_loader_test_$$";
44 my $db_schema = 'dbo'; # default
47 $dbh->do("create table $test_table (id integer)");
48 my $sth = $dbh->prepare('sp_tables');
50 while (my $row = $sth->fetchrow_hashref) {
51 next unless $row->{table_name} eq $test_table;
53 $db_schema = $row->{table_owner};
57 $dbh->do("drop table $test_table");
60 eval { $dbh->do("drop table $test_table") };
61 carp "Could not determine db_schema, defaulting to $db_schema : $exception"
67 # remove 'IDENTITY' from column data_type
68 sub _columns_info_for {
70 my $result = $self->next::method(@_);
72 foreach my $col (keys %$result) {
73 $result->{$col}->{data_type} =~ s/\s* identity \s*//ix;
81 L<DBIx::Class::Schema::Loader::DBI::Sybase>,
82 L<DBIx::Class::Schema::Loader::DBI::MSSQL>,
83 L<DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server>,
84 L<DBIx::Class::Schema::Loader::DBI::Sybase::Microsoft_SQL_Server>,
85 L<DBIx::Class::Schema::Loader::DBI>
86 L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
90 See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
94 This library is free software; you can redistribute it and/or modify it under
95 the same terms as Perl itself.