public function getPrimaryKeys(string $table, bool $asArray = false)
    {
        $pk = [];

        if ($this->databaseType === 'mysql') {
            $sql = "SHOW COLUMNS FROM {$table}";
            $primaryKeyIndex = 'Key';
            $primaryKeyValue = 'PRI';
            $tableNameIndex = 'Field';
        } elseif ($this->databaseType === 'sqlite') {
            $sql = "PRAGMA table_info({$table})";
            $primaryKeyIndex = 'pk';
            $primaryKeyValue = 1;
            $tableNameIndex = 'name';
        } else {
            throw new \RuntimeException("Unsupported database type: '{$this->databaseType}'");
        }

        $stm = $this->query($sql);
        $r = $stm->fetchAll();
        $this->logQuery($sql);

        # Search all columns for the Primary Key flag
        foreach ($r as $col) {
            if ($col[$primaryKeyIndex] == $primaryKeyValue) {
                # Add this column to the primary keys list
                $pk[] = $col[$tableNameIndex];
            }
        }

        # if the return value is preferred as string
        if (!$asArray) {
            $pk = join(',', $pk);
        }

        return $pk;
    }