You are here

private function InstapageCmsPluginDBModel::initDebugTable in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginDBModel.php \InstapageCmsPluginDBModel::initDebugTable()

Initiates Instapage plugin's DB structure for debug table.

1 call to InstapageCmsPluginDBModel::initDebugTable()
InstapageCmsPluginDBModel::initPluginTables in core/models/InstapageCmsPluginDBModel.php
Initiates Instapage plugin's DB structure.

File

core/models/InstapageCmsPluginDBModel.php, line 183

Class

InstapageCmsPluginDBModel
Class responsible for communication with DB.

Code

private function initDebugTable() {
  $sql = sprintf('SHOW TABLES LIKE \'%s\'', $this->debugTable);
  $result = $this
    ->getRow($sql);
  if ($result) {
    return true;
  }
  $sql = sprintf('CREATE TABLE IF NOT EXISTS %s(' . 'id MEDIUMINT(9) UNSIGNED NOT NULL AUTO_INCREMENT, ' . 'time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, ' . 'text TEXT NULL, ' . 'caller VARCHAR(255) DEFAULT \'\' NOT NULL, ' . 'name VARCHAR(255) DEFAULT \'\' NOT NULL, ' . 'UNIQUE KEY id (id)) %s', $this->debugTable, $this->charsetCollate);
  $this
    ->query($sql);
}