Merge branch 'update-msnodesql' of github.com:SomaticIT/DefinitelyTyped into SomaticIT-update-msnodesql

Conflicts:
	CONTRIBUTORS.md
This commit is contained in:
vvakame
2014-10-21 10:58:51 +09:00
3 changed files with 44 additions and 13 deletions
+2 -1
View File
@@ -278,6 +278,7 @@ All definitions files include a header with the author and editors, so at some p
* [morgan](https://github.com/expressjs/morgan/) (by [James Roland Cabresos](https://github.com/staticfunction/))
* [Mousetrap](http://craig.is/killing/mice) (by [Dániel Tar](https://github.com/qcz))
* [msgpack.js](https://github.com/uupaa/msgpack.js) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki))
* [msnodesql](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov) and [Maxime LUCE](https://github.com/SomaticIT))
* [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov))
* [mysql](https://github.com/felixge/node-mysql) (by [William Johnston](https://github.com/wjohnsto))
* [nconf](https://github.com/flatiron/nconf) (by [Jeff Goddard](https://github.com/jedigo))
@@ -291,9 +292,9 @@ All definitions files include a header with the author and editors, so at some p
* [node-ffi](https://github.com/rbranson/node-ffi) (by [Paul Loyd](https://github.com/loyd))
* [node-form](https://github.com/rsamec/form) (by [Roman Samec](https://github.com/rsamec))
* [node-git](https://github.com/christkv/node-git) (by [vvakame](https://github.com/vvakame))
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov) and [Maxime LUCE](https://github.com/SomaticIT))
* [nodeunit](https://github.com/caolan/nodeunit) (by [Jeff Goddard](https://github.com/jedigo))
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
* [node-tar](https://github.com/npm/node-tar) (by [Maxime LUCE](https://github.com/SomaticIT))
* [node-uuid](https://github.com/broofa/node-uuid) (by [Jeff May](https://github.com/jeffmay))
* [notify.js](https://github.com/alexgibson/notify.js) (by [soundTricker](https://github.com/soundTricker))
+16
View File
@@ -14,6 +14,22 @@ function test_streaming() {
stmt.on('error', function (err) { console.log("We had an error :-( " + err); });
}
function test_callback() {
var conn_str = "Driver={SQL Server Native Client 11.0};Server={(local)\\SQLEXPRESS};Database={DBName};Trusted_Connection={Yes};";
sql.query(conn_str, "SELECT * FROM TestTable", (err, results) => {
if (err) {
console.error(err);
}
else if (results.length) {
console.log(results);
}
else {
console.log("No results");
}
});
}
function test_explicit() {
var conn_str = "Driver={SQL Server Native Client 11.0};Server={(localdb)\\v11.0};Database={DBName};Trusted_Connection={Yes};";
+26 -12
View File
@@ -1,6 +1,6 @@
// Type definitions for msnodesql 0.2
// Type definitions for msnodesql 0.2.1
// Project: https://github.com/WindowsAzure/node-sqlserver
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Maxime LUCE <https://github.com/SomaticIT>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -11,18 +11,25 @@ declare module "msnodesql" {
export function open(connectionString: string, callback?: OpenCallback): Connection;
export function query(connectionString: string, query: string, callback?: QueryCallback): StreamEvents;
export function query(connectionString: string, query: string, params: any[], callback?: QueryCallback): StreamEvents;
export function query(connectionString: string, query: string): StreamEvents;
export function query(connectionString: string, query: string, callback: QueryCallback<any>): StreamEvents;
export function query(connectionString: string, query: string, params: any[]): StreamEvents;
export function query(connectionString: string, query: string, params: any[], callback: QueryCallback<any>): StreamEvents;
export function queryRaw(connectionString: string, query: string, callback?: QueryRawCallback): StreamEvents;
export function queryRaw(connectionString: string, query: string, params: any[], callback?: QueryRawCallback): StreamEvents;
export function query<T>(connectionString: string, query: string, callback: QueryCallback<T>): StreamEvents;
export function query<T>(connectionString: string, query: string, params: any[], callback: QueryCallback<T>): StreamEvents;
export function queryRaw(connectionString: string, query: string): StreamEvents;
export function queryRaw(connectionString: string, query: string, callback: QueryRawCallback): StreamEvents;
export function queryRaw(connectionString: string, query: string, params: any[]): StreamEvents;
export function queryRaw(connectionString: string, query: string, params: any[], callback: QueryRawCallback): StreamEvents;
interface OpenCallback {
(err?: Error, connection?: Connection): void;
}
interface QueryCallback {
(err?: Error, results?: QueryRawResult, more?: boolean): void;
interface QueryCallback<T> {
(err?: Error, results?: T[], more?: boolean): void;
}
interface QueryRawCallback {
@@ -43,11 +50,18 @@ declare module "msnodesql" {
}
interface Connection {
queryRaw(query: string, callback?: QueryCallback): StreamEvents;
queryRaw(query: string, params: any[], callback?: QueryCallback): StreamEvents;
query(query: string): StreamEvents;
query(query: string, callback: QueryCallback<any>): StreamEvents;
query(query: string, params: any[]): StreamEvents;
query(query: string, params: any[], callback: QueryCallback<any>): StreamEvents;
query(query: string, callback?: QueryRawCallback): StreamEvents;
query(query: string, params: any[], callback?: QueryRawCallback): StreamEvents;
query<T>(query: string, callback: QueryCallback<T>): StreamEvents;
query<T>(query: string, params: any[], callback: QueryCallback<T>): StreamEvents;
queryRaw(query: string): StreamEvents;
queryRaw(query: string, callback: QueryRawCallback): StreamEvents;
queryRaw(query: string, params: any[]): StreamEvents;
queryRaw(query: string, params: any[], callback: QueryRawCallback): StreamEvents;
beginTransaction(callback?: ErrorCallback);
commit(callback?: ErrorCallback);