/**
 * Sybase SELECT query builder.
 *
 * Generates Sybase-compatible SELECT SQL with support for:
 * - Column selection (specific fields or *)
 * - WHERE conditions (via Drizzle SQL expressions)
 * - ORDER BY
 * - GROUP BY / HAVING
 * - JOINs (inner, left, right, full)
 * - DISTINCT
 * - Pagination via SET ROWCOUNT (Sybase has no LIMIT/OFFSET)
 * - CTE (WITH)
 *
 * @example
 * ```ts
 * // Basic select
 * const rows = await db.select().from(users).where(eq(users.name, "Alice"));
 *
 * // With pagination
 * const page2 = await db.select().from(users).orderBy(users.id).limit(10).offset(10);
 *
 * // With join
 * const result = await db.select()
 *   .from(users)
 *   .leftJoin(orders, eq(users.id, orders.userId))
 *   .where(eq(users.active, true));
 * ```
 */
import type { SQL } from "drizzle-orm";
import { type SybaseDialect } from "../dialect.js";
import type { SybaseSession, SybaseTransactionSession } from "../session.js";
export interface SybaseSelectField {
    expression: string;
    alias?: string;
}
export interface SybaseSelectJoin {
    type: "inner" | "left" | "right" | "full";
    table: string;
    on: string;
}
export interface SybaseSelectWithCTE {
    alias: string;
    sql: string;
}
export interface SybaseSelectConfig {
    fields: SybaseSelectField[];
    table?: string;
    joins?: SybaseSelectJoin[];
    where?: string;
    orderBy?: string[];
    groupBy?: string[];
    having?: string;
    distinct?: boolean;
    limit?: number;
    offset?: number;
    withList?: SybaseSelectWithCTE[];
}
export declare class SybaseSelectBuilder<T extends Record<string, unknown> = Record<string, unknown>> {
    private readonly dialect;
    private readonly session;
    private config;
    constructor(dialect: SybaseDialect, session: SybaseSession | SybaseTransactionSession, fields?: SybaseSelectField[]);
    /**
     * Add a Common Table Expression (CTE) to the query.
     *
     * @example
     * ```ts
     * const result = await db.select()
     *   .with("active_users", sql`select * from [users] where active = 1`)
     *   .from("active_users");
     * ```
     */
    with(alias: string, query: SQL | string): this;
    from(table: any): this;
    where(condition: SQL): this;
    orderBy(...columns: any[]): this;
    groupBy(...columns: any[]): this;
    having(condition: SQL): this;
    innerJoin(table: any, on: SQL): this;
    leftJoin(table: any, on: SQL): this;
    rightJoin(table: any, on: SQL): this;
    fullJoin(table: any, on: SQL): this;
    distinct(): this;
    /**
     * Set max rows to return. Sybase uses SET ROWCOUNT instead of LIMIT.
     *
     * - `limit(0)` returns zero rows (SET ROWCOUNT 0 before query, then reset)
     * - Negative values are ignored
     */
    limit(count: number): this;
    /**
     * Set offset for pagination.
     *
     * **Implementation:** Sybase ASE does not support OFFSET natively.
     * This is implemented by fetching `offset + limit` rows via SET ROWCOUNT,
     * then slicing off the first `offset` rows in application code.
     *
     * For best performance with large offsets, consider cursor-based pagination
     * using WHERE clauses on indexed columns instead.
     *
     * ORDER BY is required for deterministic results with offset.
     */
    offset(count: number): this;
    /**
     * Get the generated SQL string (for testing/debugging).
     */
    toSQL(): string;
    /**
     * Execute the query and return typed results.
     */
    execute(): Promise<T[]>;
    /**
     * Alias for execute() — enables `await db.select()...` pattern.
     */
    then<TResult1 = T[], TResult2 = never>(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
    private resolveColumns;
    private addJoin;
    private buildSql;
    /**
     * Get a hint for the native maxRows parameter to limit memory usage.
     * When offset+limit is known, we can tell the native layer the max rows expected.
     */
    private getMaxRowsHint;
}
//# sourceMappingURL=select.d.ts.map