From: Rafael Kitover Date: Tue, 7 Dec 2010 23:47:54 +0000 (-0500) Subject: merge and improve _is_lob_type from Sybase::ASE into Storage::DBI X-Git-Tag: v0.08125~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=153a03985a7f299a10f70dbfba9c628579cd9db6;p=dbsrgits%2FDBIx-Class.git merge and improve _is_lob_type from Sybase::ASE into Storage::DBI --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 494161d..d86a763 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -2822,11 +2822,7 @@ sub _max_column_bytesize { $max_size = $inf->{size} * 4 if $inf->{size}; } # Blob types - elsif ($data_type =~ /(?:blob|clob|bfile|text|image|bytea)/ - || $data_type =~ /^long(?:\s*(?:raw|bit\s*varying|varbit|binary - |varchar|character\s*varying|nvarchar - |national\s*character\s*varying))?$/ - ) { + elsif ($self->_is_lob_type($data_type)) { # default to longreadlen } else { @@ -2838,6 +2834,15 @@ sub _max_column_bytesize { }; } +# Determine if a data_type is some type of BLOB +sub _is_lob_type { + my ($self, $data_type) = @_; + $data_type && ($data_type =~ /(?:lob|bfile|text|image|bytea|memo)/i + || $data_type =~ /^long(?:\s*(?:raw|bit\s*varying|varbit|binary + |varchar|character\s*varying|nvarchar + |national\s*character\s*varying))?$/xi); +} + 1; =head1 USAGE NOTES diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index 04b94f2..7857f08 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -380,6 +380,7 @@ my @unimplemented = qw( _prefetch_autovalues _extract_order_criteria _max_column_bytesize + _is_lob_type ); # the capability framework diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm index c90af2f..b5f4818 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm @@ -233,12 +233,6 @@ sub connect_call_blob_setup { if exists $args{log_on_update}; } -sub _is_lob_type { - my $self = shift; - my $type = shift; - $type && $type =~ /(?:text|image|lob|bytea|binary|memo)/i; -} - sub _is_lob_column { my ($self, $source, $column) = @_;