Showing 3 changed files with 25 additions and 25 deletions
+4 -4
lib/DBIx/Custom.pm 1000644 → 1000755
... ...
@@ -417,16 +417,16 @@ sub create_table {
417 417
     my ($self, $table, @column_definitions) = @_;
418 418
     
419 419
     # Create table
420
-    my $sql = "create table $table (\n";
420
+    my $sql = "create table $table (";
421 421
     
422 422
     # Column definitions
423 423
     foreach my $column_definition (@column_definitions) {
424
-        $sql .= "\t$column_definition,\n";
424
+        $sql .= "$column_definition,";
425 425
     }
426
-    $sql =~ s/,\n$//;
426
+    $sql =~ s/,$//;
427 427
     
428 428
     # End
429
-    $sql .= "\n);";
429
+    $sql .= ");";
430 430
     
431 431
     # Do query
432 432
     return $self->do($sql);
+13 -13
lib/DBIx/Custom/Result.pm 1000644 → 1000755
... ...
@@ -97,7 +97,7 @@ sub fetch_hash {
97 97
     return wantarray ? %$row_hash : $row_hash;
98 98
 }
99 99
 
100
-sub fetch_first {
100
+sub fetch_single {
101 101
     my $self = shift;
102 102
     
103 103
     # Fetch
... ...
@@ -112,7 +112,7 @@ sub fetch_first {
112 112
     return wantarray ? @$row : $row;
113 113
 }
114 114
 
115
-sub fetch_hash_first {
115
+sub fetch_hash_single {
116 116
     my $self = shift;
117 117
     
118 118
     # Fetch hash
... ...
@@ -274,31 +274,31 @@ The following is fetch_hash sample
274 274
         my $val2 = $row->{key2};
275 275
     }
276 276
 
277
-=head2 fetch_first
277
+=head2 fetch_single
278 278
 
279 279
 Fetch only first row(Scalar context)
280 280
 
281
-    $row = $result->fetch_first; # array reference
282
-    @row = $result->fetch_first; # array
281
+    $row = $result->fetch_single; # array reference
282
+    @row = $result->fetch_single; # array
283 283
     
284
-The following is fetch_first sample
284
+The following is fetch_single sample
285 285
 
286
-    $row = $result->fetch_first;
286
+    $row = $result->fetch_single;
287 287
     
288 288
 This method fetch only first row and finish statement handle
289 289
 
290
-=head2 fetch_hash_first
290
+=head2 fetch_hash_single
291 291
     
292 292
 Fetch only first row as hash
293 293
 
294
-    $row = $result->fetch_hash_first; # hash reference
295
-    %row = $result->fetch_hash_first; # hash
294
+    $row = $result->fetch_hash_single; # hash reference
295
+    %row = $result->fetch_hash_single; # hash
296 296
     
297
-The following is fetch_hash_first sample
297
+The following is fetch_hash_single sample
298 298
 
299
-    $row = $result->fetch_hash_first;
299
+    $row = $result->fetch_hash_single;
300 300
     
301
-This method fetch only first row and finish statement handle
301
+This method fetch only single row and finish statement handle
302 302
 
303 303
 =head2 fetch_rows
304 304
 
+8 -8
t/dbix-custom-result-sqlite.t 1000644 → 1000755
... ...
@@ -79,33 +79,33 @@ while (my %row = $result->fetch_hash) {
79 79
 is_deeply(\@rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], $test);
80 80
 
81 81
 
82
-test 'fetch_first';
82
+test 'fetch_single';
83 83
 $result = query($dbh, $sql);
84
-$row = $result->fetch_first;
84
+$row = $result->fetch_single;
85 85
 is_deeply($row, [1, 2], "$test : row");
86 86
 $row = $result->fetch;
87 87
 ok(!$row, "$test : finished");
88 88
 
89 89
 
90
-test 'fetch_first list context';
90
+test 'fetch_single list context';
91 91
 $result = query($dbh, $sql);
92
-@row = $result->fetch_first;
92
+@row = $result->fetch_single;
93 93
 is_deeply([@row], [1, 2], "$test : row");
94 94
 @row = $result->fetch;
95 95
 ok(!@row, "$test : finished");
96 96
 
97 97
 
98
-test 'fetch_hash_first';
98
+test 'fetch_hash_single';
99 99
 $result = query($dbh, $sql);
100
-$row = $result->fetch_hash_first;
100
+$row = $result->fetch_hash_single;
101 101
 is_deeply($row, {key1 => 1, key2 => 2}, "$test : row");
102 102
 $row = $result->fetch_hash;
103 103
 ok(!$row, "$test : finished");
104 104
 
105 105
 
106
-test 'fetch_hash_first list context';
106
+test 'fetch_hash_single list context';
107 107
 $result = query($dbh, $sql);
108
-@row = $result->fetch_hash_first;
108
+@row = $result->fetch_hash_single;
109 109
 is_deeply({@row}, {key1 => 1, key2 => 2}, "$test : row");
110 110
 @row = $result->fetch_hash;
111 111
 ok(!@row, "$test : finished");