title: Catch mysql *warning* (not exception) while using Laravel DB Builder?
body: <p>I have a BIGINT field, and for testing I maxxed out the field and then tried to add even more. The following code returns successful without throwing an \Exception, but it is throwing a warning in an sql query and, obviously, not updating the field. How can I catch a warning and return the warning message that the field is at its maximum? <em>(As you can see I have tried both a DB::transaction and a try/catch without success).</em></p>
  
  <pre><code>        try {
              DB::transaction(function () use ($data, $quantity) {
                  $query = 'INSERT INTO item_user (user_id, item_id, quantity) VALUES '.substr($data,0,-2).' ON DUPLICATE KEY UPDATE quantity = GREATEST(`quantity` + '.$quantity.',0)';
                  DB::statement($query);
  
                  // subquery to delete any rows left with zero
                  DB::table('item_user')-&gt;where('quantity',0)-&gt;delete();
              });
  
              return redirect()-&gt;route('index')
                  -&gt;with( ['flash' =&gt; ['message' =&gt;"&lt;i class='fa fa-check-square-o fa-1x'&gt;&lt;/i&gt; Success! Item totals updated.", 'level' =&gt;  "success"] ] );
  
          } catch (\Exception $e) {
  
              return redirect()-&gt;back()-&gt;withErrors( $e-&gt;getMessage() )-&gt;withInput();
          }
  </code></pre>
  
  <p>This returns successful on the page but capturing and running the query directly on SQL gets me the warning and number :</p>
  
  <pre><code>Warning Code : 1264
  Out of range value for column 'quantity' at row 1
  </code></pre>
  
  <p>Thanks.</p>