Merge pull request #28537 from pkeuter/sqlanywhere

Add sqlanywhere typings
This commit is contained in:
Armando Aguirre
2018-08-31 14:18:56 -07:00
committed by GitHub
4 changed files with 88 additions and 0 deletions
+48
View File
@@ -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;
+13
View File
@@ -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);
+23
View File
@@ -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"
]
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "dtslint/dt.json",
"rules": {}
}