Yes, synonyms are very much like views.
Attached is a hacky diff to do synonyms (but not links).
I can't do links here, so I can't test it.
We have Kerberos here and I couldn't figure out how to
properly support a user schema like "[EMAIL PROTECTED]"

Assuming these are merged together, I don't know which
goes first, the synonym or the view and whether they should
iterate until they land on a table. They should probably
follow the Oracle rules, I suppose.

Tim Bunce wrote:
> 
> Sherry, it's your lucky day.
> 
> Thanks to John's message I found the patch that Tom Moore sent me
> (thanks Tom). It only applies to views but it should be fairly obvious
> how to extend it to synonyms (or you could just setup a view that
> refers to the synonym).
> 
> Volunteers are most welcome to polish up the patch to be more general
> (eg synonyms) and send me back a diff -c output. Thanks!
> 
> Tim.
> 
> On Wed, Apr 11, 2001 at 04:31:47PM -0500, John Milton wrote:
> >
> > I'm finding little bits and pieces of people having problems
> > with this, and I would rather use a patch than the risk
> > associated with implementing the fix myself.
> >
> > I found a very obscure reference from you here, second message:
> >
> > http://www.webclub.ru/confarchive/6269.html:
> >
> > >>> If you are working with a table in another user's schema, you need to
> > >>> include that other user's name as part of specifying the table name (e.g.,
> > >>> owner.Good_picture). This can be avoided if a synonym has been
> > >>> defined for the table name, but that doesn't appear to be the case in your
> > >>> database.
> > >> I use public synonyms for tables and sequencies.
> > >
> > >Known bug. Patch is in the archives. Nag me if you really can't find it.
> > >
> > >Tim Bunce.
> >
> > Which archives?
> > Is this the patch I'm looking for?
> >
> >
> > If not, then is this approach correct:
> >
> > In oci8.c, in init_lob_refetch, before the existing
> > OCIDescribeAny_log_stat, I would first attempt to describe
> > a synonym by the same name and then construct a fully
> > qualified tablename and continue.

John
-- 
John Bly Milton IV   (512) w:493-2764, h:873-8567, m:791-8567
FundsXpress  [EMAIL PROTECTED]  Don't FLAME, inform!  O-
*** oci8.c      2000/11/14 18:44:24     1.2
--- oci8.c      2001/04/12 01:28:43
***************
*** 1204,1209 ****
--- 1204,1210 ----
      lob_refetch_t *lr = NULL;
      STRLEN tablename_len;
      char *tablename;
+     char new_tablename[100];
  
      switch (imp_sth->stmt_type) {
      case OCI_STMT_UPDATE:
***************
*** 1223,1228 ****
--- 1224,1248 ----
                "Unable to parse table name for LOB refetch");
  
      OCIHandleAlloc_ok(imp_sth->envhp, &dschp, OCI_HTYPE_DESCRIBE, status);
+     /* BEGIN NEW */
+     OCIDescribeAny_log_stat(imp_sth->svchp, errhp, tablename, strlen(tablename),
+               OCI_OTYPE_NAME, 1, OCI_PTYPE_SYN, dschp, status);
+     if (status == OCI_SUCCESS) { /* There is a synonym, get the schema */
+       char *syn_schema=NULL,  *syn_name=NULL;
+       OCIAttrGet_log_stat(dschp,  OCI_HTYPE_DESCRIBE,
+                                 &parmhp, 0, OCI_ATTR_PARAM, errhp, status);
+       OCIAttrGet_log_stat(parmhp, OCI_DTYPE_PARAM,
+                         &syn_schema, 0, OCI_ATTR_SCHEMA_NAME, errhp, status);
+       OCIAttrGet_log_stat(parmhp, OCI_DTYPE_PARAM,
+                         &syn_name, 0, OCI_ATTR_OBJ_NAME, errhp, status);
+       strcpy(new_tablename, syn_schema);
+       strcat(new_tablename, ".");
+       strcat(new_tablename, syn_name);
+       tablename=new_tablename;
+       if (DBIS->debug >= 3)
+       fprintf(DBILOGFP, "       lob refetch synonym, schema=%s, name=%s, new 
+tablename=%s\n", syn_schema, syn_name, tablename);
+     }
+     /* END NEW */
      OCIDescribeAny_log_stat(imp_sth->svchp, errhp, tablename, strlen(tablename),
                OCI_OTYPE_NAME, 1, OCI_PTYPE_TABLE, dschp, status);
      if (status != OCI_SUCCESS) {

S/MIME Cryptographic Signature

Reply via email to