original_string: public function createTable()
      {
          // connect if we are not yet
          $conn = $this->getConnection();
  
          if ($conn instanceof Connection) {
              $types = [
                  'mysql' => 'binary',
                  'sqlite' => 'text',
                  'pgsql' => 'string',
                  'oci' => 'string',
                  'sqlsrv' => 'string',
              ];
              if (!isset($types[$this->driver])) {
                  throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
              }
  
              $schema = new Schema();
              $table = $schema->createTable($this->table);
              $table->addColumn($this->idCol, $types[$this->driver], ['length' => 255]);
              $table->addColumn($this->dataCol, 'blob', ['length' => 16777215]);
              $table->addColumn($this->lifetimeCol, 'integer', ['unsigned' => true, 'notnull' => false]);
              $table->addColumn($this->timeCol, 'integer', ['unsigned' => true]);
              $table->setPrimaryKey([$this->idCol]);
  
              foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
                  $conn->exec($sql);
              }
  
              return;
          }
  
          switch ($this->driver) {
              case 'mysql':
                  // We use varbinary for the ID column because it prevents unwanted conversions:
                  // - character set conversions between server and client
                  // - trailing space removal
                  // - case-insensitivity
                  // - language processing like é == e
                  $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
                  break;
              case 'sqlite':
                  $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              case 'pgsql':
                  $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              case 'oci':
                  $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(255) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              case 'sqlsrv':
                  $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              default:
                  throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
          }
  
          $conn->exec($sql);
      }
code: public function createTable()
      {
          // connect if we are not yet
          $conn = $this->getConnection();
  
          if ($conn instanceof Connection) {
              $types = [
                  'mysql' => 'binary',
                  'sqlite' => 'text',
                  'pgsql' => 'string',
                  'oci' => 'string',
                  'sqlsrv' => 'string',
              ];
              if (!isset($types[$this->driver])) {
                  throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
              }
  
              $schema = new Schema();
              $table = $schema->createTable($this->table);
              $table->addColumn($this->idCol, $types[$this->driver], ['length' => 255]);
              $table->addColumn($this->dataCol, 'blob', ['length' => 16777215]);
              $table->addColumn($this->lifetimeCol, 'integer', ['unsigned' => true, 'notnull' => false]);
              $table->addColumn($this->timeCol, 'integer', ['unsigned' => true]);
              $table->setPrimaryKey([$this->idCol]);
  
              foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
                  $conn->exec($sql);
              }
  
              return;
          }
  
          switch ($this->driver) {
              case 'mysql':
                  // We use varbinary for the ID column because it prevents unwanted conversions:
                  // - character set conversions between server and client
                  // - trailing space removal
                  // - case-insensitivity
                  // - language processing like é == e
                  $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
                  break;
              case 'sqlite':
                  $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              case 'pgsql':
                  $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              case 'oci':
                  $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(255) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              case 'sqlsrv':
                  $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)";
                  break;
              default:
                  throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
          }
  
          $conn->exec($sql);
      }
code_tokens: public function createTable ( ) { // connect if we are not yet $ conn = $ this -> getConnection ( ) ; if ( $ conn instanceof Connection ) { $ types = [ 'mysql' => 'binary' , 'sqlite' => 'text' , 'pgsql' => 'string' , 'oci' => 'string' , 'sqlsrv' => 'string' , ] ; if ( ! isset ( $ types [ $ this -> driver ] ) ) { throw new \ DomainException ( sprintf ( 'Creating the cache table is currently not implemented for PDO driver "%s".' , $ this -> driver ) ) ; } $ schema = new Schema ( ) ; $ table = $ schema -> createTable ( $ this -> table ) ; $ table -> addColumn ( $ this -> idCol , $ types [ $ this -> driver ] , [ 'length' => 255 ] ) ; $ table -> addColumn ( $ this -> dataCol , 'blob' , [ 'length' => 16777215 ] ) ; $ table -> addColumn ( $ this -> lifetimeCol , 'integer' , [ 'unsigned' => true , 'notnull' => false ] ) ; $ table -> addColumn ( $ this -> timeCol , 'integer' , [ 'unsigned' => true ] ) ; $ table -> setPrimaryKey ( [ $ this -> idCol ] ) ; foreach ( $ schema -> toSql ( $ conn -> getDatabasePlatform ( ) ) as $ sql ) { $ conn -> exec ( $ sql ) ; } return ; } switch ( $ this -> driver ) { case 'mysql' : // We use varbinary for the ID column because it prevents unwanted conversions: // - character set conversions between server and client // - trailing space removal // - case-insensitivity // - language processing like é == e $ sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB" ; break ; case 'sqlite' : $ sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)" ; break ; case 'pgsql' : $ sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)" ; break ; case 'oci' : $ sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(255) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)" ; break ; case 'sqlsrv' : $ sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)" ; break ; default : throw new \ DomainException ( sprintf ( 'Creating the cache table is currently not implemented for PDO driver "%s".' , $ this -> driver ) ) ; } $ conn -> exec ( $ sql ) ; }
docstring: Creates the table to store cache items which can be called once for setup.
  
  Cache ID are saved in a column of maximum length 255. Cache data is
  saved in a BLOB.
  
  @throws \PDOException    When the table already exists
  @throws DBALException    When the table already exists
  @throws \DomainException When an unsupported PDO driver is used
docstring_tokens: Creates the table to store cache items which can be called once for setup .