File tree Expand file tree Collapse file tree 2 files changed +23
-31
lines changed Expand file tree Collapse file tree 2 files changed +23
-31
lines changed Original file line number Diff line number Diff line change 1
1
var EventEmitter = require ( 'events' ) . EventEmitter ;
2
2
var util = require ( 'util' ) ;
3
3
var utils = require ( '../utils' ) ;
4
+ var NativeResult = require ( './result' ) ;
4
5
5
6
var NativeQuery = module . exports = function ( native ) {
6
7
EventEmitter . call ( this ) ;
@@ -25,37 +26,6 @@ var NativeQuery = module.exports = function(native) {
25
26
26
27
util . inherits ( NativeQuery , EventEmitter ) ;
27
28
28
- //given an array of values, turn all `undefined` into `null`
29
- var clean = function ( values ) {
30
- for ( var i = 0 ; i < values . length ; i ++ ) {
31
- if ( typeof values [ i ] == 'undefined' ) {
32
- values [ i ] = null ;
33
- }
34
- }
35
- } ;
36
-
37
- var NativeResult = function ( pq ) {
38
- this . command = null ;
39
- this . rowCount = 0 ;
40
- this . rows = null ;
41
- this . fields = null ;
42
- } ;
43
-
44
- NativeResult . prototype . addCommandComplete = function ( pq ) {
45
- this . command = pq . cmdStatus ( ) . split ( ' ' ) [ 0 ] ;
46
- this . rowCount = pq . cmdTuples ( ) ;
47
- var nfields = pq . nfields ( ) ;
48
- if ( nfields < 1 ) return ;
49
-
50
- this . fields = [ ] ;
51
- for ( var i = 0 ; i < nfields ; i ++ ) {
52
- this . fields . push ( {
53
- name : pq . fname ( i ) ,
54
- dataTypeID : pq . ftype ( i )
55
- } ) ;
56
- }
57
- } ;
58
-
59
29
NativeQuery . prototype . handleError = function ( err ) {
60
30
var self = this ;
61
31
//copy pq error fields into the error object
Original file line number Diff line number Diff line change
1
+ var NativeResult = module . exports = function ( pq ) {
2
+ this . command = null ;
3
+ this . rowCount = 0 ;
4
+ this . rows = null ;
5
+ this . fields = null ;
6
+ } ;
7
+
8
+ NativeResult . prototype . addCommandComplete = function ( pq ) {
9
+ this . command = pq . cmdStatus ( ) . split ( ' ' ) [ 0 ] ;
10
+ this . rowCount = pq . cmdTuples ( ) ;
11
+ var nfields = pq . nfields ( ) ;
12
+ if ( nfields < 1 ) return ;
13
+
14
+ this . fields = [ ] ;
15
+ for ( var i = 0 ; i < nfields ; i ++ ) {
16
+ this . fields . push ( {
17
+ name : pq . fname ( i ) ,
18
+ dataTypeID : pq . ftype ( i )
19
+ } ) ;
20
+ }
21
+ } ;
22
+
You can’t perform that action at this time.
0 commit comments