~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 17:35:06 UTC
  • Revision ID: brian@tangent.org-20081006173506-799lz31igxfrqb9a
Removed dead bit around SP/Triggers

Show diffs side-by-side

added added

removed removed

Lines of Context:
954
954
  assert(thd->transaction.stmt.ha_list == NULL ||
955
955
              trans == &thd->transaction.stmt);
956
956
 
957
 
  if (thd->in_sub_stmt)
958
 
  {
959
 
    /*
960
 
      Since we don't support nested statement transactions in 5.0,
961
 
      we can't commit or rollback stmt transactions while we are inside
962
 
      stored functions or triggers. So we simply do nothing now.
963
 
      TODO: This should be fixed in later ( >= 5.1) releases.
964
 
    */
965
 
    if (!all)
966
 
      return(0);
967
 
    /*
968
 
      We assume that all statements which commit or rollback main transaction
969
 
      are prohibited inside of stored functions or triggers. So they should
970
 
      bail out with error even before ha_commit_trans() call. To be 100% safe
971
 
      let us throw error in non-debug builds.
972
 
    */
973
 
    assert(0);
974
 
    my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
975
 
    return(2);
976
 
  }
977
957
  if (ha_info)
978
958
  {
979
959
    bool must_2pc;
1092
1072
  assert(thd->transaction.stmt.ha_list == NULL ||
1093
1073
              trans == &thd->transaction.stmt);
1094
1074
 
1095
 
  if (thd->in_sub_stmt)
1096
 
  {
1097
 
    /*
1098
 
      If we are inside stored function or trigger we should not commit or
1099
 
      rollback current statement transaction. See comment in ha_commit_trans()
1100
 
      call for more information.
1101
 
    */
1102
 
    if (!all)
1103
 
      return(0);
1104
 
    assert(0);
1105
 
    my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
1106
 
    return(1);
1107
 
  }
1108
1075
  if (ha_info)
1109
1076
  {
1110
1077
    for (; ha_info; ha_info= ha_info_next)
1173
1140
    else 
1174
1141
    {
1175
1142
      (void) ha_rollback_trans(thd, 0);
1176
 
      if (thd->transaction_rollback_request && !thd->in_sub_stmt)
 
1143
      if (thd->transaction_rollback_request)
1177
1144
        (void) ha_rollback(thd);
1178
1145
    }
1179
1146
 
1454
1421
int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
1455
1422
{
1456
1423
  int error=0;
1457
 
  THD_TRANS *trans= (thd->in_sub_stmt ? &thd->transaction.stmt :
1458
 
                                        &thd->transaction.all);
 
1424
  THD_TRANS *trans= &thd->transaction.all;
1459
1425
  Ha_trx_info *ha_info, *ha_info_next;
1460
1426
 
1461
1427
  trans->no_2pc=0;
1487
1453
  {
1488
1454
    int err;
1489
1455
    handlerton *ht= ha_info->ht();
1490
 
    if ((err= ht->rollback(ht, thd, !thd->in_sub_stmt)))
 
1456
    if ((err= ht->rollback(ht, thd, !(0))))
1491
1457
    { // cannot happen
1492
1458
      my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
1493
1459
      error=1;
1509
1475
int ha_savepoint(THD *thd, SAVEPOINT *sv)
1510
1476
{
1511
1477
  int error=0;
1512
 
  THD_TRANS *trans= (thd->in_sub_stmt ? &thd->transaction.stmt :
1513
 
                                        &thd->transaction.all);
 
1478
  THD_TRANS *trans= &thd->transaction.all;
1514
1479
  Ha_trx_info *ha_info= trans->ha_list;
1515
1480
  for (; ha_info; ha_info= ha_info->next())
1516
1481
  {