8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 19:23:03 +01:00

Fixed CORE-1318 - Error "Identifier ... is too long using multiple (nested) derived tables.

Front-ported fix done by Alex in 2.0.
This commit is contained in:
asfernandes 2007-06-13 01:53:00 +00:00
parent fd29f7fb1c
commit 0f4663dc1a
3 changed files with 34 additions and 5 deletions

View File

@ -4488,7 +4488,8 @@ static void pass1_source(thread_db* tdbb,
size_t pos;
if (ctx.find(key, pos)) {
element->csb_alias = FB_NEW(csb->csb_pool)
Firebird::MetaName(csb->csb_pool, ctx[pos].vcx_context_name);
Firebird::string(csb->csb_pool, ctx[pos].vcx_context_name.c_str(),
ctx[pos].vcx_context_name.length());
}
}

View File

@ -825,7 +825,7 @@ public:
USHORT csb_indices; /* Number of indices */
jrd_rel* csb_relation;
Firebird::MetaName* csb_alias; /* SQL alias name for this instance of relation */
Firebird::string* csb_alias; /* SQL alias name for this instance of relation */
jrd_prc* csb_procedure;
jrd_rel* csb_view; /* parent view */

View File

@ -107,6 +107,7 @@ static jrd_nod* par_map(thread_db*, CompilerScratch*, USHORT);
static jrd_nod* par_message(thread_db*, CompilerScratch*);
static jrd_nod* par_modify(thread_db*, CompilerScratch*, SSHORT);
static USHORT par_name(CompilerScratch*, Firebird::MetaName&);
static size_t par_name(CompilerScratch* csb, Firebird::string& name);
static jrd_nod* par_plan(thread_db*, CompilerScratch*);
static jrd_nod* par_procedure(thread_db*, CompilerScratch*, SSHORT);
static void par_procedure_parms(thread_db*, CompilerScratch*, jrd_prc*, jrd_nod**,
@ -1731,6 +1732,33 @@ static USHORT par_name(CompilerScratch* csb, Firebird::MetaName& name)
}
static size_t par_name(CompilerScratch* csb, Firebird::string& name)
{
/**************************************
*
* p a r _ n a m e
*
**************************************
*
* Functional description
* Parse a counted string of virtually unlimited size
* (up to 64K), returning count.
*
**************************************/
size_t l = BLR_BYTE;
name.assign(l, ' ');
char* s = name.begin();
while (l--)
{
*s++ = BLR_BYTE;
}
return name.length();
}
static jrd_nod* par_plan(thread_db* tdbb, CompilerScratch* csb)
{
/**************************************
@ -2153,11 +2181,11 @@ static jrd_nod* par_relation(
/* Find relation either by id or by name */
jrd_rel* relation = 0;
Firebird::MetaName* alias_string = 0;
Firebird::string* alias_string = 0;
if (blr_operator == blr_rid || blr_operator == blr_rid2) {
const SSHORT id = BLR_WORD;
if (blr_operator == blr_rid2) {
alias_string = FB_NEW(csb->csb_pool) Firebird::MetaName(csb->csb_pool);
alias_string = FB_NEW(csb->csb_pool) Firebird::string(csb->csb_pool);
par_name(csb, *alias_string);
}
if (!(relation = MET_lookup_relation_id(tdbb, id, false))) {
@ -2168,7 +2196,7 @@ static jrd_nod* par_relation(
else if (blr_operator == blr_relation || blr_operator == blr_relation2) {
par_name(csb, name);
if (blr_operator == blr_relation2) {
alias_string = FB_NEW(csb->csb_pool) Firebird::MetaName(csb->csb_pool);
alias_string = FB_NEW(csb->csb_pool) Firebird::string(csb->csb_pool);
par_name(csb, *alias_string);
}
if (!(relation = MET_lookup_relation(tdbb, name)))