Re: DatabaseMetaData.java patch (7.1.3)

Поиск
Список
Период
Сортировка
От Barry Lind
Тема Re: DatabaseMetaData.java patch (7.1.3)
Дата
Msg-id 3C43ADD9.4060308@xythos.com
обсуждение исходный текст
Ответ на DatabaseMetaData.java patch (7.1.3)  ("Ed Yu" <ekyu@sc.rr.com>)
Список pgsql-jdbc
Ed,

Did you look at current CVS before submitting this patch?  If you had
you would have seen that the null pointer exception problem is already
fixed in current CVS.

The other fix you have done here (properly recognize underscore wildcard
in getTables()), I don't see how it was broken, or what your fix fixes.
  The old code used like and therefore supported underscore wildcards.
So I don't see what your change fixed.

So in summary, I don't see anything in this patch that needs to be applied.

thanks,
--Barry




Ed Yu wrote:

> This patch fixes the null pointer exception when returning the data row for
> a view. Also, this fixes the table schema argument to the getTable() method
> to properly recognize the underscore as a wildcard expression.
>
> *** DatabaseMetaData.java.orig Fri Feb 16 11:45:00 2001
> --- DatabaseMetaData.java Sun Jan 13 21:19:07 2002
> ***************
> *** 1635,1641 ****
>       if(types==null)
>         types = defaultTableTypes;
>
> !     if(tableNamePattern==null)
>         tableNamePattern="%";
>
>       // the field descriptors for the new ResultSet
> --- 1635,1641 ----
>       if(types==null)
>         types = defaultTableTypes;
>
> !     if((tableNamePattern==null) || (tableNamePattern.length()==0))
>         tableNamePattern="%";
>
>       // the field descriptors for the new ResultSet
> ***************
> *** 1663,1672 ****
>       }
>
>       // Added by Stefan Andreasen <stefan@linux.kapow.dk>
>       // Now take the pattern into account
> !     sql.append(") and relname like '");
> !     sql.append(tableNamePattern.toLowerCase());
> !     sql.append("'");
>
>       // Now run the query
>       r = connection.ExecSQL(sql.toString());
> --- 1663,1677 ----
>       }
>
>       // Added by Stefan Andreasen <stefan@linux.kapow.dk>
> +     // Modified by Ed Yu <ekyu@asgnet.psc.sc.edu>
>       // Now take the pattern into account
> !     sql.append(") and relname");
> !     if ((tableNamePattern.indexOf("%") >= 0) ||
> !             (tableNamePattern.indexOf("_") >= 0))
> !         sql.append(" like ");
> !     else
> !         sql.append(" = ");
> !     sql.append("'" + tableNamePattern.toLowerCase() + "'");
>
>       // Now run the query
>       r = connection.ExecSQL(sql.toString());
> ***************
> *** 1686,1691 ****
> --- 1691,1698 ----
>      remarks = defaultRemarks;
>    dr.close();
>
> +  // JDBC definition for TABLE_TYPE - "TABLE", "VIEW", "SYSTEM TABLE",
> +  // "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
>    String relKind;
>    switch (r.getBytes(3)[0]) {
>    case 'r':
> ***************
> *** 1697,1702 ****
> --- 1704,1712 ----
>    case 'S':
>        relKind = "SEQUENCE";
>        break;
> +  case 'v':
> +             relKind = "VIEW";
> +             break;
>    default:
>        relKind = null;
>    }
> ***************
> *** 1704,1710 ****
>    tuple[0] = null;  // Catalog name
>    tuple[1] = null;  // Schema name
>    tuple[2] = r.getBytes(1); // Table name
> !  tuple[3] = relKind.getBytes(); // Table type
>    tuple[4] = remarks;  // Remarks
>    v.addElement(tuple);
>         }
> --- 1714,1728 ----
>    tuple[0] = null;  // Catalog name
>    tuple[1] = null;  // Schema name
>    tuple[2] = r.getBytes(1); // Table name
> !
> !  // Added by Ed Yu <ekyu@asgnet.psc.sc.edu>
> !  // Fix NullPointerException if return type is not handled in the
> !  // above switch statement.
> !  if (relKind==null)
> !   tuple[3] = null;
> !  else
> !   tuple[3] = relKind.getBytes(); // Table type
> !
>    tuple[4] = remarks;  // Remarks
>    v.addElement(tuple);
>         }
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: CVS problems?
Следующее
От: Barry Lind
Дата:
Сообщение: Re: FW: LISTEN/NOTIFY support in JDBC driver?