title: No PDO Error, but transaction fails (properly)
body: <p>I have a table with a constraint that prevents some combinations of variables from being inserted, however, when I execute insert with bad values from inside transaction, the insert fails (as it should), but the <code>PDOException</code> isn't raised. In fact, the transaction acts as if it committed successfully, however the following select shows that the values weren't inserted (just for the record, the correct combination of values are inserted using the same function). What is going wrong?</p>
  
  <p>Below is the offending function. <code>db_SqlSrv::pdo()</code> creates and returns a new instance of <code>PDO</code>, I'm using sqlsrv drivers.</p>
  
  <pre><code>/**
   * Inserts number of rules into &lt;code&gt;menu_availability&lt;/code&gt; table.
   * The expected format for rules is:
   * &lt;code&gt;[{ menu_id: int,
   *          start: timestring,
   *          end: timestring,
   *          weekly: 0..6,
   *          once: datestring }, ...]&lt;/code&gt;
   */
  public static function addRules() {
      $rules = web_Util::getRequestParam('rules', 'json');
      if ($rules !== null) {
          $pdo = db_SqlSrv::pdo();
          try {
              $pdo-&gt;beginTransaction();
              foreach ($rules as $rule) {
                  $statement = $pdo-&gt;prepare(
                      "insert into menu_availability
                       (menu_id, daily_serving_start, daily_serving_end,
                       weekly_service_off, one_time_service_off)
                       values (?, ?, ?, ?, ?)");
                  $statement-&gt;bindParam(1, $rule-&gt;menu_id, PDO::PARAM_INT);
                  if ($rule-&gt;start) {
                      $statement-&gt;bindParam(2, $rule-&gt;start, PDO::PARAM_STR);
                      $statement-&gt;bindParam(3, $rule-&gt;end, PDO::PARAM_STR);
                  } else {
                        // This feels kind of stupid...
                      $rule-&gt;start = null;
                      $rule-&gt;end = null;
                      $statement-&gt;bindParam(2, $rule-&gt;start, PDO::PARAM_NULL);
                      $statement-&gt;bindParam(3, $rule-&gt;end, PDO::PARAM_NULL);
                  }
                  $statement-&gt;bindParam(4, $rule-&gt;weekly, PDO::PARAM_INT);
                  $statement-&gt;bindParam(5, $rule-&gt;once, PDO::PARAM_STR);
                  $statement-&gt;execute();
              }
              $pdo-&gt;commit();
          } catch (PDOException $e) {
              $pdo-&gt;rollBack();
              throw $e;
          }
      }
      return true;
  }
  </code></pre>
  
  <p>This is how the table is defined:</p>
  
  <pre class="lang-sql prettyprint-override"><code>if not exists (select * from sysobjects where name = 'menu_availability' and xtype = 'U')
  create table menu_availability
     (menu_id int not null,
      daily_serving_start time(0) null,
      daily_serving_end time(0) null,
      weekly_service_off tinyint null,
      one_time_service_off date null,
      sn as case
         when ((daily_serving_start is null
                and daily_serving_end is null)
               and ((weekly_service_off is not null and one_time_service_off is null)
                    or (one_time_service_off is not null and weekly_service_off is null)))
              or
              ((daily_serving_start is not null
                and daily_serving_end is not null)
               and (one_time_service_off is null
                    or weekly_service_off is null))
               then cast(1 as bit)
          end persisted not null,
      constraint ch_valid_week_day
      check ((weekly_service_off is null)
          or (weekly_service_off &lt;= 6 and weekly_service_off &gt;= 0)));
  </code></pre>
  
  <p>Example data that should trigger constraint restriction:</p>
  
  <pre><code>{"menu_id":"18283","start":"","end":"","weekly":3,"once":"16-01-1901"}
  </code></pre>
  
  <p><em>(it's illegal to give both <code>weekly</code> and <code>once</code>)</em></p>