Subject | Re: [firebird-support] Modified code - multi connection Meta data update |
---|---|
Author | karthick srini |
Post date | 2004-09-24T09:35:51Z |
Hi members ,
Since forum is not accpting the attachment I have
pasted the snippet of the code.
File is "/jrd/dfw.cpp"
/* Actually create the index */
//<multi connection meta data handling - start>
int i2,i1;
partner_relation = (JRD_REL) NULL_PTR;
if (idx.idx_flags & idx_foreign)
{
/* Get an exclusive lock on the database if the
index being
defined enforces a foreign key constraint. This
will prevent
the constraint from being violated during index
construction. */
i1=MET_lookup_partner(tdbb,
relation, &idx, (UCHAR*) work->dfw_name);
partner_relation =
MET_lookup_relation_id(tdbb,idx.idx_primary_relation,TRUE);
i2 = CCH_exclusive(tdbb, LCK_EX,
LCK_NO_WAIT);
//<multi connection meta data handling>
//error is not created even there is
multi connection
/* if (MET_lookup_partner(tdbb, relation,
&idx, (UCHAR*) work->dfw_name) &&
(partner_relation =
MET_lookup_relation_id( tdbb,
idx.idx_primary_relation,
TRUE))
&& !CCH_exclusive(tdbb,
LCK_EX, LCK_NO_WAIT))
{
ERR_post(gds_no_meta_update,
gds_arg_gds, gds_obj_in_use,
gds_arg_string,
partner_relation->rel_name,
0);
*/
/* CVC: Currently, the server doesn't enforce FK
creation more than at DYN level.
If DYN is bypassed, then FK creation succeeds and
operation will fail at run-time.
The aim is to check REFERENCES at DDL time instead
of DML time and behave accordingly
to ANSI SQL rules for REFERENCES rights.
For testing purposes, I'm calling SCL_check_index,
although most of the DFW ops are
carried using internal metadata structures that
are refreshed from system tables. */
/*if (partner_relation)
{*/
/* Don't bother if the master's owner is the same
than the detail's owner.
If both tables aren't defined in the same
session, partner_relation->rel_owner_name
won't be loaded hence, we need to be careful
about null pointers. */
/*if (!relation->rel_owner_name ||
!partner_relation->rel_owner_name
|| strcmp(relation->rel_owner_name,
partner_relation->rel_owner_name))
SCL_check_index(tdbb,
partner_relation->rel_name, idx.idx_id + 1,
SCL_sql_references);
}
}*/
//<multi connection meta data handling - END>
}
--- karthick srini <kartinku@...> wrote:
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
Since forum is not accpting the attachment I have
pasted the snippet of the code.
File is "/jrd/dfw.cpp"
/* Actually create the index */
//<multi connection meta data handling - start>
int i2,i1;
partner_relation = (JRD_REL) NULL_PTR;
if (idx.idx_flags & idx_foreign)
{
/* Get an exclusive lock on the database if the
index being
defined enforces a foreign key constraint. This
will prevent
the constraint from being violated during index
construction. */
i1=MET_lookup_partner(tdbb,
relation, &idx, (UCHAR*) work->dfw_name);
partner_relation =
MET_lookup_relation_id(tdbb,idx.idx_primary_relation,TRUE);
i2 = CCH_exclusive(tdbb, LCK_EX,
LCK_NO_WAIT);
//<multi connection meta data handling>
//error is not created even there is
multi connection
/* if (MET_lookup_partner(tdbb, relation,
&idx, (UCHAR*) work->dfw_name) &&
(partner_relation =
MET_lookup_relation_id( tdbb,
idx.idx_primary_relation,
TRUE))
&& !CCH_exclusive(tdbb,
LCK_EX, LCK_NO_WAIT))
{
ERR_post(gds_no_meta_update,
gds_arg_gds, gds_obj_in_use,
gds_arg_string,
partner_relation->rel_name,
0);
*/
/* CVC: Currently, the server doesn't enforce FK
creation more than at DYN level.
If DYN is bypassed, then FK creation succeeds and
operation will fail at run-time.
The aim is to check REFERENCES at DDL time instead
of DML time and behave accordingly
to ANSI SQL rules for REFERENCES rights.
For testing purposes, I'm calling SCL_check_index,
although most of the DFW ops are
carried using internal metadata structures that
are refreshed from system tables. */
/*if (partner_relation)
{*/
/* Don't bother if the master's owner is the same
than the detail's owner.
If both tables aren't defined in the same
session, partner_relation->rel_owner_name
won't be loaded hence, we need to be careful
about null pointers. */
/*if (!relation->rel_owner_name ||
!partner_relation->rel_owner_name
|| strcmp(relation->rel_owner_name,
partner_relation->rel_owner_name))
SCL_check_index(tdbb,
partner_relation->rel_name, idx.idx_id + 1,
SCL_sql_references);
}
}*/
//<multi connection meta data handling - END>
}
--- karthick srini <kartinku@...> wrote:
> Hi members,__________________________________
> In my previous mail attachment has not come (but it
> there in my sent folder) So I am attaching the file
> again for your reference,
>
> S.Karthick
> --- karthick srini <kartinku@...> wrote:
>
> > Hi Members ,
> >
> > This is regarding "Create Table with foreign
> Key"
> > when there are more than one connection.
> > I have debugged firebird code and commented
> where
> > exclusive connection check is made. Then with
> > firebird I was able to create table with FK in
> > multiple connection. Herewith I have attached the
> > modified file. Find my changes with in the comment
> > "<multi connection meta data handling>".
> > In the file there is a firebird comment saying
> that
> > exclusive connection is got to create index
> > properly.
> > Even when I commented the code getting exclusive
> > connection check , index gets created properly
> when
> > I
> > work on multiple connection. Index get created
> even
> > for primarky key. But exclsive connection check
> is
> > made only for foreign key based index. So please
> do
> > let me know what is the significance in getting
> > exclusive connection for foreign key based index
> > alone.
> >
> > Thanks & regards,
> >
> > S.Karthick
> > Software Engineer
> >
> > Note: forwarded message attached.
> >
> >
> >
> > _______________________________
> > Do you Yahoo!?
> > Declare Yourself - Register online to vote today!
> > http://vote.yahoo.com
> >
> > [Non-text portions of this message have been
> > removed]
> >
> >
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>
> [Non-text portions of this message have been
> removed]
>
>
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail