merge and improve _is_lob_type from Sybase::ASE into Storage::DBI
Rafael Kitover [Tue, 7 Dec 2010 23:47:54 +0000 (18:47 -0500)]
lib/DBIx/Class/Storage/DBI.pm
lib/DBIx/Class/Storage/DBI/Replicated.pm
lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm

index 494161d..d86a763 100644 (file)
@@ -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
index 04b94f2..7857f08 100644 (file)
@@ -380,6 +380,7 @@ my @unimplemented = qw(
   _prefetch_autovalues
   _extract_order_criteria
   _max_column_bytesize
+  _is_lob_type
 );
 
 # the capability framework
index c90af2f..b5f4818 100644 (file)
@@ -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) = @_;