@@ -37,7 +37,7 @@ var Jdbc = require('informix-wrapper');
37
37
var req = require ( 'request' ) ;
38
38
var helper ;
39
39
40
- var javaReadBridge = process . env . JAVA_READ_BRIDGE || "http://localhost:5555 /bridge" ;
40
+ var javaReadBridge = process . env . JAVA_READ_BRIDGE || "http://localhost:8082 /bridge" ;
41
41
42
42
/**
43
43
* Regex for sql paramters e.g @param_name@
@@ -117,24 +117,36 @@ function executePreparedStatement(api, sql, parameters, connection, next, db) {
117
117
async . waterfall ( [
118
118
function ( cb ) {
119
119
parameterizeQuery ( sql , parameters , cb ) ;
120
- } , function ( parametrizedQuery , cb ) {
120
+ } ,
121
+ function ( parametrizedQuery , cb ) {
121
122
sql = parametrizedQuery ;
122
123
123
124
if ( api . helper . readTransaction ) {
124
- api . log ( "CALLING SANTTOSH'S MAGIC" ) ;
125
+ api . log ( "Calling Java Bridge" , "debug" ) ;
126
+
127
+ api . log ( sql , "debug" ) ;
125
128
126
129
var body = {
127
130
"sql" : new Buffer ( sql ) . toString ( 'base64' ) ,
128
131
"db" : db
129
132
} ;
130
133
131
- api . log ( body ) ;
134
+ api . log ( JSON . stringify ( body ) , "debug" ) ;
132
135
133
- req ( { url : javaReadBridge , body : body , json : true } , function ( response ) {
134
- api . log ( response ) ;
136
+ req ( { url : javaReadBridge , method : "POST" , body : body , json : true } , function ( error , response , body ) {
137
+ if ( error ) {
138
+ api . log ( error , "error" ) ;
139
+ cb ( error ) ;
140
+ }
141
+
142
+ if ( response . statusCode != 200 ) {
143
+ api . log ( response , "error" ) ;
144
+ cb ( response . statusMessage ) ;
145
+ }
146
+
147
+ api . log ( "Response:" + JSON . stringify ( body ) , "debug" ) ;
148
+ cb ( null , body . results ) ;
135
149
} ) ;
136
-
137
- cb ( null , [ ] ) ;
138
150
} else {
139
151
api . log ( "Database connected" , 'debug' ) ;
140
152
// the connection might have been closed due to other errors, so this check must be done
0 commit comments