Skip to content

Instantly share code, notes, and snippets.

@nayibor
Created July 3, 2015 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayibor/f99485c36b76faacffd2 to your computer and use it in GitHub Desktop.
Save nayibor/f99485c36b76faacffd2 to your computer and use it in GitHub Desktop.
error with response code
both queries below are in the context of a transaction done
$dataSourceProduct->begin($this->Product);
which sends a start transaction to the database in the mysql logs
START TRANSACTION
---first query
can see query in mysql logs being sent to server
runs well and returns an array so i can check number of resultset below
$prequery="SELECT id,stock_available FROM products WHERE (id = '18' and stock_available >= '2')or (id = '23' and stock_available >= '1') FOR UPDATE"
$response = $this->Product->query($prequery);
if (sizeof($response) < sizeof($products_data)) {
return false;
etc......
---second query
can see query in mysql logs being sent to server
but returns an empty array instead of a Boolean which i can use to check below
$insert_product="UPDATE products SET stock_available = CASE WHEN id = '18' THEN '276' WHEN id = '23' THEN '129' END WHERE id IN (18,23)"
$this->Product->query($insert_product)
if ($this->Product->query($insert_product)) {
etc.....
but second one doesnt return anything .
note that this works perfectly in cake 1.3 but in cake 2.6.7 empty array is returned ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment