~pbxt-engineers/pbxt/pbxt-conditional-crash

« back to all changes in this revision

Viewing changes to src/datadic_xt.cc

  • Committer: Paul McCullagh
  • Date: 2010-02-05 08:17:33 UTC
  • Revision ID: paul.mccullagh@primebase.org-20100205081733-gy8ap56rzz2byrhw
Fixed a bug that could cause a crash in filesort

Show diffs side-by-side

added added

removed removed

Lines of Context:
2027
2027
void XTDDTableRef::deleteAllRows(XTThreadPtr self)
2028
2028
{
2029
2029
        XTOpenTablePtr  ot;
2030
 
        xtInt8                  row_count;
 
2030
        xtBool                  eof;
 
2031
        xtWord1                 *buffer;
2031
2032
 
2032
2033
        if (!tr_fkey->getReferenceIndexPtr())
2033
 
                throw_();
 
2034
                xt_throw(self);
2034
2035
 
2035
2036
        if (!tr_fkey->getIndexPtr())
2036
 
                throw_();
 
2037
                xt_throw(self);
2037
2038
 
2038
2039
        if (!(ot = xt_db_open_table_using_tab(tr_fkey->co_table->dt_table, self)))
2039
 
                throw_();
 
2040
                xt_throw(self);
2040
2041
 
 
2042
        /* {FREE-ROWS-BAD} */
 
2043
        /*
2041
2044
        row_count = ((xtInt8) ot->ot_table->tab_row_eof_id) - 1;
2042
2045
        row_count -= (xtInt8) ot->ot_table->tab_row_fnum;
 
2046
        */
 
2047
        /* Check if there are any rows in the referencing table: */
 
2048
        if (!xt_tab_seq_init(ot))
 
2049
                goto failed;
 
2050
 
 
2051
        if (!(buffer = (xtWord1 *) xt_malloc(self, ot->ot_table->tab_dic.dic_mysql_buf_size)))
 
2052
                goto failed_1;
 
2053
 
 
2054
        if (!xt_tab_seq_next(ot, buffer, &eof))
 
2055
                goto failed_2;
 
2056
 
 
2057
        xt_free(self, buffer);
 
2058
 
 
2059
        xt_tab_seq_exit(ot);
2043
2060
 
2044
2061
        xt_db_return_table_to_pool_ns(ot);
2045
2062
 
2046
 
        if (row_count > 0)
 
2063
        if (!eof)
2047
2064
                xt_throw_ixterr(XT_CONTEXT, XT_ERR_ROW_IS_REFERENCED, tr_fkey->co_name);
 
2065
        return;
 
2066
 
 
2067
        failed_2:
 
2068
        xt_free(self, buffer);
 
2069
 
 
2070
        failed_1:
 
2071
        xt_tab_seq_exit(ot);
 
2072
 
 
2073
        failed:
 
2074
        xt_db_return_table_to_pool_ns(ot);
 
2075
        xt_throw(self);
2048
2076
}
2049
2077
 
2050
2078
void  XTDDIndex::init(XTThreadPtr self, XTObject *obj)