/**
 * getIndexes
 * Returns an array of indexes based on the type of db it's talking to
 *
 * @return Array Returns an array of index names
 */
function getIndexes()
{
    $dbtype = _getDbType();
    switch ($dbtype) {
        case 'oci':
            $sql = 'SELECT index_name FROM user_indexes';
            break;
        case 'pgsql':
            $sql = 'SELECT indexname from pg_indexes where tablename like \'sq_%\' and indexdef not ilike \'create unique index %\'';
            break;
    }
    $del_idx = array();
    if ($sql !== false) {
        $indexes = MatrixDAL::executeSqlAll($sql);
        foreach ($indexes as $key => $value) {
            $del_idx[] = strtolower($value[0]);
        }
    }
    return $del_idx;
}
        // display them
        $count = count($affected_result);
        if (empty($count)) {
            echo "NONE\n";
        } else {
            echo "There are {$count} remap(s) with invalid new URL.\n";
        }
        printRemaps($affected_result);
    }
}
/*
 * report long redirects remaps
 */
if (getCLIArg('redirect_chain')) {
    echo "\n## Redirect Chain ##\n";
    $db_type = _getDbType();
    $except_clause = 'EXCEPT';
    if ($db_type === 'oci') {
        $except_clause = 'MINUS';
    }
    // find out all long redirects with magic query
    $sql = '(SELECT  a.* FROM sq_ast_lookup_remap a, sq_ast_lookup_remap b WHERE a.url = b.remap_url)
            UNION ALL
            (SELECT  c.* FROM sq_ast_lookup_remap c, sq_ast_lookup_remap d WHERE c.remap_url = d.url
                ' . $except_clause . ' SELECT c.* FROM sq_ast_lookup_remap c, sq_ast_lookup_remap d WHERE c.url = d.remap_url
            )';
    $query = MatrixDAL::preparePdoQuery($sql);
    $result = MatrixDAL::executePdoAll($query);
    $sorted_result = array();
    // now we have to sort them nicely to report
    while (count($result) > 0) {
function check_index_parallel($tablename = null, $idx_name = null)
{
    if ($tablename === null || $idx_name === null) {
        return;
    }
    $dbtype = _getDbType();
    global $parallel_list;
    global $parallel_warnings;
    if ($dbtype == 'oci') {
        $parallel_check = $parallel_list[$tablename][$idx_name];
        if ($parallel_check > 1) {
            $parallel_warnings[] = array($idx_name => $parallel_check);
        }
    }
}