~ubuntu-branches/ubuntu/raring/firebird2.5/raring-proposed

« back to all changes in this revision

Viewing changes to src/jrd/par.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2011-09-24 14:12:19 UTC
  • mfrom: (15.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110924141219-pkxk7486f3d8ut9f
Tags: 2.5.1.26349-0~rc1.ds4-5
* Medium urgency for fixing a serious bug in testing

* Import a patch from upstream SVN fixing problems in poll() usage when
  process receives signals like SIGALRM.
  Closes: #642555 -- segfault in the remote interface when using alarm() in
  the client program

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
 
113
113
 
114
114
jrd_nod* PAR_blr(thread_db* tdbb, jrd_rel* relation, const UCHAR* blr, ULONG blr_length,
115
 
        CompilerScratch* view_csb, CompilerScratch** csb_ptr, jrd_req** request_ptr,
 
115
        CompilerScratch* view_csb, AutoPtr<CompilerScratch>& csb, jrd_req** request_ptr,
116
116
        const bool trigger, USHORT flags)
117
117
{
118
118
/**************************************
134
134
        fb_print_blr(blr, blr_length, gds__trace_printer, 0, 0);
135
135
#endif
136
136
 
137
 
        CompilerScratch* csb;
138
 
        if (!(csb_ptr && (csb = *csb_ptr))) {
 
137
        if (!csb) {
139
138
                size_t count = 5;
140
139
                if (view_csb)
141
140
                        count += view_csb->csb_rpt.getCapacity();
142
 
                csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), count);
 
141
                csb.reset(CompilerScratch::newCsb(*tdbb->getDatabase()->dbb_permanent, count));
143
142
                csb->csb_g_flags |= flags;
144
143
        }
145
144
 
208
207
        if (request_ptr)
209
208
                *request_ptr = CMP_make_request(tdbb, csb, true);
210
209
 
211
 
        if (csb_ptr)
212
 
                *csb_ptr = csb;
213
 
        else
214
 
                delete csb;
215
 
 
216
210
        return node;
217
211
}
218
212
 
219
213
 
 
214
jrd_nod* PAR_blr(thread_db* tdbb, jrd_rel* relation, const UCHAR* blr, ULONG blr_length,
 
215
        CompilerScratch* view_csb, jrd_req** request_ptr, const bool trigger, USHORT flags)
 
216
{
 
217
/**************************************
 
218
 *
 
219
 *      P A R _ b l r
 
220
 *
 
221
 **************************************
 
222
 *
 
223
 * Functional description
 
224
 *      Parse blr.
 
225
 *      Caller must do pool handling.
 
226
 *
 
227
 **************************************/
 
228
        Firebird::AutoPtr<Jrd::CompilerScratch> csb;
 
229
        return PAR_blr(tdbb, relation, blr, blr_length, view_csb, csb, request_ptr, trigger, flags);
 
230
}
 
231
 
 
232
 
220
233
USHORT PAR_desc(thread_db* tdbb, CompilerScratch* csb, DSC* desc, ItemInfo* itemInfo)
221
234
{
222
235
/**************************************
554
567
        jrd_prc* procedure = csb->csb_rpt[stream].csb_procedure;
555
568
 
556
569
        const SSHORT id = procedure ? find_proc_field(procedure, base_field) :
557
 
                MET_lookup_field (tdbb, csb->csb_rpt[stream].csb_relation, base_field, 0);
 
570
                MET_lookup_field (tdbb, csb->csb_rpt[stream].csb_relation, base_field);
558
571
 
559
572
        if (id < 0)
560
573
                return NULL;
672
685
}
673
686
 
674
687
 
675
 
CompilerScratch* PAR_parse(thread_db* tdbb, const UCHAR* blr, ULONG blr_length,
 
688
void PAR_parse(thread_db* tdbb, AutoPtr<CompilerScratch>& csb, const UCHAR* blr, ULONG blr_length,
676
689
        bool internal_flag, USHORT dbginfo_length, const UCHAR* dbginfo)
677
690
{
678
691
/**************************************
687
700
 **************************************/
688
701
        SET_TDBB(tdbb);
689
702
 
690
 
        CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
 
703
        csb.reset(CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5));
691
704
        csb->csb_blr_reader = BlrReader(blr, blr_length);
692
705
 
693
706
        if (internal_flag)
715
728
        {
716
729
                PAR_syntax_error(csb, "end_of_command");
717
730
        }
718
 
 
719
 
        return csb;
720
731
}
721
732
 
722
733
 
1337
1348
                        }
1338
1349
 
1339
1350
                        par_name(csb, name);
1340
 
                        if ((id = MET_lookup_field(tdbb, relation, name.c_str(), 0)) < 0)
 
1351
                        if ((id = MET_lookup_field(tdbb, relation, name)) < 0)
1341
1352
                        {
1342
1353
                                if (csb->csb_g_flags & csb_validation) {
1343
1354
                                        id = 0;
3119
3130
                        Firebird::MetaName name;
3120
3131
 
3121
3132
                        par_name(csb, name);
3122
 
                        const SLONG tmp = MET_lookup_generator(tdbb, name.c_str());
 
3133
                        const SLONG tmp = MET_lookup_generator(tdbb, name);
3123
3134
                        if (tmp < 0) {
3124
3135
                                error(csb, Arg::Gds(isc_gennotdef) << Arg::Str(name));
3125
3136
                        }
3126
 
                        node->nod_arg[e_gen_relation] = (jrd_nod*) (IPTR) tmp;
 
3137
                        node->nod_arg[e_gen_id] = (jrd_nod*) (IPTR) tmp;
3127
3138
                        node->nod_arg[e_gen_value] = PAR_parse_node(tdbb, csb, VALUE);
3128
3139
 
3129
3140
            /* CVC: There're thousand ways to go wrong, but I don't see any value