@bilims/mcp-sqlserver
Version:
MCP Server for Microsoft SQL Server with CRUD operations and data analysis capabilities
41 lines (40 loc) • 1.16 kB
TypeScript
export interface WhereCondition {
column: string;
operator: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'LIKE' | 'IN' | 'NOT IN' | 'IS NULL' | 'IS NOT NULL';
value?: any;
}
export interface JoinCondition {
type: 'INNER' | 'LEFT' | 'RIGHT' | 'FULL';
table: string;
on: string;
}
export interface QueryParams {
table: string;
columns?: string[];
where?: WhereCondition[];
joins?: JoinCondition[];
orderBy?: {
column: string;
direction: 'ASC' | 'DESC';
}[];
limit?: number;
offset?: number;
}
export declare class QueryBuilder {
static buildSelectQuery(params: QueryParams): {
query: string;
inputs: Record<string, any>;
};
static buildInsertQuery(table: string, data: Record<string, any>): {
query: string;
inputs: Record<string, any>;
};
static buildUpdateQuery(table: string, data: Record<string, any>, where: WhereCondition[]): {
query: string;
inputs: Record<string, any>;
};
static buildDeleteQuery(table: string, where: WhereCondition[]): {
query: string;
inputs: Record<string, any>;
};
}