query('SELECT 1 FROM `' . $m[1] . '` LIMIT 1'); if ($check !== false && $check->num_rows > 0) { $skipped++; continue; } } } if (@$link->query($statement)) { $created++; } else { $errors[] = $link->error . "\n in: " . substr((string)preg_replace('/\s+/', ' ', $statement), 0, 90); } } // Record the version, which the schema's own INSERT may have skipped. @$link->query("UPDATE `znote` SET `version` = '2.0.1'"); $tablesNow = 0; $result = @$link->query("SHOW TABLES LIKE 'znote%'"); if ($result !== false) { $tablesNow = $result->num_rows; } $link->close(); $report = array( 'created' => $created, 'skipped' => $skipped, 'errors' => $errors, 'tables' => $tablesNow, ); if (!$errors) { install_state(array('schema_done' => true)); install_max_step(5); } else { install_error(count($errors) . ' statement(s) failed. The first was: ' . ih((string)$errors[0])); } } } ?>
Creates the znote_* tables in
= ih(install_get('sqlDatabase')) ?>. Your server's own tables are not touched.
CREATE TABLE IF NOT EXISTS, and seed rows are skipped for
tables that already hold data — running this on a database that already has some
ZnoteX tables adds only what is missing.
Done. = (int)$report['created'] ?> statement= $report['created'] === 1 ? '' : 's' ?> ran,
= (int)$report['skipped'] ?> skipped as already populated.
= (int)$report['tables'] ?> znote_* tables are now present.
= count($report['errors']) ?> statement(s) failed: