I got the following error when trying to install da.
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'domain_taxonomy_source' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {domain_taxonomy_source} domain_taxonomy_source WHERE (domain_id = :db_condition_placeholder_0) ) subquery; Array ( [:db_condition_placeholder_0] => 0 ) in domain_test_schema() (line 3614 of sites\all\modules\domain\domain.module).
I think that this is due to the fact that I have the strict mysql error levels assigned. Whatever the cause, a try catch prevented the error and I managed to install the module.
function domain_test_schema($schema = array()) {
$tables = array();
foreach ($schema as $name => $table) {
if (isset($table['fields']['domain_id']['type']) && $table['fields']['domain_id']['type'] == 'int') {
try {
$query = db_select($name)
->condition('domain_id', 0);
$check = $query->countQuery()->execute()->fetchField();
if ($check) {
$tables[] = $name;
}
}
catch(Exception $e) {}
}
}
return $tables;
}
Comment | File | Size | Author |
---|---|---|---|
#8 | 1410018-pdo.patch | 2.91 KB | agentrickard |
#6 | 1410018-pdo.patch | 1.28 KB | agentrickard |
#5 | 1407606-faulty-install-7-x-2.patch | 790 bytes | agentrickard |
Comments
Comment #1
agentrickardI'm interested to know where this table definition comes from domain_taxonomy_source.
That's not part of the module package, and, obviously, that table should not be present if it is provided by a module that depends on Domain Access.
The try/catch model is probably more correct, but I'd like to be able to replicate the error first. We should also write a test for it.
Comment #2
agentrickardOh, I see. I bet you downloaded a module before install, right? domain_update_module_check() will try to load uninstalled modules, because this can happen as part of a D6 => D7 upgrade.
Comment #3
Alan D. CreditAttribution: Alan D. commentedWell the check for the table throws an error, so the test is flawed. (IE: You get a PDO exception if the query runs without the existence of the table, you get a PDO exception if you test prior to the query)
The steps to replicate are probably impossible to replicate, I had a timeout during the installation, at 60 sec, so hit refresh to resubmit the page.
Enable DA
Enable 5 or so DA contribute modules
- had timeout on first attempt, increased this to 240 sec
- PDO Exception on second, added fix
- third refresh of the form submit worked
I guess if you just need to know that the table exists, it would be better to use db_table_exists($table). Then no try catch would be required.
For testing, just pass in a valid and invalid table schema :)
Comment #4
agentrickardFair enough, since db_table_exists() requires an active connection.
Comment #5
agentrickardI never could replicate this, but here's a patch to be safe.
Comment #6
agentrickardWrong patch.
Comment #7
agentrickardNot yet committed. We have an existing test we can extend here.
Comment #8
agentrickardAnd a patch with nice tests.