~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Brian Aker
  • Date: 2010-10-20 15:22:36 UTC
  • mto: (1864.2.1 merge)
  • mto: This revision was merged to the branch mainline in revision 1864.
  • Revision ID: brian@tangent.org-20101020152236-6ejwgie7ljwufhj9
Remove a number of goto'. Also I removed the std::cerr that slipped in on
the schema identifier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1908
1908
    {
1909
1909
      share->resetVersion();                        // Mark share as old
1910
1910
      if (discover_retry_count++)               // Retry once
1911
 
        goto err;
 
1911
      {
 
1912
        TableShare::release(share);
 
1913
        return 1;
 
1914
      }
1912
1915
 
1913
1916
      /*
1914
1917
        TODO->
1930
1933
        using the share.
1931
1934
      */
1932
1935
      if (share->getTableCount() != 1)
1933
 
        goto err;
 
1936
      {
 
1937
        TableShare::release(share);
 
1938
        return 1;
 
1939
      }
1934
1940
      /* Free share and wait until it's released by all threads */
1935
1941
      TableShare::release(share);
1936
1942
 
1943
1949
      return 1;
1944
1950
    }
1945
1951
 
1946
 
    goto err;
 
1952
    TableShare::release(share);
 
1953
 
 
1954
    return 1;
1947
1955
  }
1948
1956
 
1949
1957
  return 0;
1950
 
 
1951
 
err:
1952
 
  TableShare::release(share);
1953
 
 
1954
 
  return 1;
1955
1958
}
1956
1959
 
1957
1960
 
3180
3183
    /* true if field_name_1 is a member of using_fields */
3181
3184
    bool is_using_column_1;
3182
3185
    if (!(nj_col_1= it_1.get_or_create_column_ref(leaf_1)))
3183
 
      goto err;
 
3186
      return(result);
3184
3187
    field_name_1= nj_col_1->name();
3185
3188
    is_using_column_1= using_fields &&
3186
3189
      test_if_string_in_list(field_name_1, using_fields);
3198
3201
      Natural_join_column *cur_nj_col_2;
3199
3202
      const char *cur_field_name_2;
3200
3203
      if (!(cur_nj_col_2= it_2.get_or_create_column_ref(leaf_2)))
3201
 
        goto err;
 
3204
        return(result);
3202
3205
      cur_field_name_2= cur_nj_col_2->name();
3203
3206
 
3204
3207
      /*
3218
3221
            (found && (!using_fields || is_using_column_1)))
3219
3222
        {
3220
3223
          my_error(ER_NON_UNIQ_ERROR, MYF(0), field_name_1, session->where);
3221
 
          goto err;
 
3224
          return(result);
3222
3225
        }
3223
3226
        nj_col_2= cur_nj_col_2;
3224
3227
        found= true;
3251
3254
      Item_func_eq *eq_cond;
3252
3255
 
3253
3256
      if (!item_1 || !item_2)
3254
 
        goto err;                               // out of memory
 
3257
        return(result); // out of memory
3255
3258
 
3256
3259
      /*
3257
3260
        In the case of no_wrap_view_item == 0, the created items must be
3276
3279
      */
3277
3280
      if (set_new_item_local_context(session, item_ident_1, nj_col_1->table_ref) ||
3278
3281
          set_new_item_local_context(session, item_ident_2, nj_col_2->table_ref))
3279
 
        goto err;
 
3282
        return(result);
3280
3283
 
3281
3284
      if (!(eq_cond= new Item_func_eq(item_ident_1, item_ident_2)))
3282
 
        goto err;                               /* Out of memory. */
 
3285
        return(result);                               /* Out of memory. */
3283
3286
 
3284
3287
      /*
3285
3288
        Add the new equi-join condition to the ON clause. Notice that
3325
3328
  */
3326
3329
  result= false;
3327
3330
 
3328
 
err:
3329
3331
  return(result);
3330
3332
}
3331
3333
 
3383
3385
 
3384
3386
  if (!(non_join_columns= new List<Natural_join_column>) ||
3385
3387
      !(natural_using_join->join_columns= new List<Natural_join_column>))
3386
 
    goto err;
 
3388
  {
 
3389
    return(result);
 
3390
  }
3387
3391
 
3388
3392
  /* Append the columns of the first join operand. */
3389
3393
  for (it_1.set(table_ref_1); !it_1.end_of_fields(); it_1.next())
3422
3426
        {
3423
3427
          my_error(ER_BAD_FIELD_ERROR, MYF(0), using_field_name_ptr,
3424
3428
                   session->where);
3425
 
          goto err;
 
3429
          return(result);
3426
3430
        }
3427
3431
        if (!my_strcasecmp(system_charset_info,
3428
3432
                           common_field->name(), using_field_name_ptr))
3450
3454
 
3451
3455
  result= false;
3452
3456
 
3453
 
err:
3454
3457
  return(result);
3455
3458
}
3456
3459
 
3536
3539
      if (cur_table_ref->getNestedJoin() &&
3537
3540
          store_top_level_join_columns(session, cur_table_ref,
3538
3541
                                       real_left_neighbor, real_right_neighbor))
3539
 
        goto err;
 
3542
        return(result);
3540
3543
      same_level_right_neighbor= cur_table_ref;
3541
3544
    }
3542
3545
  }
3568
3571
      std::swap(table_ref_1, table_ref_2);
3569
3572
    if (mark_common_columns(session, table_ref_1, table_ref_2,
3570
3573
                            using_fields, &found_using_fields))
3571
 
      goto err;
 
3574
      return(result);
3572
3575
 
3573
3576
    /*
3574
3577
      Swap the join operands back, so that we pick the columns of the second
3580
3583
    if (store_natural_using_join_columns(session, table_ref, table_ref_1,
3581
3584
                                         table_ref_2, using_fields,
3582
3585
                                         found_using_fields))
3583
 
      goto err;
 
3586
      return(result);
3584
3587
 
3585
3588
    /*
3586
3589
      Change NATURAL JOIN to JOIN ... ON. We do this for both operands
3613
3616
  }
3614
3617
  result= false; /* All is OK. */
3615
3618
 
3616
 
err:
3617
3619
  return(result);
3618
3620
}
3619
3621
 
4258
4260
    if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
4259
4261
    {
4260
4262
      my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
4261
 
      goto err;
 
4263
      if (table)
 
4264
        table->auto_increment_field_not_null= false;
 
4265
 
 
4266
      return true;
4262
4267
    }
4263
4268
  }
4264
4269
 
4265
4270
  return session->is_error();
4266
 
 
4267
 
err:
4268
 
  if (table)
4269
 
    table->auto_increment_field_not_null= false;
4270
 
 
4271
 
  return true;
4272
4271
}
4273
4272
 
4274
4273
 
4318
4317
    if (field == table->next_number_field)
4319
4318
      table->auto_increment_field_not_null= true;
4320
4319
    if (value->save_in_field(field, 0) < 0)
4321
 
      goto err;
 
4320
    {
 
4321
      if (table)
 
4322
        table->auto_increment_field_not_null= false;
 
4323
 
 
4324
      return true;
 
4325
    }
4322
4326
  }
4323
4327
 
4324
4328
  return(session->is_error());
4325
 
 
4326
 
err:
4327
 
  if (table)
4328
 
    table->auto_increment_field_not_null= false;
4329
 
 
4330
 
  return true;
4331
4329
}
4332
4330
 
4333
4331