@@ -13,36 +13,36 @@ if (!process.env.TRAVIS) {
13
13
function createTable ( name , id , sql , noAutoId ) {
14
14
tables . push ( name ) ;
15
15
return db . query (
16
- ` BEGIN
17
- EXECUTE IMMEDIATE 'DROP TABLE ${ name } ';
18
- EXCEPTION WHEN OTHERS THEN
19
- IF SQLCODE != -942 THEN
20
- RAISE;
21
- END IF;
22
- END;`
16
+ " BEGIN " +
17
+ " EXECUTE IMMEDIATE 'DROP TABLE " + name + "'; " +
18
+ " EXCEPTION WHEN OTHERS THEN " +
19
+ " IF SQLCODE != -942 THEN " +
20
+ " RAISE; " +
21
+ " END IF; " +
22
+ " END;"
23
23
) . then ( function ( ) {
24
24
return db . query (
25
- ` BEGIN
26
- EXECUTE IMMEDIATE 'DROP SEQUENCE ${ name } _seq';
27
- EXCEPTION WHEN OTHERS THEN
28
- IF SQLCODE != -2289 THEN
29
- RAISE;
30
- END IF;
31
- END;`
25
+ " BEGIN " +
26
+ " EXECUTE IMMEDIATE 'DROP SEQUENCE " + name + " _seq'; " +
27
+ " EXCEPTION WHEN OTHERS THEN " +
28
+ " IF SQLCODE != -2289 THEN " +
29
+ " RAISE; " +
30
+ " END IF; " +
31
+ " END;"
32
32
) . then ( function ( ) {
33
33
if ( ! noAutoId ) {
34
- return db . query ( ` CREATE SEQUENCE ${ name } _seq` ) ;
34
+ return db . query ( ' CREATE SEQUENCE ' + name + ' _seq' ) ;
35
35
}
36
36
} ) . then ( function ( ) {
37
37
return db . query ( sql ) . then ( function ( ) {
38
38
if ( ! noAutoId ) {
39
39
return db . query (
40
- ` create or replace trigger ${ name } _id
41
- before insert on ${ name }
42
- for each row
43
- begin
44
- select ${ name } _seq.nextval into :new.${ id } from dual;
45
- end;`
40
+ " create or replace trigger " + name + " _id " +
41
+ " before insert on " + name + " " +
42
+ " for each row " +
43
+ " begin " +
44
+ " select " + name + " _seq.nextval into :new." + id + " from dual; " +
45
+ " end;"
46
46
) ;
47
47
}
48
48
} ) ;
@@ -51,41 +51,23 @@ if (!process.env.TRAVIS) {
51
51
}
52
52
53
53
return createTable ( "people" , "id" ,
54
- `create table people (
55
- id number primary key,
56
- name varchar2(50) NOT NULL,
57
- address_id number NULL
58
- )`
54
+ 'create table people (id number primary key, name varchar2(50) NOT NULL, address_id number NULL)'
59
55
) . then ( function ( ) {
60
56
return createTable ( "people_addresses" , "address_id" ,
61
- `create table people_addresses(
62
- address_id int NOT NULL,
63
- person_id int NOT NULL,
64
- rating int NULL
65
- )` ,
57
+ 'create table people_addresses(address_id int NOT NULL, person_id int NOT NULL, rating int NULL)' ,
66
58
true
67
59
) ;
68
60
} ) . then ( function ( ) {
69
61
return createTable ( "addresses" , "id" ,
70
- `create table addresses(
71
- id number primary key,
72
- address varchar2(50) NOT NULL
73
- )`
62
+ 'create table addresses(id number primary key, address varchar2(50) NOT NULL)'
74
63
) ;
75
64
} ) . then ( function ( ) {
76
65
return createTable ( "people_weird_id" , "weird_id" ,
77
- `create table people_weird_id(
78
- weird_id number primary key,
79
- name varchar2(50) NULL,
80
- address_weird_id int NULL
81
- )`
66
+ 'create table people_weird_id(weird_id number primary key, name varchar2(50) NULL, address_weird_id int NULL)'
82
67
) ;
83
68
} ) . then ( function ( ) {
84
69
return createTable ( "people_explicit_id" , "id" ,
85
- `create table people_explicit_id(
86
- id int NOT NULL,
87
- name varchar2(50) NOT NULL
88
- )`
70
+ 'create table people_explicit_id(id int NOT NULL, name varchar2(50) NOT NULL)'
89
71
) ;
90
72
} ) ;
91
73
} ,
@@ -103,7 +85,7 @@ if (!process.env.TRAVIS) {
103
85
function urlConfig ( options ) {
104
86
return {
105
87
driver : 'oracle' ,
106
- url : addUrlParams ( ` oracle://system:oracle@${ dockerHostname } :1521/XE` , options )
88
+ url : addUrlParams ( ' oracle://system:oracle@' + dockerHostname + ' :1521/XE' , options )
107
89
} ;
108
90
}
109
91
@@ -113,7 +95,7 @@ if (!process.env.TRAVIS) {
113
95
config : _ . extend ( {
114
96
user : "system" ,
115
97
password : "oracle" ,
116
- connectString : ` ${ dockerHostname } :1521/XE`
98
+ connectString : dockerHostname + ' :1521/XE'
117
99
} , options )
118
100
} ;
119
101
}
@@ -128,7 +110,7 @@ if (!process.env.TRAVIS) {
128
110
return Promise . all ( [
129
111
db ? db . close ( ) : undefined ,
130
112
db1 ? db1 . close ( ) : undefined
131
- ] ) . then ( ( ) => {
113
+ ] ) . then ( function ( ) {
132
114
db = undefined ;
133
115
db1 = undefined ;
134
116
} ) ;
@@ -141,29 +123,29 @@ if (!process.env.TRAVIS) {
141
123
it ( "doesn't pool connections normally" , function ( ) {
142
124
db = sworm . db ( urlConfig ( ) ) ;
143
125
var poolsBefore = numberOfPools ( ) ;
144
- return db . query ( 'select * from people' ) . then ( ( rows ) => {
126
+ return db . query ( 'select * from people' ) . then ( function ( rows ) {
145
127
expect ( rows ) . to . eql ( [ ] ) ;
146
- expect ( Object . keys ( numberOfPools ( ) ) . length ) . to . equal ( poolsBefore ) ;
128
+ expect ( numberOfPools ( ) ) . to . equal ( poolsBefore ) ;
147
129
} ) ;
148
130
} ) ;
149
131
150
132
function testConnectionPooling ( config ) {
151
133
var db1 = sworm . db ( config ) ;
152
134
var poolsBefore = numberOfPools ( ) ;
153
- return db1 . query ( 'select * from people' ) . then ( ( rows ) => {
135
+ return db1 . query ( 'select * from people' ) . then ( function ( rows ) {
154
136
expect ( rows ) . to . eql ( [ ] ) ;
155
137
expect ( numberOfPools ( ) ) . to . equal ( poolsBefore + 1 ) ;
156
- } ) . then ( ( ) => {
138
+ } ) . then ( function ( ) {
157
139
db2 = sworm . db ( config ) ;
158
140
159
- return db2 . query ( 'select * from people' ) . then ( ( rows ) => {
141
+ return db2 . query ( 'select * from people' ) . then ( function ( rows ) {
160
142
expect ( rows ) . to . eql ( [ ] ) ;
161
143
expect ( numberOfPools ( ) ) . to . equal ( poolsBefore + 1 ) ;
162
- } ) . then ( ( ) => {
144
+ } ) . then ( function ( ) {
163
145
return db2 . close ( ) ;
164
146
} ) ;
165
- } ) . then ( ( ) => {
166
- return db1 . query ( 'select * from people' ) . then ( ( rows ) => {
147
+ } ) . then ( function ( ) {
148
+ return db1 . query ( 'select * from people' ) . then ( function ( rows ) {
167
149
expect ( rows ) . to . eql ( [ ] ) ;
168
150
expect ( numberOfPools ( ) ) . to . equal ( poolsBefore + 1 ) ;
169
151
} ) ;
@@ -185,7 +167,7 @@ if (!process.env.TRAVIS) {
185
167
it ( 'can pass connection options' , function ( ) {
186
168
oracledb . maxRows = 100 ;
187
169
db = sworm . db ( urlConfig ( { maxRows : 100000 } ) ) ;
188
- return db . connect ( ) . then ( ( ) => {
170
+ return db . connect ( ) . then ( function ( ) {
189
171
expect ( oracledb . maxRows ) . to . equal ( 100000 ) ;
190
172
} ) ;
191
173
} ) ;
@@ -204,8 +186,8 @@ if (!process.env.TRAVIS) {
204
186
name : 'bob'
205
187
} ) ;
206
188
207
- return bob . save ( ) . then ( ( ) => {
208
- return db . query ( 'select * from people' , { } , { formatRows : false , outFormat : oracledb . OBJECT } ) . then ( rows => {
189
+ return bob . save ( ) . then ( function ( ) {
190
+ return db . query ( 'select * from people' , { } , { formatRows : false , outFormat : oracledb . OBJECT } ) . then ( function ( rows ) {
209
191
expect ( rows . metaData ) . to . eql ( [
210
192
{ name : 'ID' } ,
211
193
{ name : 'NAME' } ,
0 commit comments