Merge lp:~kalebral-deactivatedaccount/randgen/update-drizzle-queries into lp:randgen

Proposed by Lee Bieber
Status: Merged
Merge reported by: Patrick Crews
Merged at revision: not available
Proposed branch: lp:~kalebral-deactivatedaccount/randgen/update-drizzle-queries
Merge into: lp:randgen
Diff against target: 60 lines (+31/-5)
1 file modified
lib/GenTest/Executor/Drizzle.pm (+31/-5)
To merge this branch: bzr merge lp:~kalebral-deactivatedaccount/randgen/update-drizzle-queries
Reviewer Review Type Date Requested Status
Random Query Generator Team Pending
Review via email: mp+20609@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

check drizzle version before executing queries to use the correct query string as things have changed in drizzle recently

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/GenTest/Executor/Drizzle.pm'
--- lib/GenTest/Executor/Drizzle.pm 2010-02-10 12:47:45 +0000
+++ lib/GenTest/Executor/Drizzle.pm 2010-03-04 01:45:24 +0000
@@ -556,8 +556,11 @@
556 ## 4. Column name556 ## 4. Column name
557 ## 5. PRIMARY for primary key, INDEXED for indexed column and "ORDINARY" for all other columns557 ## 5. PRIMARY for primary key, INDEXED for indexed column and "ORDINARY" for all other columns
558 my ($self) = @_;558 my ($self) = @_;
559 my $query = 559 my $query;
560 "SELECT table_schema, ".560 my $version = $self->dbh()->selectrow_array("SELECT VERSION()");
561 # as of build 1320 we start using data_dictionary instead of information_schema
562 if ($version lt "2010.03.1320") {
563 $query = "SELECT table_schema, ".
561 "table_name, ".564 "table_name, ".
562 "CASE WHEN table_type = 'BASE TABLE' THEN 'table' ".565 "CASE WHEN table_type = 'BASE TABLE' THEN 'table' ".
563 "WHEN table_type = 'VIEW' THEN 'view' ".566 "WHEN table_type = 'VIEW' THEN 'view' ".
@@ -569,7 +572,21 @@
569 "WHEN column_key = 'UNI' THEN 'indexed' ".572 "WHEN column_key = 'UNI' THEN 'indexed' ".
570 "ELSE 'ordinary' END ".573 "ELSE 'ordinary' END ".
571 "FROM information_schema.tables INNER JOIN ".574 "FROM information_schema.tables INNER JOIN ".
572 "information_schema.columns USING(table_schema, table_name)"; 575 "information_schema.columns USING(table_schema, table_name)";
576 }
577 else {
578 $query = "SELECT table_schema, ".
579 "table_name, ".
580 "CASE WHEN table_type = 'STANDARD' THEN 'table' ".
581 "WHEN table_type = 'FUNCTION' THEN 'function' ".
582 "ELSE 'misc' END, ".
583 "column_name, ".
584 "CASE WHEN IS_USED_IN_PRIMARY = 'TRUE' THEN 'primary' ".
585 "WHEN IS_INDEXED = 'TRUE' THEN 'indexed' ".
586 "ELSE 'ordinary' END ".
587 "FROM data_dictionary.tables INNER JOIN ".
588 "data_dictionary.columns USING(table_schema, table_name)";
589 }
573590
574 return $self->dbh()->selectall_arrayref($query);591 return $self->dbh()->selectall_arrayref($query);
575}592}
@@ -579,8 +596,17 @@
579 ## 1. Collation name596 ## 1. Collation name
580 ## 2. Character set597 ## 2. Character set
581 my ($self) = @_;598 my ($self) = @_;
582 my $query = 599 my $query;
583 "SELECT collation_name,character_set_name FROM information_schema.collations";600 my $version = $self->dbh()->selectrow_array("SELECT VERSION()");
601 # as of build 1320 we start using data_dictionary instead of information_schema
602 if ($version lt "2010.03.1320") {
603 $query =
604 "SELECT collation_name,character_set_name FROM information_schema.collations";
605 }
606 else {
607 $query =
608 "SELECT collation_name,character_set_name FROM data_dictionary.collations";
609 }
584610
585 return $self->dbh()->selectall_arrayref($query);611 return $self->dbh()->selectall_arrayref($query);
586}612}