[Bast-commits] r6851 - in DBIx-Class/0.08/branches/table_name_ref:
lib/DBIx/Class/SQLAHacks t t/lib/DBICTest t/lib/DBICTest/Schema
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon Jun 29 20:56:46 GMT 2009
Author: caelum
Date: 2009-06-29 20:56:45 +0000 (Mon, 29 Jun 2009)
New Revision: 6851
Removed:
DBIx-Class/0.08/branches/table_name_ref/t/19table_name_ref.t
DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CDTableRef.pm
Modified:
DBIx-Class/0.08/branches/table_name_ref/lib/DBIx/Class/SQLAHacks/MySQL.pm
DBIx-Class/0.08/branches/table_name_ref/t/19quotes.t
DBIx-Class/0.08/branches/table_name_ref/t/19quotes_newstyle.t
DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema.pm
DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CD.pm
Log:
changed CD to ->table(\"cd")
Modified: DBIx-Class/0.08/branches/table_name_ref/lib/DBIx/Class/SQLAHacks/MySQL.pm
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/lib/DBIx/Class/SQLAHacks/MySQL.pm 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/lib/DBIx/Class/SQLAHacks/MySQL.pm 2009-06-29 20:56:45 UTC (rev 6851)
@@ -12,7 +12,7 @@
my $self = shift;
my $table = $_[0];
- $table = $self->_quote($table) unless ref($table);
+ $table = $self->_quote($table);
if (! $_[1] or (ref $_[1] eq 'HASH' and !keys %{$_[1]} ) ) {
return "INSERT INTO ${table} () VALUES ()"
Modified: DBIx-Class/0.08/branches/table_name_ref/t/19quotes.t
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/t/19quotes.t 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/t/19quotes.t 2009-06-29 20:56:45 UTC (rev 6851)
@@ -36,7 +36,7 @@
eval { $rs->count };
is_same_sql_bind(
$sql, \@bind,
- "SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ "SELECT COUNT( * ) FROM cd `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with quoting'
);
@@ -60,7 +60,7 @@
eval { $rs->count };
is_same_sql_bind(
$sql, \@bind,
- "SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ "SELECT COUNT( * ) FROM cd [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with bracket quoting'
);
Modified: DBIx-Class/0.08/branches/table_name_ref/t/19quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/t/19quotes_newstyle.t 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/t/19quotes_newstyle.t 2009-06-29 20:56:45 UTC (rev 6851)
@@ -42,7 +42,7 @@
eval { $rs->count };
is_same_sql_bind(
$sql, \@bind,
- "SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ "SELECT COUNT( * ) FROM cd `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with quoting'
);
@@ -73,7 +73,7 @@
eval { $rs->count };
is_same_sql_bind(
$sql, \@bind,
- "SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ "SELECT COUNT( * ) FROM cd [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with bracket quoting'
);
Deleted: DBIx-Class/0.08/branches/table_name_ref/t/19table_name_ref.t
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/t/19table_name_ref.t 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/t/19table_name_ref.t 2009-06-29 20:56:45 UTC (rev 6851)
@@ -1,45 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use IO::File;
-
-use lib qw(t/lib);
-use DBICTest;
-use DBIC::SqlMakerTest;
-use DBIC::DebugObj;
-
-plan tests => 2;
-
-my $schema = DBICTest->init_schema();
-
-$schema->storage->sql_maker->quote_char('`');
-$schema->storage->sql_maker->name_sep('.');
-
-my ($sql, @bind);
-$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)),
-$schema->storage->debug(1);
-
-my $rs;
-
-# ->table(\'cd') should NOT be quoted
-$rs = $schema->resultset('CDTableRef')->search(
- { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
- { join => 'artist' });
-eval { $rs->count };
-is_same_sql_bind(
- $sql, \@bind,
- "SELECT COUNT( * ) FROM cd `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
- 'got correct SQL for count query with quoting'
-);
-
-# check that the table works
-eval {
- $rs = $schema->resultset('CDTableRef');
- $rs->create({ cdid => 6, artist => 3, title => 'mtfnpy', year => 2009 });
- my $row = $rs->find(6);
- $row->update({ title => 'bleh' });
- $row->delete;
-};
-ok !$@, 'operations on scalarref table name work';
-diag $@ if $@;
Modified: DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CD.pm
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CD.pm 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CD.pm 2009-06-29 20:56:45 UTC (rev 6851)
@@ -3,7 +3,10 @@
use base qw/DBICTest::BaseResult/;
-__PACKAGE__->table('cd');
+# this tests table name as scalar ref
+# DO NOT REMOVE THE \
+__PACKAGE__->table(\'cd');
+
__PACKAGE__->add_columns(
'cdid' => {
data_type => 'integer',
Deleted: DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CDTableRef.pm
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CDTableRef.pm 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema/CDTableRef.pm 2009-06-29 20:56:45 UTC (rev 6851)
@@ -1,45 +0,0 @@
-package # hide from PAUSE
- DBICTest::Schema::CDTableRef;
-
-use base qw/DBICTest::BaseResult/;
-use DBIx::Class::ResultSource::View;
-
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
-__PACKAGE__->table(\'cd');
-__PACKAGE__->result_source_instance->is_virtual(0);
-
-__PACKAGE__->add_columns(
- 'cdid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'artist' => {
- data_type => 'integer',
- },
- 'title' => {
- data_type => 'varchar',
- size => 100,
- },
- 'year' => {
- data_type => 'varchar',
- size => 100,
- },
- 'genreid' => {
- data_type => 'integer',
- is_nullable => 1,
- },
- 'single_track' => {
- data_type => 'integer',
- is_nullable => 1,
- is_foreign_key => 1,
- }
-);
-__PACKAGE__->set_primary_key('cdid');
-__PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
-
-__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist',
- 'artist', {
- is_deferrable => 1,
-});
-
-1;
Modified: DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema.pm 2009-06-29 20:21:24 UTC (rev 6850)
+++ DBIx-Class/0.08/branches/table_name_ref/t/lib/DBICTest/Schema.pm 2009-06-29 20:56:45 UTC (rev 6851)
@@ -11,7 +11,6 @@
BindType
Employee
CD
- CDTableRef
FileColumn
Genre
Link
More information about the Bast-commits
mailing list