Merge 'trunk' into 'storage-interbase'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLAHacks.pm
CommitLineData
6f4ddea1 1package # Hide from PAUSE
855c6fd0 2 DBIx::Class::SQLAHacks;
6f4ddea1 3
998373c2 4# This module is a subclass of SQL::Abstract::Limit and includes a number
5# of DBIC-specific workarounds, not yet suitable for inclusion into the
6# SQLA core
7
6f4ddea1 8use base qw/SQL::Abstract::Limit/;
e3764383 9use strict;
10use warnings;
b2b22cd6 11use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
8637bb24 12use Sub::Name();
b2b22cd6 13
14BEGIN {
15 # reinstall the carp()/croak() functions imported into SQL::Abstract
16 # as Carp and Carp::Clan do not like each other much
17 no warnings qw/redefine/;
18 no strict qw/refs/;
19 for my $f (qw/carp croak/) {
329d7385 20
b2b22cd6 21 my $orig = \&{"SQL::Abstract::$f"};
8637bb24 22 *{"SQL::Abstract::$f"} = Sub::Name::subname "SQL::Abstract::$f" =>
23 sub {
24 if (Carp::longmess() =~ /DBIx::Class::SQLAHacks::[\w]+ .+? called \s at/x) {
25 __PACKAGE__->can($f)->(@_);
26 }
27 else {
28 goto $orig;
29 }
30 };
b2b22cd6 31 }
32}
6f4ddea1 33
998373c2 34
35# Tries to determine limit dialect.
36#
6f4ddea1 37sub new {
38 my $self = shift->SUPER::new(@_);
39
40 # This prevents the caching of $dbh in S::A::L, I believe
41 # If limit_dialect is a ref (like a $dbh), go ahead and replace
42 # it with what it resolves to:
43 $self->{limit_dialect} = $self->_find_syntax($self->{limit_dialect})
44 if ref $self->{limit_dialect};
45
46 $self;
47}
48
6f4ddea1 49
6553ac38 50# ANSI standard Limit/Offset implementation. DB2 and MSSQL use this
6f4ddea1 51sub _RowNumberOver {
52 my ($self, $sql, $order, $rows, $offset ) = @_;
53
cb478051 54 # get the select to make the final amount of columns equal the original one
55 my ($select) = $sql =~ /^ \s* SELECT \s+ (.+?) \s+ FROM/ix
56 or croak "Unrecognizable SELECT: $sql";
57
6553ac38 58 # get the order_by only (or make up an order if none exists)
59 my $order_by = $self->_order_by(
84ddb3da 60 (delete $order->{order_by}) || $self->_rno_default_order
6553ac38 61 );
6f4ddea1 62
cb478051 63 # whatever is left of the order_by
6553ac38 64 my $group_having = $self->_order_by($order);
6f4ddea1 65
1f36ab67 66 my $qalias = $self->_quote ($self->{_dbic_rs_attrs}{alias});
67
cb478051 68 $sql = sprintf (<<EOS, $offset + 1, $offset + $rows, );
6f4ddea1 69
cb478051 70SELECT $select FROM (
71 SELECT $qalias.*, ROW_NUMBER() OVER($order_by ) AS rno__row__index FROM (
72 ${sql}${group_having}
73 ) $qalias
74) $qalias WHERE rno__row__index BETWEEN %d AND %d
6553ac38 75
76EOS
77
78 $sql =~ s/\s*\n\s*/ /g; # easier to read in the debugger
6f4ddea1 79 return $sql;
80}
81
84ddb3da 82# some databases are happy with OVER (), some need OVER (ORDER BY (SELECT (1)) )
83sub _rno_default_order {
84 return undef;
85}
86
193590c2 87# Informix specific limit, almost like LIMIT/OFFSET
88sub _SkipFirst {
89 my ($self, $sql, $order, $rows, $offset) = @_;
90
91 $sql =~ s/^ \s* SELECT \s+ //ix
92 or croak "Unrecognizable SELECT: $sql";
93
94 return sprintf ('SELECT %s%s%s%s',
95 $offset
96 ? sprintf ('SKIP %d ', $offset)
97 : ''
98 ,
99 sprintf ('FIRST %d ', $rows),
100 $sql,
101 $self->_order_by ($order),
102 );
103}
104
145b2a3d 105# Firebird specific limit, reverse of _SkipFirst for Informix
106sub _FirstSkip {
107 my ($self, $sql, $order, $rows, $offset) = @_;
108
109 $sql =~ s/^ \s* SELECT \s+ //ix
110 or croak "Unrecognizable SELECT: $sql";
111
112 return sprintf ('SELECT %s%s%s%s',
113 sprintf ('FIRST %d ', $rows),
114 $offset
115 ? sprintf ('SKIP %d ', $offset)
116 : ''
117 ,
118 $sql,
119 $self->_order_by ($order),
120 );
121}
122
6553ac38 123# Crappy Top based Limit/Offset support. Legacy from MSSQL.
15827712 124sub _Top {
125 my ( $self, $sql, $order, $rows, $offset ) = @_;
126
b1e1d073 127 # mangle the input sql so it can be properly aliased in the outer queries
128 $sql =~ s/^ \s* SELECT \s+ (.+?) \s+ (?=FROM)//ix
129 or croak "Unrecognizable SELECT: $sql";
42e5b103 130 my $sql_select = $1;
131 my @sql_select = split (/\s*,\s*/, $sql_select);
132
133 # we can't support subqueries (in fact MSSQL can't) - croak
134 if (@sql_select != @{$self->{_dbic_rs_attrs}{select}}) {
135 croak (sprintf (
136 'SQL SELECT did not parse cleanly - retrieved %d comma separated elements, while '
137 . 'the resultset select attribure contains %d elements: %s',
138 scalar @sql_select,
139 scalar @{$self->{_dbic_rs_attrs}{select}},
140 $sql_select,
141 ));
142 }
b1e1d073 143
42e5b103 144 my $name_sep = $self->name_sep || '.';
ac93965c 145 my $esc_name_sep = "\Q$name_sep\E";
146 my $col_re = qr/ ^ (?: (.+) $esc_name_sep )? ([^$esc_name_sep]+) $ /x;
147
148 my $rs_alias = $self->{_dbic_rs_attrs}{alias};
149 my $quoted_rs_alias = $self->_quote ($rs_alias);
b1e1d073 150
42e5b103 151 # construct the new select lists, rename(alias) some columns if necessary
152 my (@outer_select, @inner_select, %seen_names, %col_aliases, %outer_col_aliases);
b1e1d073 153
42e5b103 154 for (@{$self->{_dbic_rs_attrs}{select}}) {
155 next if ref $_;
156 my ($table, $orig_colname) = ( $_ =~ $col_re );
157 next unless $table;
158 $seen_names{$orig_colname}++;
159 }
b1e1d073 160
42e5b103 161 for my $i (0 .. $#sql_select) {
b1e1d073 162
42e5b103 163 my $colsel_arg = $self->{_dbic_rs_attrs}{select}[$i];
164 my $colsel_sql = $sql_select[$i];
b1e1d073 165
42e5b103 166 # this may or may not work (in case of a scalarref or something)
167 my ($table, $orig_colname) = ( $colsel_arg =~ $col_re );
b1e1d073 168
42e5b103 169 my $quoted_alias;
170 # do not attempt to understand non-scalar selects - alias numerically
171 if (ref $colsel_arg) {
172 $quoted_alias = $self->_quote ('column_' . (@inner_select + 1) );
173 }
174 # column name seen more than once - alias it
ed4cdb4f 175 elsif ($orig_colname &&
176 ($seen_names{$orig_colname} && $seen_names{$orig_colname} > 1) ) {
42e5b103 177 $quoted_alias = $self->_quote ("${table}__${orig_colname}");
178 }
b1e1d073 179
42e5b103 180 # we did rename - make a record and adjust
181 if ($quoted_alias) {
182 # alias inner
183 push @inner_select, "$colsel_sql AS $quoted_alias";
184
185 # push alias to outer
186 push @outer_select, $quoted_alias;
187
188 # Any aliasing accumulated here will be considered
189 # both for inner and outer adjustments of ORDER BY
190 $self->__record_alias (
191 \%col_aliases,
192 $quoted_alias,
193 $colsel_arg,
194 $table ? $orig_colname : undef,
195 );
b1e1d073 196 }
197
42e5b103 198 # otherwise just leave things intact inside, and use the abbreviated one outside
199 # (as we do not have table names anymore)
200 else {
201 push @inner_select, $colsel_sql;
202
203 my $outer_quoted = $self->_quote ($orig_colname); # it was not a duplicate so should just work
204 push @outer_select, $outer_quoted;
205 $self->__record_alias (
206 \%outer_col_aliases,
207 $outer_quoted,
208 $colsel_arg,
209 $table ? $orig_colname : undef,
210 );
211 }
b1e1d073 212 }
213
214 my $outer_select = join (', ', @outer_select );
42e5b103 215 my $inner_select = join (', ', @inner_select );
b1e1d073 216
42e5b103 217 %outer_col_aliases = (%outer_col_aliases, %col_aliases);
b1e1d073 218
219 # deal with order
15827712 220 croak '$order supplied to SQLAHacks limit emulators must be a hash'
221 if (ref $order ne 'HASH');
222
8f6dbee9 223 $order = { %$order }; #copy
224
02d133f0 225 my $req_order = $order->{order_by};
15827712 226
e2db8319 227 # examine normalized version, collapses nesting
228 my $limit_order;
229 if (scalar $self->_order_by_chunks ($req_order)) {
230 $limit_order = $req_order;
231 }
232 else {
e2db8319 233 $limit_order = [ map
234 { join ('', $rs_alias, $name_sep, $_ ) }
235 ( $self->{_dbic_rs_attrs}{_source_handle}->resolve->primary_columns )
236 ];
237 }
1cbd3034 238
42e5b103 239 my ( $order_by_inner, $order_by_outer ) = $self->_order_directions($limit_order);
240 my $order_by_requested = $self->_order_by ($req_order);
15827712 241
64c7c000 242 # generate the rest
e2db8319 243 delete $order->{order_by};
8f6dbee9 244 my $grpby_having = $self->_order_by ($order);
245
64c7c000 246 # short circuit for counts - the ordering complexity is needless
247 if ($self->{_dbic_rs_attrs}{-for_count_only}) {
248 return "SELECT TOP $rows $inner_select $sql $grpby_having $order_by_outer";
249 }
250
42e5b103 251 # we can't really adjust the order_by columns, as introspection is lacking
252 # resort to simple substitution
253 for my $col (keys %outer_col_aliases) {
254 for ($order_by_requested, $order_by_outer) {
255 $_ =~ s/\s+$col\s+/ $outer_col_aliases{$col} /g;
b1e1d073 256 }
257 }
42e5b103 258 for my $col (keys %col_aliases) {
9c1ffdde 259 $order_by_inner =~ s/\s+$col\s+/ $col_aliases{$col} /g;
42e5b103 260 }
15827712 261
15827712 262
42e5b103 263 my $inner_lim = $rows + $offset;
15827712 264
618a0fe3 265 $sql = "SELECT TOP $inner_lim $inner_select $sql $grpby_having $order_by_inner";
42e5b103 266
267 if ($offset) {
268 $sql = <<"SQL";
b1e1d073 269
270 SELECT TOP $rows $outer_select FROM
15827712 271 (
42e5b103 272 $sql
ac93965c 273 ) $quoted_rs_alias
15827712 274 $order_by_outer
b1e1d073 275SQL
276
42e5b103 277 }
15827712 278
42e5b103 279 if ($order_by_requested) {
b1e1d073 280 $sql = <<"SQL";
15827712 281
42e5b103 282 SELECT $outer_select FROM
ac93965c 283 ( $sql ) $quoted_rs_alias
284 $order_by_requested
15827712 285SQL
b1e1d073 286
287 }
288
ac93965c 289 $sql =~ s/\s*\n\s*/ /g; # parsing out multiline statements is harder than a single line
b1e1d073 290 return $sql;
15827712 291}
292
42e5b103 293# action at a distance to shorten Top code above
294sub __record_alias {
295 my ($self, $register, $alias, $fqcol, $col) = @_;
296
297 # record qualified name
298 $register->{$fqcol} = $alias;
299 $register->{$self->_quote($fqcol)} = $alias;
300
301 return unless $col;
302
b6d347e0 303 # record unqualified name, undef (no adjustment) if a duplicate is found
42e5b103 304 if (exists $register->{$col}) {
305 $register->{$col} = undef;
306 }
307 else {
308 $register->{$col} = $alias;
309 }
310
311 $register->{$self->_quote($col)} = $register->{$col};
15827712 312}
313
314
6f4ddea1 315
316# While we're at it, this should make LIMIT queries more efficient,
317# without digging into things too deeply
6f4ddea1 318sub _find_syntax {
319 my ($self, $syntax) = @_;
ac788c46 320 return $self->{_cached_syntax} ||= $self->SUPER::_find_syntax($syntax);
6f4ddea1 321}
322
ec7cfd36 323my $for_syntax = {
324 update => 'FOR UPDATE',
325 shared => 'FOR SHARE',
326};
998373c2 327# Quotes table names, handles "limit" dialects (e.g. where rownum between x and
328# y), supports SELECT ... FOR UPDATE and SELECT ... FOR SHARE.
6f4ddea1 329sub select {
330 my ($self, $table, $fields, $where, $order, @rest) = @_;
1cbd3034 331
332 $self->{"${_}_bind"} = [] for (qw/having from order/);
db56cf3d 333
c2b7c5dc 334 if (not ref($table) or ref($table) eq 'SCALAR') {
6f4ddea1 335 $table = $self->_quote($table);
336 }
c2b7c5dc 337
6f4ddea1 338 local $self->{rownum_hack_count} = 1
339 if (defined $rest[0] && $self->{limit_dialect} eq 'RowNum');
340 @rest = (-1) unless defined $rest[0];
e8fcf76f 341 croak "LIMIT 0 Does Not Compute" if $rest[0] == 0;
6f4ddea1 342 # and anyway, SQL::Abstract::Limit will cause a barf if we don't first
db56cf3d 343 my ($sql, @where_bind) = $self->SUPER::select(
6f4ddea1 344 $table, $self->_recurse_fields($fields), $where, $order, @rest
345 );
ec7cfd36 346 if (my $for = delete $self->{_dbic_rs_attrs}{for}) {
347 $sql .= " $for_syntax->{$for}" if $for_syntax->{$for};
348 }
349
1cbd3034 350 return wantarray ? ($sql, @{$self->{from_bind}}, @where_bind, @{$self->{having_bind}}, @{$self->{order_bind}} ) : $sql;
6f4ddea1 351}
352
998373c2 353# Quotes table names, and handles default inserts
6f4ddea1 354sub insert {
355 my $self = shift;
356 my $table = shift;
c2b7c5dc 357 $table = $self->_quote($table);
7a72e5a5 358
359 # SQLA will emit INSERT INTO $table ( ) VALUES ( )
360 # which is sadly understood only by MySQL. Change default behavior here,
361 # until SQLA2 comes with proper dialect support
362 if (! $_[0] or (ref $_[0] eq 'HASH' and !keys %{$_[0]} ) ) {
363 return "INSERT INTO ${table} DEFAULT VALUES"
364 }
365
6f4ddea1 366 $self->SUPER::insert($table, @_);
367}
368
998373c2 369# Just quotes table names.
6f4ddea1 370sub update {
371 my $self = shift;
372 my $table = shift;
c2b7c5dc 373 $table = $self->_quote($table);
6f4ddea1 374 $self->SUPER::update($table, @_);
375}
376
998373c2 377# Just quotes table names.
6f4ddea1 378sub delete {
379 my $self = shift;
380 my $table = shift;
c2b7c5dc 381 $table = $self->_quote($table);
6f4ddea1 382 $self->SUPER::delete($table, @_);
383}
384
385sub _emulate_limit {
386 my $self = shift;
387 if ($_[3] == -1) {
388 return $_[1].$self->_order_by($_[2]);
389 } else {
390 return $self->SUPER::_emulate_limit(@_);
391 }
392}
393
394sub _recurse_fields {
395 my ($self, $fields, $params) = @_;
396 my $ref = ref $fields;
397 return $self->_quote($fields) unless $ref;
398 return $$fields if $ref eq 'SCALAR';
399
400 if ($ref eq 'ARRAY') {
401 return join(', ', map {
402 $self->_recurse_fields($_)
403 .(exists $self->{rownum_hack_count} && !($params && $params->{no_rownum_hack})
404 ? ' AS col'.$self->{rownum_hack_count}++
405 : '')
406 } @$fields);
83e09b5b 407 }
408 elsif ($ref eq 'HASH') {
409 my %hash = %$fields;
83e09b5b 410
50136dd9 411 my $as = delete $hash{-as}; # if supplied
412
413 my ($func, $args) = each %hash;
414 delete $hash{$func};
415
416 if (lc ($func) eq 'distinct' && ref $args eq 'ARRAY' && @$args > 1) {
417 croak (
418 'The select => { distinct => ... } syntax is not supported for multiple columns.'
419 .' Instead please use { group_by => [ qw/' . (join ' ', @$args) . '/ ] }'
420 .' or { select => [ qw/' . (join ' ', @$args) . '/ ], distinct => 1 }'
83e09b5b 421 );
6f4ddea1 422 }
83e09b5b 423
50136dd9 424 my $select = sprintf ('%s( %s )%s',
425 $self->_sqlcase($func),
426 $self->_recurse_fields($args),
427 $as
0491b597 428 ? sprintf (' %s %s', $self->_sqlcase('as'), $self->_quote ($as) )
50136dd9 429 : ''
430 );
431
83e09b5b 432 # there should be nothing left
433 if (keys %hash) {
434 croak "Malformed select argument - too many keys in hash: " . join (',', keys %$fields );
6f4ddea1 435 }
83e09b5b 436
83e09b5b 437 return $select;
6f4ddea1 438 }
439 # Is the second check absolutely necessary?
440 elsif ( $ref eq 'REF' and ref($$fields) eq 'ARRAY' ) {
db56cf3d 441 return $self->_fold_sqlbind( $fields );
6f4ddea1 442 }
443 else {
e8fcf76f 444 croak($ref . qq{ unexpected in _recurse_fields()})
6f4ddea1 445 }
446}
447
448sub _order_by {
1cbd3034 449 my ($self, $arg) = @_;
15827712 450
1cbd3034 451 if (ref $arg eq 'HASH' and keys %$arg and not grep { $_ =~ /^-(?:desc|asc)/i } keys %$arg ) {
452
453 my $ret = '';
454
83e09b5b 455 if (my $g = $self->_recurse_fields($arg->{group_by}, { no_rownum_hack => 1 }) ) {
456 $ret = $self->_sqlcase(' group by ') . $g;
6f4ddea1 457 }
15827712 458
1cbd3034 459 if (defined $arg->{having}) {
460 my ($frag, @bind) = $self->_recurse_where($arg->{having});
461 push(@{$self->{having_bind}}, @bind);
6f4ddea1 462 $ret .= $self->_sqlcase(' having ').$frag;
463 }
15827712 464
1cbd3034 465 if (defined $arg->{order_by}) {
466 my ($frag, @bind) = $self->SUPER::_order_by($arg->{order_by});
467 push(@{$self->{order_bind}}, @bind);
468 $ret .= $frag;
6f4ddea1 469 }
15827712 470
1cbd3034 471 return $ret;
fde3719a 472 }
1cbd3034 473 else {
474 my ($sql, @bind) = $self->SUPER::_order_by ($arg);
475 push(@{$self->{order_bind}}, @bind);
476 return $sql;
fd4cb60a 477 }
6f4ddea1 478}
479
1cbd3034 480sub _order_directions {
fd4cb60a 481 my ($self, $order) = @_;
15827712 482
1cbd3034 483 # strip bind values - none of the current _order_directions users support them
484 return $self->SUPER::_order_directions( [ map
485 { ref $_ ? $_->[0] : $_ }
486 $self->_order_by_chunks ($order)
487 ]);
fd4cb60a 488}
489
6f4ddea1 490sub _table {
491 my ($self, $from) = @_;
492 if (ref $from eq 'ARRAY') {
493 return $self->_recurse_from(@$from);
494 } elsif (ref $from eq 'HASH') {
495 return $self->_make_as($from);
496 } else {
497 return $from; # would love to quote here but _table ends up getting called
498 # twice during an ->select without a limit clause due to
499 # the way S::A::Limit->select works. should maybe consider
500 # bypassing this and doing S::A::select($self, ...) in
501 # our select method above. meantime, quoting shims have
502 # been added to select/insert/update/delete here
503 }
504}
505
506sub _recurse_from {
507 my ($self, $from, @join) = @_;
508 my @sqlf;
509 push(@sqlf, $self->_make_as($from));
510 foreach my $j (@join) {
511 my ($to, $on) = @$j;
512
aa82ce29 513
6f4ddea1 514 # check whether a join type exists
6f4ddea1 515 my $to_jt = ref($to) eq 'ARRAY' ? $to->[0] : $to;
aa82ce29 516 my $join_type;
517 if (ref($to_jt) eq 'HASH' and defined($to_jt->{-join_type})) {
518 $join_type = $to_jt->{-join_type};
519 $join_type =~ s/^\s+ | \s+$//xg;
6f4ddea1 520 }
aa82ce29 521
de5f71ef 522 $join_type = $self->{_default_jointype} if not defined $join_type;
aa82ce29 523
524 my $join_clause = sprintf ('%s JOIN ',
525 $join_type ? ' ' . uc($join_type) : ''
526 );
527 push @sqlf, $join_clause;
6f4ddea1 528
529 if (ref $to eq 'ARRAY') {
530 push(@sqlf, '(', $self->_recurse_from(@$to), ')');
531 } else {
532 push(@sqlf, $self->_make_as($to));
533 }
534 push(@sqlf, ' ON ', $self->_join_condition($on));
535 }
536 return join('', @sqlf);
537}
538
db56cf3d 539sub _fold_sqlbind {
540 my ($self, $sqlbind) = @_;
69989ea9 541
542 my @sqlbind = @$$sqlbind; # copy
543 my $sql = shift @sqlbind;
544 push @{$self->{from_bind}}, @sqlbind;
545
db56cf3d 546 return $sql;
6f4ddea1 547}
548
549sub _make_as {
550 my ($self, $from) = @_;
db56cf3d 551 return join(' ', map { (ref $_ eq 'SCALAR' ? $$_
552 : ref $_ eq 'REF' ? $self->_fold_sqlbind($_)
553 : $self->_quote($_))
6f4ddea1 554 } reverse each %{$self->_skip_options($from)});
555}
556
557sub _skip_options {
558 my ($self, $hash) = @_;
559 my $clean_hash = {};
560 $clean_hash->{$_} = $hash->{$_}
561 for grep {!/^-/} keys %$hash;
562 return $clean_hash;
563}
564
565sub _join_condition {
566 my ($self, $cond) = @_;
567 if (ref $cond eq 'HASH') {
568 my %j;
569 for (keys %$cond) {
570 my $v = $cond->{$_};
571 if (ref $v) {
e8fcf76f 572 croak (ref($v) . qq{ reference arguments are not supported in JOINS - try using \"..." instead'})
6f4ddea1 573 if ref($v) ne 'SCALAR';
574 $j{$_} = $v;
575 }
576 else {
577 my $x = '= '.$self->_quote($v); $j{$_} = \$x;
578 }
579 };
580 return scalar($self->_recurse_where(\%j));
581 } elsif (ref $cond eq 'ARRAY') {
582 return join(' OR ', map { $self->_join_condition($_) } @$cond);
583 } else {
584 die "Can't handle this yet!";
585 }
586}
587
588sub _quote {
589 my ($self, $label) = @_;
590 return '' unless defined $label;
c2b7c5dc 591 return $$label if ref($label) eq 'SCALAR';
6f4ddea1 592 return "*" if $label eq '*';
593 return $label unless $self->{quote_char};
594 if(ref $self->{quote_char} eq "ARRAY"){
595 return $self->{quote_char}->[0] . $label . $self->{quote_char}->[1]
596 if !defined $self->{name_sep};
597 my $sep = $self->{name_sep};
598 return join($self->{name_sep},
599 map { $self->{quote_char}->[0] . $_ . $self->{quote_char}->[1] }
600 split(/\Q$sep\E/,$label));
601 }
602 return $self->SUPER::_quote($label);
603}
604
605sub limit_dialect {
606 my $self = shift;
607 $self->{limit_dialect} = shift if @_;
608 return $self->{limit_dialect};
609}
610
998373c2 611# Set to an array-ref to specify separate left and right quotes for table names.
612# A single scalar is equivalen to [ $char, $char ]
6f4ddea1 613sub quote_char {
614 my $self = shift;
615 $self->{quote_char} = shift if @_;
616 return $self->{quote_char};
617}
618
998373c2 619# Character separating quoted table names.
6f4ddea1 620sub name_sep {
621 my $self = shift;
622 $self->{name_sep} = shift if @_;
623 return $self->{name_sep};
624}
625
6261;