import { SQLJob } from "./sqlJob";
import { BindingValue, QueryOptions, QueryResult, ServerResponse } from "./types";
/**
 * Represents the possible states of a query execution.
 */
export type QueryState = "NOT_YET_RUN" | "RUN_MORE_DATA_AVAILABLE" | "RUN_DONE" | "ERROR";
/**
 * Represents a SQL query that can be executed and managed within a SQL job.
 *
 * @template T - The type of the result returned by the query.
 */
export declare class Query<T> {
    private job;
    /**
     * List of all global queries that are currently open.
     */
    private static globalQueryList;
    /**
     * The correlation ID associated with the query.
     */
    private correlationId;
    /**
     * The SQL statement to be executed.
     */
    private sql;
    /**
     * Indicates if the query has been prepared.
     */
    private isPrepared;
    /**
     * The parameters to be used with the SQL query.
     */
    private parameters;
    /**
     * The number of rows to fetch in each execution.
     */
    private rowsToFetch;
    /**
     * Indicates if the query is a CL command.
     */
    private isCLCommand;
    /**
     * The current state of the query execution.
     */
    private state;
    /**
     * Indicates if the results should be terse.
     */
    private isTerseResults;
    /**
     * Constructs a new Query instance.
     *
     * @param job - The SQL job that this query will be executed within.
     * @param query - The SQL statement to execute.
     * @param opts - Optional settings for the query, such as parameters and command type.
     */
    constructor(job: SQLJob, query: string, opts?: QueryOptions);
    /**
     * Retrieves a Query instance by its correlation ID.
     *
     * @param id - The correlation ID of the query.
     * @returns The corresponding Query instance or undefined if not found.
     */
    static byId(id: string): Query<any>;
    /**
     * Retrieves a list of open correlation IDs for the specified job.
     *
     * @param forJob - Optional SQLJob to filter the queries by.
     * @returns An array of correlation IDs for open queries.
     */
    static getOpenIds(forJob?: SQLJob): string[];
    /**
     * Cleans up completed or erroneous queries from the global query list.
     *
     * @returns A promise that resolves when cleanup is complete.
     */
    static cleanup(): Promise<void>;
    /**
     * Add sql statements to the batch only
     *
     * @returns The parameters for the batch
     */
    addToBatch(parameters: BindingValue[]): BindingValue[];
    /**
     * Executes the SQL query and returns the results.
     *
     * @param rowsToFetch - The number of rows to fetch (defaults to the configured number).
     * @returns A promise that resolves to the query result.
     */
    execute(rowsToFetch?: number): Promise<QueryResult<T>>;
    /**
     * Fetches more rows from the currently running query.
     *
     * @param rowsToFetch - The number of additional rows to fetch.
     * @returns A promise that resolves to the query result.
     */
    fetchMore(rowsToFetch?: number): Promise<QueryResult<T>>;
    /**
     * Closes the query and releases any associated resources.
     *
     * @returns A promise that resolves when the query is closed.
     */
    close(): Promise<ServerResponse>;
    /**
     * Retrieves the SQL job that the query is running under.
     */
    getHostJob(): SQLJob;
    /**
     * Retrieves the correlation ID of the query.
     *
     * @returns The correlation ID as a string.
     */
    getId(): string;
    /**
     * Retrieves the current state of the query.
     *
     * @returns The current state as a "
     */
    getState(): QueryState;
}
