mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #28537 from pkeuter/sqlanywhere
Add sqlanywhere typings
This commit is contained in:
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// Type definitions for sqlanywhere 1.0
|
||||
// Project: https://github.com/sqlanywhere/node-sqlanywhere
|
||||
// Definitions by: Peter Keuter <https://github.com/pkeuter>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
export function createConnection(): SybaseConnection;
|
||||
|
||||
export interface SybaseConnection {
|
||||
connect(
|
||||
params: ConnectionParameters,
|
||||
cb: (err: Error | undefined) => void
|
||||
): void;
|
||||
close(cb: (err?: Error) => void): void;
|
||||
disconnect(cb: (err?: Error) => void): void;
|
||||
connected(): boolean;
|
||||
exec(query: string, cb: (err: Error | undefined, result: any) => void);
|
||||
exec(
|
||||
query: string,
|
||||
placeholders: any[],
|
||||
cb: (err: Error | undefined, result: any) => void
|
||||
);
|
||||
prepare(
|
||||
query: string,
|
||||
cb: (err: Error | undefined, stmt: Statement) => void
|
||||
);
|
||||
prepare(query: string): Statement;
|
||||
commit(cb: (err: Error | undefined) => void): void;
|
||||
rollback(cb: (err: Error | undefined) => void): void;
|
||||
}
|
||||
|
||||
export interface ConnectionParameters {
|
||||
Server: string;
|
||||
UserId: string;
|
||||
DatabaseFile?: string;
|
||||
AutoStart?: string;
|
||||
Password: string;
|
||||
Host?: string;
|
||||
}
|
||||
|
||||
export interface Statement {
|
||||
exec(args: any[], cb: (err: Error | undefined, rows: any[]) => void);
|
||||
exec(args: any[]): any[];
|
||||
getMoreResults(): any[];
|
||||
drop(cb: (err: Error | undefined) => void): void;
|
||||
}
|
||||
declare const _default: {
|
||||
createConnection: typeof createConnection;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,13 @@
|
||||
import sqlanywhere = require("sqlanywhere");
|
||||
|
||||
const connection: sqlanywhere.SybaseConnection = sqlanywhere.createConnection();
|
||||
connection.connect(
|
||||
{
|
||||
Host: "test",
|
||||
UserId: "Test",
|
||||
Password: "Test",
|
||||
Server: "Test"
|
||||
},
|
||||
err => err
|
||||
);
|
||||
connection.exec("SELECT * FROM TEST", (err, res) => res);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitThis": true,
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sqlanywhere-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {}
|
||||
}
|
||||
Reference in New Issue
Block a user