Massive rewrite of bind handling, and overall simplification of ::Storage::DBI
[dbsrgits/DBIx-Class.git] / t / sqlmaker / limit_dialects / generic_subq.t
index 8bd47b7..8907808 100644 (file)
@@ -37,7 +37,8 @@ is_same_sql_bind(
       ) < 2
     ORDER BY me.title
   )',
-  [  [ 'source', 'Library' ] ],
+  [ [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' }
+    => 'Library' ] ],
 );
 
 is_deeply (
@@ -78,7 +79,8 @@ is_same_sql_bind(
       ) BETWEEN 1 AND 3
     ORDER BY "title" DESC
   )',
-  [ [ 'source', 'Library' ] ],
+  [ [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' }
+    => 'Library' ] ],
 );
 
 is_deeply (
@@ -113,7 +115,8 @@ is_same_sql_bind(
       ) BETWEEN 1 AND 4294967295
     ORDER BY "title"
   )',
-  [ [ 'source', 'Library' ] ],
+  [ [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' }
+    => 'Library' ] ],
 );
 
 is_deeply (
@@ -122,4 +125,19 @@ is_deeply (
   'Correct columns selected with rows',
 );
 
+{
+  $rs = $schema->resultset('Artist')->search({}, {
+    columns => 'name',
+    offset => 1,
+    order_by => 'name',
+  });
+  local $rs->result_source->{name} = "weird \n newline/multi \t \t space containing \n table";
+
+  like (
+    ${$rs->as_query}->[0],
+    qr| weird \s \n \s newline/multi \s \t \s \t \s space \s containing \s \n \s table|x,
+    'Newlines/spaces preserved in final sql',
+  );
+}
+
 done_testing;