@@ -6,15 +6,9 @@ var Types = require(__dirname + '/types');
6
6
var utils = require ( __dirname + '/utils' ) ;
7
7
8
8
var Query = function ( config ) {
9
- this . text = config . text ;
10
- this . values = config . values ;
11
- this . rows = config . rows ;
12
- this . types = config . types ;
13
- this . name = config . name ;
14
- this . binary = config . binary ;
15
- //use unique portal name each time
16
- this . portal = config . portal || ""
17
- this . callback = config . callback ;
9
+ if ( config ) {
10
+ this . _init ( config ) ;
11
+ }
18
12
this . _fieldNames = [ ] ;
19
13
this . _fieldConverters = [ ] ;
20
14
this . _result = new Result ( ) ;
@@ -25,6 +19,18 @@ var Query = function(config) {
25
19
util . inherits ( Query , EventEmitter ) ;
26
20
var p = Query . prototype ;
27
21
22
+ p . _init = function ( config ) {
23
+ this . text = config . text ;
24
+ this . values = config . values ;
25
+ this . rows = config . rows ;
26
+ this . types = config . types ;
27
+ this . name = config . name ;
28
+ this . binary = config . binary ;
29
+ //use unique portal name each time
30
+ this . portal = config . portal || ""
31
+ this . callback = config . callback ;
32
+ }
33
+
28
34
p . requiresPreparation = function ( ) {
29
35
return ( this . values || 0 ) . length > 0 || this . name || this . rows || this . binary ;
30
36
} ;
0 commit comments