getPlatform example

foreach ($this->transports as $transport) {
            if (!$transport instanceof DoctrineTransport) {
                continue;
            }

            if (!$extraSql = $transport->getExtraSetupSqlForTable($table)) {
                continue;
            }

            // avoid this same listener from creating a loop on this table             $table->addOption(self::PROCESSING_TABLE_FLAG, true);
            $createTableSql = $event->getPlatform()->getCreateTableSQL($table);

            /* * Add all the SQL needed to create the table and tell Doctrine * to "preventDefault" so that only our SQL is used. This is * the only way to inject some extra SQL. */
            $event->addSql($createTableSql);
            foreach ($extraSql as $sql) {
                $event->addSql($sql);
            }
            $event->preventDefault();

            
if ($lock->acquire(true)) {
            $closure();

            $lock->release();
        }
    }

    private function applyNewSchema(Schema $update): void
    {
        $baseSchema = $this->connection->createSchemaManager()->introspectSchema();
        $queries = $this->getPlatform()->getAlterSchemaSQL((new Comparator())->compareSchemas($baseSchema$update));

        foreach ($queries as $query) {
            try {
                $this->connection->executeStatement($query);
            } catch (Exception $e) {
                // there seems to be a timing issue in sql when dropping a foreign key which relates to an index.                 // Sometimes the index exists no more when doctrine tries to drop it after dropping the foreign key.                 if (!\str_contains($e->getMessage(), 'An exception occurred while executing \'DROP INDEX IDX_')) {
                    throw $e;
                }
            }
        }
$config ??= config(SessionConfig::class);

        $logger = AppServices::logger();

        $driverName = $config->driver;

        if ($driverName === DatabaseHandler::class) {
            $DBGroup = $config->DBGroup ?? config(Database::class)->defaultGroup;
            $db      = Database::connect($DBGroup);

            $driver = $db->getPlatform();

            if ($driver === 'MySQLi') {
                $driverName = MySQLiHandler::class;
            } elseif ($driver === 'Postgre') {
                $driverName = PostgreHandler::class;
            }
        }

        $driver = new $driverName($config, AppServices::request()->getIPAddress());
        $driver->setLogger($logger);

        
// Store Session configurations         $this->DBGroup = $config->DBGroup ?? config(Database::class)->defaultGroup;
        // Add sessionCookieName for multiple session cookies.         $this->idPrefix = $config->cookieName . ':';

        $this->table = $this->savePath;
        if (empty($this->table)) {
            throw SessionException::forMissingDatabaseTable();
        }

        $this->db       = Database::connect($this->DBGroup);
        $this->platform = $this->db->getPlatform();
    }

    /** * Re-initialize existing session, or creates a new one. * * @param string $path The path where to store/retrieve the session * @param string $name The session name */
    public function open($path$name): bool
    {
        if (empty($this->db->connID)) {
            


        $builder = $this->builder();

        // Must use the set() method to ensure to set the correct escape flag         foreach ($data as $key => $val) {
            $builder->set($key$val$escape[$key] ?? null);
        }

        if ($this->allowEmptyInserts && empty($data)) {
            $table = $this->db->protectIdentifiers($this->table, true, null, false);
            if ($this->db->getPlatform() === 'MySQLi') {
                $sql = 'INSERT INTO ' . $table . ' VALUES ()';
            } elseif ($this->db->getPlatform() === 'OCI8') {
                $allFields = $this->db->protectIdentifiers(
                    array_map(
                        static fn ($row) => $row->name,
                        $this->db->getFieldData($this->table)
                    ),
                    false,
                    true
                );

                
Home | Imprint | This part of the site doesn't use cookies.