Skip to content

Commit a086442

Browse files
author
mimidots
committed
Fixed error of response locking to default on exit
1 parent f906f30 commit a086442

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Builder.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function get($limit = 0, $offet = 0)
103103

104104
//check if there is an error
105105
if (static::$response['status'] == "error") {
106-
return static::terminate();
106+
return static::terminate(static::$response);
107107
}
108108

109109
//check if the limit is a number
@@ -166,7 +166,7 @@ protected function fetch($sql)
166166
static::$response["status"] = "error";
167167
static::$response["response"] = $e->getMessage();
168168
static::$response['code'] = $e->getCode();
169-
return static::terminate();
169+
return static::terminate(static::$response);
170170

171171
}
172172
try {
@@ -175,13 +175,13 @@ protected function fetch($sql)
175175
static::$response["status"] = "error";
176176
static::$response["response"] = $e->getMessage();
177177
static::$response['code'] = $e->getCode();
178-
return static::terminate();
178+
return static::terminate(static::$response);
179179
}
180180
} catch (Exception $e) {
181181
static::$response["status"] = "error";
182182
static::$response["response"] = $e->getMessage();
183183
static::$response['code'] = $e->getCode();
184-
return static::terminate();
184+
return static::terminate(static::$response);
185185

186186
}
187187
try {
@@ -196,18 +196,18 @@ protected function fetch($sql)
196196
static::$response["status"] = "success";
197197
static::$response["response"] = Null;
198198
static::$response['code'] = 300;
199-
return static::terminate();
199+
return static::terminate(static::$response);
200200
}
201201
static::$response["status"] = "success";
202202
static::$response["response"] = $data;
203-
return static::terminate();
203+
return static::terminate(static::$response);
204204

205205

206206
} catch (PDOException $e) {
207207
static::$response["status"] = "error";
208208
static::$response["response"] = $e->getMessage();
209209
static::$response["code"] = $e->getCode();
210-
return static::terminate();
210+
return static::terminate(static::$response);
211211
}
212212

213213

@@ -231,7 +231,7 @@ public function all()
231231
static::$response["status"] = "error";
232232
static::$response["response"] = "Table name cannot be empty";
233233
static::$response["code"] = 5000;
234-
return self::terminate();
234+
return static::terminate(static::$response);
235235
}
236236
}
237237

@@ -247,13 +247,13 @@ public function insert($values)
247247
static::$response["status"] = "error";
248248
static::$response["response"] = "unrecognized parameter options in the insert values";
249249
static::$response["code"] = 7004;
250-
return self::terminate();
250+
return static::terminate(static::$response);
251251
}
252252
} catch (Exception $e) {
253253
static::$response["status"] = "error";
254254
static::$response["response"] = $e->getMessage();
255255
static::$response["code"] = $e->getCode();
256-
return static::terminate();
256+
return static::terminate(static::$response);
257257
}
258258

259259
return $this;
@@ -276,7 +276,7 @@ public function into($columns)
276276
static::$response["status"] = "error";
277277
static::$response["response"] = "Unrecognized characters. Please refer to documentation on how to insert a record";
278278
static::$response["code"] = 4001;
279-
return static::terminate();
279+
return static::terminate(static::$response);
280280

281281
}
282282
}
@@ -291,7 +291,7 @@ public function into($columns)
291291
static::$response["status"] = "error";
292292
static::$response["response"] = "Columns count does not equal the values count";
293293
static::$response['code'] = 4005;
294-
return static::terminate();
294+
return static::terminate(static::$response);
295295
}
296296

297297

@@ -306,7 +306,7 @@ protected function doInsert()
306306
{
307307
//check if there is an error from previous function execution
308308
if (static::$response["status"] == "error") {
309-
return static::terminate();
309+
return static::terminate(static::$response);
310310
}
311311
//convert each columns to ? parameter
312312
$columnParam = array_map(function () {
@@ -325,7 +325,7 @@ protected function doInsert()
325325
static::$response["status"] = "error";
326326
static::$response["response"] = $e->getMessage();
327327
static::$response["code"] = $e->getCode();
328-
return static::terminate();
328+
return static::terminate(static::$response);
329329
}
330330

331331
try {
@@ -381,7 +381,7 @@ protected function exec($query)
381381
static::$response["response"] = $e->getMessage();
382382
static::$response["code"] = $e->getCode();
383383

384-
static::terminate();
384+
static::terminate(static::$response);
385385
}
386386
}
387387

0 commit comments

Comments
 (0)