meadow 2.0.29 → 2.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meadow",
3
- "version": "2.0.29",
3
+ "version": "2.0.30",
4
4
  "description": "A data access library.",
5
5
  "main": "source/Meadow.js",
6
6
  "scripts": {
@@ -130,8 +130,22 @@ var MeadowProvider = function ()
130
130
  _Fable.log.trace(pQuery.query.body, pQuery.query.parameters);
131
131
  }
132
132
 
133
- getSQLPool().getConnection(function (pError, pDBConnection)
133
+ var tmpPool = getSQLPool();
134
+ if (!tmpPool)
134
135
  {
136
+ tmpResult.error = new Error('No MySQL connection pool available.');
137
+ tmpResult.executed = true;
138
+ return fCallback();
139
+ }
140
+ tmpPool.getConnection(function (pError, pDBConnection)
141
+ {
142
+ if (pError || !pDBConnection)
143
+ {
144
+ _Fable.log.error('Error getting connection from MySQL pool during create query: ' + (pError ? pError.message : 'no connection returned'), { Body: pQuery.query.body });
145
+ tmpResult.error = pError || new Error('No connection returned from pool.');
146
+ tmpResult.executed = true;
147
+ return fCallback();
148
+ }
135
149
  pDBConnection.query(
136
150
  pQuery.query.body,
137
151
  pQuery.query.parameters,
@@ -171,8 +185,22 @@ var MeadowProvider = function ()
171
185
  _Fable.log.trace(pQuery.query.body, pQuery.query.parameters);
172
186
  }
173
187
 
174
- getSQLPool().getConnection(function (pError, pDBConnection)
188
+ var tmpPool = getSQLPool();
189
+ if (!tmpPool)
190
+ {
191
+ tmpResult.error = new Error('No MySQL connection pool available.');
192
+ tmpResult.executed = true;
193
+ return fCallback();
194
+ }
195
+ tmpPool.getConnection(function (pError, pDBConnection)
175
196
  {
197
+ if (pError || !pDBConnection)
198
+ {
199
+ _Fable.log.error('Error getting connection from MySQL pool during read query: ' + (pError ? pError.message : 'no connection returned'), { Body: pQuery.query.body });
200
+ tmpResult.error = pError || new Error('No connection returned from pool.');
201
+ tmpResult.executed = true;
202
+ return fCallback();
203
+ }
176
204
  pDBConnection.query(
177
205
  pQuery.query.body,
178
206
  pQuery.query.parameters,
@@ -201,8 +229,22 @@ var MeadowProvider = function ()
201
229
  _Fable.log.trace(pQuery.query.body, pQuery.query.parameters);
202
230
  }
203
231
 
204
- getSQLPool().getConnection(function (pError, pDBConnection)
232
+ var tmpPool = getSQLPool();
233
+ if (!tmpPool)
234
+ {
235
+ tmpResult.error = new Error('No MySQL connection pool available.');
236
+ tmpResult.executed = true;
237
+ return fCallback();
238
+ }
239
+ tmpPool.getConnection(function (pError, pDBConnection)
205
240
  {
241
+ if (pError || !pDBConnection)
242
+ {
243
+ _Fable.log.error('Error getting connection from MySQL pool during update query: ' + (pError ? pError.message : 'no connection returned'), { Body: pQuery.query.body });
244
+ tmpResult.error = pError || new Error('No connection returned from pool.');
245
+ tmpResult.executed = true;
246
+ return fCallback();
247
+ }
206
248
  pDBConnection.query(
207
249
  pQuery.query.body,
208
250
  pQuery.query.parameters,
@@ -231,8 +273,22 @@ var MeadowProvider = function ()
231
273
  _Fable.log.trace(pQuery.query.body, pQuery.query.parameters);
232
274
  }
233
275
 
234
- getSQLPool().getConnection(function (pError, pDBConnection)
276
+ var tmpPool = getSQLPool();
277
+ if (!tmpPool)
235
278
  {
279
+ tmpResult.error = new Error('No MySQL connection pool available.');
280
+ tmpResult.executed = true;
281
+ return fCallback();
282
+ }
283
+ tmpPool.getConnection(function (pError, pDBConnection)
284
+ {
285
+ if (pError || !pDBConnection)
286
+ {
287
+ _Fable.log.error('Error getting connection from MySQL pool during delete query: ' + (pError ? pError.message : 'no connection returned'), { Body: pQuery.query.body });
288
+ tmpResult.error = pError || new Error('No connection returned from pool.');
289
+ tmpResult.executed = true;
290
+ return fCallback();
291
+ }
236
292
  pDBConnection.query
237
293
  (
238
294
  pQuery.query.body,
@@ -270,8 +326,22 @@ var MeadowProvider = function ()
270
326
  _Fable.log.trace(pQuery.query.body, pQuery.query.parameters);
271
327
  }
272
328
 
273
- getSQLPool().getConnection(function (pError, pDBConnection)
329
+ var tmpPool = getSQLPool();
330
+ if (!tmpPool)
331
+ {
332
+ tmpResult.error = new Error('No MySQL connection pool available.');
333
+ tmpResult.executed = true;
334
+ return fCallback();
335
+ }
336
+ tmpPool.getConnection(function (pError, pDBConnection)
274
337
  {
338
+ if (pError || !pDBConnection)
339
+ {
340
+ _Fable.log.error('Error getting connection from MySQL pool during undelete query: ' + (pError ? pError.message : 'no connection returned'), { Body: pQuery.query.body });
341
+ tmpResult.error = pError || new Error('No connection returned from pool.');
342
+ tmpResult.executed = true;
343
+ return fCallback();
344
+ }
275
345
  pDBConnection.query
276
346
  (
277
347
  pQuery.query.body,
@@ -309,8 +379,22 @@ var MeadowProvider = function ()
309
379
  _Fable.log.trace(pQuery.query.body, pQuery.query.parameters);
310
380
  }
311
381
 
312
- getSQLPool().getConnection(function (pError, pDBConnection)
382
+ var tmpPool = getSQLPool();
383
+ if (!tmpPool)
384
+ {
385
+ tmpResult.error = new Error('No MySQL connection pool available.');
386
+ tmpResult.executed = true;
387
+ return fCallback();
388
+ }
389
+ tmpPool.getConnection(function (pError, pDBConnection)
313
390
  {
391
+ if (pError || !pDBConnection)
392
+ {
393
+ _Fable.log.error('Error getting connection from MySQL pool during count query: ' + (pError ? pError.message : 'no connection returned'), { Body: pQuery.query.body });
394
+ tmpResult.error = pError || new Error('No connection returned from pool.');
395
+ tmpResult.executed = true;
396
+ return fCallback();
397
+ }
314
398
  pDBConnection.query(
315
399
  pQuery.query.body,
316
400
  pQuery.query.parameters,