From: Peter Rabbitson Date: Sun, 8 Aug 2010 11:31:36 +0000 (+0200) Subject: Fix Verisoned.pm to not issue queries that break down with quoting X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c271eec382194b5c1b50931ef07c652e7ea653d2;p=dbsrgits%2FDBIx-Class-Historic.git Fix Verisoned.pm to not issue queries that break down with quoting enabled. Also simplify table-test SQL. (RT#59619) --- diff --git a/Changes b/Changes index d33253b..ad96f1c 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,8 @@ Revision history for DBIx::Class column in the GROUP BY clause - Properly support column names with symbols (e.g. single quote) via custom accessors + - Fixed ::Schema::Versioned to work properly with quoting on + (RT#59619) * Misc - Refactored capability handling in Storage::DBI, allows for diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index 052f8e7..5a861ba 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -725,9 +725,12 @@ sub _source_exists { my ($self, $rs) = @_; - my $c = try { $rs->search({ 1, 0 })->count }; - - return (defined $c) ? 1 : 0; + return try { + $rs->search(\'1=0')->cursor->next; + 1; + } catch { + 0; + }; } 1;