Skip to content

Commit b82fdbd

Browse files
Update driver for node12 support
1 parent 2c942a3 commit b82fdbd

16 files changed

+78
-70
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# node-sqlanywhere
2-
This is a Node.js driver written for [SAP SQL Anywhere](http://www.sap.com/pc/tech/database/software/sybase-sql-anywhere/index.html).
2+
This is a Node.js driver written for [SAP SQL Anywhere](https://www.sap.com/products/sql-anywhere.html).
33

44
[![NPM](https://nodei.co/npm/sqlanywhere.png?compact=true)](https://nodei.co/npm/sqlanywhere/)
55

@@ -22,7 +22,8 @@ Versions supported:
2222
<tr><td>1.0.19</td><td>8.x</td></tr>
2323
<tr><td>1.0.22</td><td>9.x</td></tr>
2424
<tr><td>1.0.23</td><td>10.x</td></tr>
25-
<tr><td>1.0.24</th><td><b>Only</b> 5.x through 10.x (support for 0.10, 0.12, and 4.x is dropped)</td></tr>
25+
<tr><td>1.0.24<td><b>Only</b> 5.x through 10.x (support for 0.10, 0.12, and 4.x is dropped)</td></tr>
26+
<tr><td>1.0.25<td>5.x through 12.x</td></tr>
2627
</table>
2728

2829
## Getting Started

build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
var db = null;
55
var exec = require('child_process').exec;

examples/app1.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
// This sample code is provided AS IS, without warranty or liability of any kind.
55
//

examples/readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# ***************************************************************************
2-
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
# ***************************************************************************
44
These examples are intended to be used with the SQL Anywhere node.js driver.

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
var db = null;
55
var driver_file = "sqlanywhere"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "SQL ANYWHERE",
33
"name": "sqlanywhere",
44
"description": "SQL Anywhere JavaScript Driver.",
5-
"version": "1.0.24",
5+
"version": "1.0.25",
66
"repository": {
77
"url": "https://github.com/sqlanywhere/node-sqlanywhere"
88
},

src/h/connection.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
using namespace v8;
55
using namespace node;

src/h/errors.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
#define JS_ERR_INVALID_OBJECT -2001
55
#define JS_ERR_INVALID_ARGUMENTS -2002

src/h/nodever_cover.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
#include <node_version.h>
55

src/h/sacapi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
//
55
// Licensed under the Apache License, Version 2.0 (the "License");

src/h/sacapidll.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
//
55
// Licensed under the Apache License, Version 2.0 (the "License");

src/h/sqlany_utils.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
#include <iostream>
55
#include <string>
@@ -15,6 +15,12 @@
1515
#pragma warning (disable : 4800)
1616
#pragma GCC diagnostic ignored "-Wunused-parameter"
1717

18+
#if defined( _MSC_VER )
19+
// According to the github page for node.js, some warnings generated by
20+
// Visual Studio are "overzealous". They should be fixed in VS 2017 15.6.
21+
// https://github.com/nodejs/node/issues/17114
22+
#pragma warning( disable : 4251 )
23+
#endif
1824
#include "node.h"
1925
#include "v8.h"
2026
#include "node_buffer.h"
@@ -157,8 +163,8 @@ void callBack( std::string * str,
157163
#endif
158164

159165
bool getBindParameters( std::vector<ExecuteData *> &execData
160-
, Isolate * isolate
161-
, Local<Value> arg
166+
, Isolate * isolate
167+
, Local<Value> arg
162168
, std::vector<a_sqlany_bind_param> &params
163169
, unsigned &num_rows
164170
);

src/h/stmt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
using namespace v8;
55

src/sacapidll.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
//
55
// Licensed under the Apache License, Version 2.0 (the "License");

src/sqlanywhere.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ***************************************************************************
2-
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
2+
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved.
33
// ***************************************************************************
44
#include "nodever_cover.h"
55
#include "sqlany_utils.h"
@@ -225,7 +225,7 @@ NODE_API_FUNC( StmtObject::exec )
225225
baton->callback_required = callback_required;
226226

227227
if( bind_required ) {
228-
if( !getBindParameters( baton->execData, isolate, args[0], baton->params,
228+
if( !getBindParameters( baton->execData, isolate, args[0], baton->params,
229229
baton->num_rows ) ) {
230230
delete baton;
231231
std::string error_msg;
@@ -454,7 +454,7 @@ NODE_API_FUNC( Connection::exec )
454454
args.GetReturnValue().SetUndefined();
455455
return;
456456
}
457-
457+
458458
#if NODE_MAJOR_VERSION >= 12
459459
String::Utf8Value param0( isolate, (args[0]->ToString(context)).ToLocalChecked() );
460460
#else
@@ -469,7 +469,7 @@ NODE_API_FUNC( Connection::exec )
469469
baton->stmt = std::string(*param0);
470470

471471
if( bind_required ) {
472-
if( !getBindParameters( baton->execData, isolate, args[1], baton->params,
472+
if( !getBindParameters( baton->execData, isolate, args[1], baton->params,
473473
baton->num_rows ) ) {
474474
delete baton;
475475
std::string error_msg;
@@ -646,13 +646,13 @@ NODE_API_FUNC( Connection::prepare )
646646
p_stmt.Reset();
647647
return;
648648
}
649-
649+
650650
#if NODE_MAJOR_VERSION >= 12
651-
String::Utf8Value param0( isolate, (args[0]->ToString(context)).ToLocalChecked());
651+
String::Utf8Value param0( isolate, (args[0]->ToString(context)).ToLocalChecked() );
652652
#else
653653
String::Utf8Value param0( (args[0]->ToString(context)).ToLocalChecked() );
654654
#endif
655-
655+
656656
prepareBaton *baton = new prepareBaton();
657657
baton->obj = obj;
658658
baton->callback_required = callback_required;
@@ -867,39 +867,39 @@ NODE_API_FUNC( Connection::connect )
867867
baton->sqlca_connection = sqlca_connection;
868868

869869
if( sqlca_connection ) {
870-
baton->sqlca = (void *)(long)(args[0]->NumberValue(context)).FromJust();
870+
baton->sqlca = (void *)(long)(args[0]->NumberValue(context)).FromJust();
871871

872872
} else {
873873
Local<String> localArg = Local<String>::New( isolate, obj->_arg );
874874
if( localArg->Length() > 0 ) {
875875
#if NODE_MAJOR_VERSION >= 12
876-
String::Utf8Value param0( isolate, localArg );
876+
String::Utf8Value param0( isolate, localArg );
877877
#else
878-
String::Utf8Value param0( localArg );
878+
String::Utf8Value param0( localArg );
879879
#endif
880880
baton->conn_string = std::string(*param0);
881881
} else {
882882
baton->conn_string = std::string();
883883
}
884884
if( arg_is_string ) {
885885
#if NODE_MAJOR_VERSION >= 12
886-
String::Utf8Value param0( isolate, (args[0]->ToString(context)).ToLocalChecked());
886+
String::Utf8Value param0( isolate, (args[0]->ToString(context)).ToLocalChecked());
887887
#else
888-
String::Utf8Value param0( (args[0]->ToString(context)).ToLocalChecked() );
888+
String::Utf8Value param0( (args[0]->ToString(context)).ToLocalChecked() );
889889
#endif
890890
baton->conn_string.append( ";" );
891891
baton->conn_string.append(*param0);
892892
} else if( arg_is_object ) {
893893
Persistent<String> arg_string;
894-
HashToString( isolate, args[0]->ToObject(isolate), arg_string );
894+
HashToString( isolate, args[0]->ToObject(isolate), arg_string );
895895
Local<String> local_arg_string =
896896
Local<String>::New( isolate, arg_string );
897897
#if NODE_MAJOR_VERSION >= 12
898-
String::Utf8Value param0( isolate, local_arg_string );
898+
String::Utf8Value param0( isolate, local_arg_string );
899899
#else
900-
String::Utf8Value param0( local_arg_string );
900+
String::Utf8Value param0( local_arg_string );
901901
#endif
902-
baton->conn_string.append( ";" );
902+
baton->conn_string.append( ";" );
903903
baton->conn_string.append(*param0);
904904
arg_string.Reset();
905905
}

0 commit comments

Comments
 (0)