1 package DBIx::Class::Storage::DBI;
2 # -*- mode: cperl; cperl-indent-level: 2 -*-
4 use base 'DBIx::Class::Storage';
9 use SQL::Abstract::Limit;
10 use DBIx::Class::Storage::DBI::Cursor;
11 use DBIx::Class::Storage::Statistics;
13 use Carp::Clan qw/DBIx::Class/;
16 package DBIC::SQL::Abstract; # Would merge upstream, but nate doesn't reply :(
18 use base qw/SQL::Abstract::Limit/;
21 my ($self, $table, $fields, $where, $order, @rest) = @_;
22 $table = $self->_quote($table) unless ref($table);
23 @rest = (-1) unless defined $rest[0];
24 die "LIMIT 0 Does Not Compute" if $rest[0] == 0;
25 # and anyway, SQL::Abstract::Limit will cause a barf if we don't first
26 local $self->{having_bind} = [];
27 my ($sql, @ret) = $self->SUPER::select(
28 $table, $self->_recurse_fields($fields), $where, $order, @rest
30 return wantarray ? ($sql, @ret, @{$self->{having_bind}}) : $sql;
36 $table = $self->_quote($table) unless ref($table);
37 $self->SUPER::insert($table, @_);
43 $table = $self->_quote($table) unless ref($table);
44 $self->SUPER::update($table, @_);
50 $table = $self->_quote($table) unless ref($table);
51 $self->SUPER::delete($table, @_);
57 return $_[1].$self->_order_by($_[2]);
59 return $self->SUPER::_emulate_limit(@_);
64 my ($self, $fields) = @_;
65 my $ref = ref $fields;
66 return $self->_quote($fields) unless $ref;
67 return $$fields if $ref eq 'SCALAR';
69 if ($ref eq 'ARRAY') {
70 return join(', ', map { $self->_recurse_fields($_) } @$fields);
71 } elsif ($ref eq 'HASH') {
72 foreach my $func (keys %$fields) {
73 return $self->_sqlcase($func)
74 .'( '.$self->_recurse_fields($fields->{$func}).' )';
83 if (ref $_[0] eq 'HASH') {
84 if (defined $_[0]->{group_by}) {
85 $ret = $self->_sqlcase(' group by ')
86 .$self->_recurse_fields($_[0]->{group_by});
88 if (defined $_[0]->{having}) {
90 ($frag, @extra) = $self->_recurse_where($_[0]->{having});
91 push(@{$self->{having_bind}}, @extra);
92 $ret .= $self->_sqlcase(' having ').$frag;
94 if (defined $_[0]->{order_by}) {
95 $ret .= $self->SUPER::_order_by($_[0]->{order_by});
97 } elsif(ref $_[0] eq 'SCALAR') {
98 $ret = $self->_sqlcase(' order by ').${ $_[0] };
100 $ret = $self->SUPER::_order_by(@_);
105 sub _order_directions {
106 my ($self, $order) = @_;
107 $order = $order->{order_by} if ref $order eq 'HASH';
108 return $self->SUPER::_order_directions($order);
112 my ($self, $from) = @_;
113 if (ref $from eq 'ARRAY') {
114 return $self->_recurse_from(@$from);
115 } elsif (ref $from eq 'HASH') {
116 return $self->_make_as($from);
118 return $from; # would love to quote here but _table ends up getting called
119 # twice during an ->select without a limit clause due to
120 # the way S::A::Limit->select works. should maybe consider
121 # bypassing this and doing S::A::select($self, ...) in
122 # our select method above. meantime, quoting shims have
123 # been added to select/insert/update/delete here
128 my ($self, $from, @join) = @_;
130 push(@sqlf, $self->_make_as($from));
131 foreach my $j (@join) {
134 # check whether a join type exists
135 my $join_clause = '';
136 my $to_jt = ref($to) eq 'ARRAY' ? $to->[0] : $to;
137 if (ref($to_jt) eq 'HASH' and exists($to_jt->{-join_type})) {
138 $join_clause = ' '.uc($to_jt->{-join_type}).' JOIN ';
140 $join_clause = ' JOIN ';
142 push(@sqlf, $join_clause);
144 if (ref $to eq 'ARRAY') {
145 push(@sqlf, '(', $self->_recurse_from(@$to), ')');
147 push(@sqlf, $self->_make_as($to));
149 push(@sqlf, ' ON ', $self->_join_condition($on));
151 return join('', @sqlf);
155 my ($self, $from) = @_;
156 return join(' ', map { (ref $_ eq 'SCALAR' ? $$_ : $self->_quote($_)) }
157 reverse each %{$self->_skip_options($from)});
161 my ($self, $hash) = @_;
163 $clean_hash->{$_} = $hash->{$_}
164 for grep {!/^-/} keys %$hash;
168 sub _join_condition {
169 my ($self, $cond) = @_;
170 if (ref $cond eq 'HASH') {
173 my $x = '= '.$self->_quote($cond->{$_}); $j{$_} = \$x;
175 return $self->_recurse_where(\%j);
176 } elsif (ref $cond eq 'ARRAY') {
177 return join(' OR ', map { $self->_join_condition($_) } @$cond);
179 die "Can't handle this yet!";
184 my ($self, $label) = @_;
185 return '' unless defined $label;
186 return "*" if $label eq '*';
187 return $label unless $self->{quote_char};
188 if(ref $self->{quote_char} eq "ARRAY"){
189 return $self->{quote_char}->[0] . $label . $self->{quote_char}->[1]
190 if !defined $self->{name_sep};
191 my $sep = $self->{name_sep};
192 return join($self->{name_sep},
193 map { $self->{quote_char}->[0] . $_ . $self->{quote_char}->[1] }
194 split(/\Q$sep\E/,$label));
196 return $self->SUPER::_quote($label);
202 $_[0] =~ s/SELECT (.*?) FROM/
203 'SELECT '.join(', ', map { $_.' AS col'.++$c } split(', ', $1)).' FROM'/e;
204 $self->SUPER::_RowNum(@_);
209 $self->{limit_dialect} = shift if @_;
210 return $self->{limit_dialect};
215 $self->{quote_char} = shift if @_;
216 return $self->{quote_char};
221 $self->{name_sep} = shift if @_;
222 return $self->{name_sep};
225 } # End of BEGIN block
227 use base qw/DBIx::Class/;
229 __PACKAGE__->load_components(qw/AccessorGroup/);
231 __PACKAGE__->mk_group_accessors('simple' =>
232 qw/_connect_info _dbh _sql_maker _conn_pid _conn_tid debug debugobj
233 cursor on_connect_do transaction_depth/);
240 my $new = bless({}, ref $_[0] || $_[0]);
241 $new->cursor("DBIx::Class::Storage::DBI::Cursor");
242 $new->transaction_depth(0);
244 $new->debugobj(new DBIx::Class::Storage::Statistics());
247 if (defined($ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}) &&
248 ($ENV{DBIX_CLASS_STORAGE_DBI_DEBUG} =~ /=(.+)$/)) {
249 $fh = IO::File->new($1, 'w')
250 or $new->throw_exception("Cannot open trace file $1");
252 $fh = IO::File->new('>&STDERR');
255 $new->debug(1) if $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG};
259 =head2 throw_exception
261 Throws an exception - croaks.
265 sub throw_exception {
266 my ($self, $msg) = @_;
272 DBIx::Class::Storage::DBI - DBI storage handler
278 This class represents the connection to the database
286 The arguments of C<connect_info> are always a single array reference.
288 This is normally accessed via L<DBIx::Class::Schema/connection>, which
289 encapsulates its argument list in an arrayref before calling
290 C<connect_info> here.
292 The arrayref can either contain the same set of arguments one would
293 normally pass to L<DBI/connect>, or a lone code reference which returns
294 a connected database handle.
296 In either case, there is an optional final element within the arrayref
297 which can hold a hashref of connection-specific Storage::DBI options.
298 These include C<on_connect_do>, and the sql_maker options
299 C<limit_dialect>, C<quote_char>, and C<name_sep>. Examples:
301 ->connect_info([ 'dbi:SQLite:./foo.db' ]);
303 ->connect_info([ sub { DBI->connect(...) } ]);
311 { quote_char => q{`}, name_sep => q{@} },
317 sub { DBI->connect(...) },
318 { quote_char => q{`}, name_sep => q{@} },
324 Executes the sql statements given as a listref on every db connect.
326 This option can also be set via L</connect_info>.
330 Causes SQL trace information to be emitted on the C<debugobj> object.
331 (or C<STDERR> if C<debugobj> has not specifically been set).
335 Set or retrieve the filehandle used for trace/debug output. This should be
336 an IO::Handle compatible ojbect (only the C<print> method is used. Initially
337 set to be STDERR - although see information on the
338 L<DBIX_CLASS_STORAGE_DBI_DEBUG> environment variable.
345 if ($self->debugobj->can('debugfh')) {
346 return $self->debugobj->debugfh(@_);
352 Sets or retrieves the object used for metric collection. Defaults to an instance
353 of L<DBIx::Class::Storage::Statistics> that is campatible with the original
354 method of using a coderef as a callback. See the aforementioned Statistics
355 class for more information.
359 Sets a callback to be executed each time a statement is run; takes a sub
360 reference. Callback is executed as $sub->($op, $info) where $op is
361 SELECT/INSERT/UPDATE/DELETE and $info is what would normally be printed.
363 See L<debugobj> for a better way.
370 if ($self->debugobj->can('callback')) {
371 return $self->debugobj->callback(@_);
377 Disconnect the L<DBI> handle, performing a rollback first if the
378 database is not in C<AutoCommit> mode.
385 if( $self->connected ) {
386 $self->_dbh->rollback unless $self->_dbh->{AutoCommit};
387 $self->_dbh->disconnect;
394 Check if the L<DBI> handle is connected. Returns true if the handle
399 sub connected { my ($self) = @_;
401 if(my $dbh = $self->_dbh) {
402 if(defined $self->_conn_tid && $self->_conn_tid != threads->tid) {
403 $self->_sql_maker(undef);
404 return $self->_dbh(undef);
406 elsif($self->_conn_pid != $$) {
407 $self->_dbh->{InactiveDestroy} = 1;
408 $self->_sql_maker(undef);
409 return $self->_dbh(undef)
411 return ($dbh->FETCH('Active') && $dbh->ping);
417 =head2 ensure_connected
419 Check whether the database handle is connected - if not then make a
424 sub ensure_connected {
427 unless ($self->connected) {
428 $self->_populate_dbh;
434 Returns the dbh - a data base handle of class L<DBI>.
441 $self->ensure_connected;
445 sub _sql_maker_args {
448 return ( limit_dialect => $self->dbh );
453 Returns a C<sql_maker> object - normally an object of class
454 C<DBIC::SQL::Abstract>.
460 unless ($self->_sql_maker) {
461 $self->_sql_maker(new DBIC::SQL::Abstract( $self->_sql_maker_args ));
463 return $self->_sql_maker;
467 my ($self, $info_arg) = @_;
471 my $info = [ @$info_arg ]; # copy because we can alter it
472 my $last_info = $info->[-1];
473 if(ref $last_info eq 'HASH') {
475 if(my $on_connect_do = $last_info->{on_connect_do}) {
477 $self->on_connect_do($on_connect_do);
479 for my $sql_maker_opt (qw/limit_dialect quote_char name_sep/) {
480 if(my $opt_val = $last_info->{$sql_maker_opt}) {
482 $sql_maker_opts{$sql_maker_opt} = $opt_val;
486 # remove our options hashref if it was there, to avoid confusing
487 # DBI in the case the user didn't use all 4 DBI options, as in:
488 # [ 'dbi:SQLite:foo.db', { quote_char => q{`} } ]
489 pop(@$info) if $used;
492 $self->_connect_info($info);
493 $self->sql_maker->$_($sql_maker_opts{$_}) for(keys %sql_maker_opts);
496 $self->_connect_info;
501 my @info = @{$self->_connect_info || []};
502 $self->_dbh($self->_connect(@info));
504 if(ref $self eq 'DBIx::Class::Storage::DBI') {
505 my $driver = $self->_dbh->{Driver}->{Name};
506 if ($self->load_optional_class("DBIx::Class::Storage::DBI::${driver}")) {
507 bless $self, "DBIx::Class::Storage::DBI::${driver}";
508 $self->_rebless() if $self->can('_rebless');
512 # if on-connect sql statements are given execute them
513 foreach my $sql_statement (@{$self->on_connect_do || []}) {
514 $self->debugobj->query_start($sql_statement) if $self->debug();
515 $self->_dbh->do($sql_statement);
516 $self->debugobj->query_end($sql_statement) if $self->debug();
519 $self->_conn_pid($$);
520 $self->_conn_tid(threads->tid) if $INC{'threads.pm'};
524 my ($self, @info) = @_;
526 $self->throw_exception("You failed to provide any connection info")
529 my ($old_connect_via, $dbh);
531 if ($INC{'Apache/DBI.pm'} && $ENV{MOD_PERL}) {
532 $old_connect_via = $DBI::connect_via;
533 $DBI::connect_via = 'connect';
537 $dbh = ref $info[0] eq 'CODE'
539 : DBI->connect(@info);
542 $DBI::connect_via = $old_connect_via if $old_connect_via;
545 $self->throw_exception("DBI Connection failed: " . ($@ || $DBI::errstr));
553 Calls begin_work on the current dbh.
555 See L<DBIx::Class::Schema> for the txn_do() method, which allows for
556 an entire code block to be executed transactionally.
562 if ($self->{transaction_depth}++ == 0) {
563 my $dbh = $self->dbh;
564 if ($dbh->{AutoCommit}) {
565 $self->debugobj->txn_begin()
574 Issues a commit against the current dbh.
580 my $dbh = $self->dbh;
581 if ($self->{transaction_depth} == 0) {
582 unless ($dbh->{AutoCommit}) {
583 $self->debugobj->txn_commit()
589 if (--$self->{transaction_depth} == 0) {
590 $self->debugobj->txn_commit()
599 Issues a rollback against the current dbh. A nested rollback will
600 throw a L<DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION> exception,
601 which allows the rollback to propagate to the outermost transaction.
609 my $dbh = $self->dbh;
610 if ($self->{transaction_depth} == 0) {
611 unless ($dbh->{AutoCommit}) {
612 $self->debugobj->txn_rollback()
618 if (--$self->{transaction_depth} == 0) {
619 $self->debugobj->txn_rollback()
624 die DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION->new;
631 my $exception_class = "DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION";
632 $error =~ /$exception_class/ and $self->throw_exception($error);
633 $self->{transaction_depth} = 0; # ensure that a failed rollback
634 $self->throw_exception($error); # resets the transaction depth
639 my ($self, $op, $extra_bind, $ident, @args) = @_;
640 my ($sql, @bind) = $self->sql_maker->$op($ident, @args);
641 unshift(@bind, @$extra_bind) if $extra_bind;
643 my @debug_bind = map { defined $_ ? qq{'$_'} : q{'NULL'} } @bind;
644 $self->debugobj->query_start($sql, @debug_bind);
646 my $sth = eval { $self->sth($sql,$op) };
649 $self->throw_exception(
650 'no sth generated via sql (' . ($@ || $self->_dbh->errstr) . "): $sql"
653 @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
657 $rv = eval { $sth->execute(@bind) };
660 $self->throw_exception("Error executing '$sql': ".($@ || $sth->errstr));
663 $self->throw_exception("'$sql' did not generate a statement.");
666 my @debug_bind = map { defined $_ ? qq{`$_'} : q{`NULL'} } @bind;
667 $self->debugobj->query_end($sql, @debug_bind);
669 return (wantarray ? ($rv, $sth, @bind) : $rv);
673 my ($self, $ident, $to_insert) = @_;
674 $self->throw_exception(
675 "Couldn't insert ".join(', ',
676 map "$_ => $to_insert->{$_}", keys %$to_insert
678 ) unless ($self->_execute('insert' => [], $ident, $to_insert));
683 return shift->_execute('update' => [], @_);
687 return shift->_execute('delete' => [], @_);
691 my ($self, $ident, $select, $condition, $attrs) = @_;
692 my $order = $attrs->{order_by};
693 if (ref $condition eq 'SCALAR') {
694 $order = $1 if $$condition =~ s/ORDER BY (.*)$//i;
696 if (exists $attrs->{group_by} || $attrs->{having}) {
698 group_by => $attrs->{group_by},
699 having => $attrs->{having},
700 ($order ? (order_by => $order) : ())
703 my @args = ('select', $attrs->{bind}, $ident, $select, $condition, $order);
704 if ($attrs->{software_limit} ||
705 $self->sql_maker->_default_limit_syntax eq "GenericSubQ") {
706 $attrs->{software_limit} = 1;
708 $self->throw_exception("rows attribute must be positive if present")
709 if (defined($attrs->{rows}) && !($attrs->{rows} > 0));
710 push @args, $attrs->{rows}, $attrs->{offset};
712 return $self->_execute(@args);
717 Handle a SQL select statement.
723 my ($ident, $select, $condition, $attrs) = @_;
724 return $self->cursor->new($self, \@_, $attrs);
729 Performs a select, fetch and return of data - handles a single row
734 # Need to call finish() to work round broken DBDs
738 my ($rv, $sth, @bind) = $self->_select(@_);
739 my @row = $sth->fetchrow_array;
746 Returns a L<DBI> sth (statement handle) for the supplied SQL.
751 my ($self, $sql) = @_;
752 # 3 is the if_active parameter which avoids active sth re-use
753 return $self->dbh->prepare_cached($sql, {}, 3);
756 =head2 columns_info_for
758 Returns database type info for a given table columns.
762 sub columns_info_for {
763 my ($self, $table) = @_;
765 my $dbh = $self->dbh;
767 if ($dbh->can('column_info')) {
769 my $old_raise_err = $dbh->{RaiseError};
770 my $old_print_err = $dbh->{PrintError};
771 $dbh->{RaiseError} = 1;
772 $dbh->{PrintError} = 0;
774 my ($schema,$tab) = $table =~ /^(.+?)\.(.+)$/ ? ($1,$2) : (undef,$table);
775 my $sth = $dbh->column_info( undef,$schema, $tab, '%' );
777 while ( my $info = $sth->fetchrow_hashref() ){
779 $column_info{data_type} = $info->{TYPE_NAME};
780 $column_info{size} = $info->{COLUMN_SIZE};
781 $column_info{is_nullable} = $info->{NULLABLE} ? 1 : 0;
782 $column_info{default_value} = $info->{COLUMN_DEF};
783 my $col_name = $info->{COLUMN_NAME};
784 $col_name =~ s/^\"(.*)\"$/$1/;
786 $result{$col_name} = \%column_info;
789 $dbh->{RaiseError} = $old_raise_err;
790 $dbh->{PrintError} = $old_print_err;
791 return \%result if !$@;
795 my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0");
797 my @columns = @{$sth->{NAME_lc}};
798 for my $i ( 0 .. $#columns ){
800 my $type_num = $sth->{TYPE}->[$i];
802 if(defined $type_num && $dbh->can('type_info')) {
803 my $type_info = $dbh->type_info($type_num);
804 $type_name = $type_info->{TYPE_NAME} if $type_info;
806 $column_info{data_type} = $type_name ? $type_name : $type_num;
807 $column_info{size} = $sth->{PRECISION}->[$i];
808 $column_info{is_nullable} = $sth->{NULLABLE}->[$i] ? 1 : 0;
810 if ($column_info{data_type} =~ m/^(.*?)\((.*?)\)$/) {
811 $column_info{data_type} = $1;
812 $column_info{size} = $2;
815 $result{$columns[$i]} = \%column_info;
821 =head2 last_insert_id
823 Return the row id of the last insert.
828 my ($self, $row) = @_;
830 return $self->dbh->func('last_insert_rowid');
836 Returns the database driver name.
840 sub sqlt_type { shift->dbh->{Driver}->{Name} }
842 =head2 create_ddl_dir (EXPERIMENTAL)
846 =item Arguments: $schema \@databases, $version, $directory, $sqlt_args
850 Creates an SQL file based on the Schema, for each of the specified
851 database types, in the given directory.
853 Note that this feature is currently EXPERIMENTAL and may not work correctly
854 across all databases, or fully handle complex relationships.
860 my ($self, $schema, $databases, $version, $dir, $sqltargs) = @_;
862 if(!$dir || !-d $dir)
864 warn "No directory given, using ./\n";
867 $databases ||= ['MySQL', 'SQLite', 'PostgreSQL'];
868 $databases = [ $databases ] if(ref($databases) ne 'ARRAY');
869 $version ||= $schema->VERSION || '1.x';
871 eval "use SQL::Translator";
872 $self->throw_exception("Can't deploy without SQL::Translator: $@") if $@;
874 my $sqlt = SQL::Translator->new({
878 foreach my $db (@$databases)
881 $sqlt->parser('SQL::Translator::Parser::DBIx::Class');
882 # $sqlt->parser_args({'DBIx::Class' => $schema);
883 $sqlt->data($schema);
884 $sqlt->producer($db);
887 my $filename = $schema->ddl_filename($db, $dir, $version);
890 $self->throw_exception("$filename already exists, skipping $db");
893 open($file, ">$filename")
894 or $self->throw_exception("Can't open $filename for writing ($!)");
895 my $output = $sqlt->translate;
897 # print join(":", keys %{$schema->source_registrations});
898 # print Dumper($sqlt->schema);
901 $self->throw_exception("Failed to translate to $db. (" . $sqlt->error . ")");
910 =head2 deployment_statements
912 Create the statements for L</deploy> and
913 L<DBIx::Class::Schema/deploy>.
917 sub deployment_statements {
918 my ($self, $schema, $type, $version, $dir, $sqltargs) = @_;
919 $type ||= $self->sqlt_type;
920 $version ||= $schema->VERSION || '1.x';
922 eval "use SQL::Translator";
925 eval "use SQL::Translator::Parser::DBIx::Class;";
926 $self->throw_exception($@) if $@;
927 eval "use SQL::Translator::Producer::${type};";
928 $self->throw_exception($@) if $@;
929 my $tr = SQL::Translator->new(%$sqltargs);
930 SQL::Translator::Parser::DBIx::Class::parse( $tr, $schema );
931 return "SQL::Translator::Producer::${type}"->can('produce')->($tr);
934 my $filename = $schema->ddl_filename($type, $dir, $version);
937 # $schema->create_ddl_dir([ $type ], $version, $dir, $sqltargs);
938 $self->throw_exception("No SQL::Translator, and no Schema file found, aborting deploy");
942 open($file, "<$filename")
943 or $self->throw_exception("Can't open $filename ($!)");
947 return join('', @rows);
953 Sends the appropriate statements to create or modify tables to the
954 db. This would normally be called through
955 L<DBIx::Class::Schema/deploy>.
960 my ($self, $schema, $type, $sqltargs) = @_;
961 foreach my $statement ( $self->deployment_statements($schema, $type, undef, undef, $sqltargs) ) {
962 for ( split(";\n", $statement)) {
963 next if($_ =~ /^--/);
965 # next if($_ =~ /^DROP/m);
966 next if($_ =~ /^BEGIN TRANSACTION/m);
967 next if($_ =~ /^COMMIT/m);
968 $self->debugobj->query_begin($_) if $self->debug;
969 $self->dbh->do($_) or warn "SQL was:\n $_";
970 $self->debugobj->query_end($_) if $self->debug;
975 =head2 datetime_parser
977 Returns the datetime parser class
981 sub datetime_parser {
983 return $self->{datetime_parser} ||= $self->build_datetime_parser(@_);
986 =head2 datetime_parser_type
988 Defines (returns) the datetime parser class - currently hardwired to
989 L<DateTime::Format::MySQL>
993 sub datetime_parser_type { "DateTime::Format::MySQL"; }
995 =head2 build_datetime_parser
997 See L</datetime_parser>
1001 sub build_datetime_parser {
1003 my $type = $self->datetime_parser_type(@_);
1005 $self->throw_exception("Couldn't load ${type}: $@") if $@;
1009 sub DESTROY { shift->disconnect }
1015 The module defines a set of methods within the DBIC::SQL::Abstract
1016 namespace. These build on L<SQL::Abstract::Limit> to provide the
1017 SQL query functions.
1019 The following methods are extended:-
1033 Accessor for setting limit dialect. This is useful
1034 for JDBC-bridge among others where the remote SQL-dialect cannot
1035 be determined by the name of the driver alone.
1037 This option can also be set via L</connect_info>.
1041 Specifies what characters to use to quote table and column names. If
1042 you use this you will want to specify L<name_sep> as well.
1044 quote_char expectes either a single character, in which case is it is placed
1045 on either side of the table/column, or an arrayref of length 2 in which case the
1046 table/column name is placed between the elements.
1048 For example under MySQL you'd use C<quote_char('`')>, and user SQL Server you'd
1049 use C<quote_char(qw/[ ]/)>.
1051 This option can also be set via L</connect_info>.
1055 This only needs to be used in conjunction with L<quote_char>, and is used to
1056 specify the charecter that seperates elements (schemas, tables, columns) from
1057 each other. In most cases this is simply a C<.>.
1059 This option can also be set via L</connect_info>.
1063 =head1 ENVIRONMENT VARIABLES
1065 =head2 DBIX_CLASS_STORAGE_DBI_DEBUG
1067 If C<DBIX_CLASS_STORAGE_DBI_DEBUG> is set then SQL trace information
1068 is produced (as when the L<debug> method is set).
1070 If the value is of the form C<1=/path/name> then the trace output is
1071 written to the file C</path/name>.
1073 This environment variable is checked when the storage object is first
1074 created (when you call connect on your schema). So, run-time changes
1075 to this environment variable will not take effect unless you also
1076 re-connect on your schema.
1080 Matt S. Trout <mst@shadowcatsystems.co.uk>
1082 Andy Grundman <andy@hybridized.org>
1086 You may distribute this code under the same terms as Perl itself.