Loading ...
Sorry, an error occurred while loading the content.

Re: bugs in DatabaseMetaData

Expand Messages
  • jmcraig@xmission.com
    Massimo, That s somewhat annoying that it works the way it does, isn t it? (I ve put some wrappers around most of the metadata queries I do to trim the strings
    Message 1 of 6 , Nov 3, 2001
    • 0 Attachment
      Massimo,
      That's somewhat annoying that it works the way it does, isn't it?
      (I've put some wrappers around most of the metadata queries I do to
      trim the strings and do some other stuff, but it does seem like a
      bother that could be easily handled in the driver.) However, the
      nature of a CHAR(31) column is that it gets blank-padded to the
      declared width, so the fact that it comes back with trailing blanks
      isn't so surprising. At least this is what I'd expect from my somewhat
      limited experience with other SQL DB's--mostly Sybase, some MS
      SQL--and almost none of this using JDBC.

      I'm curious to know if you've worked with other JDBC-driver/DB-engine
      combinations that had different behavior for a CHAR type column (as
      opposed to say VARCHAR).

      J M Craig

      --- In IB-Java@y..., Massimo Ferrari <massimo@r...> wrote:
      <snip>
      > But since RDB$FIELD_NAME is declared to be CHAR(31),
      > the ResultSet will
      > contain a 31 chars long String, even if the column
      > name is just e.g. 6 chars
      > long.
      > The specs just say that the ResultSet contains a
      > field COLUMN_NAME with the
      > name of the column, and IMHO it is a task of the
      > driver to trim the string
      > before it is returned.
      > The same problems applies to other fields (e.g.
      > TABLE_NAME in getTables).
      >
      > Massimo
    • Massimo Ferrari
      ... Yes, it is. ... the ... No it isn t, but from the user point of view, how meta data is stored in the database does not matter; what matters is the result.
      Message 2 of 6 , Nov 3, 2001
      • 0 Attachment
        > That's somewhat annoying that it works the way it does, isn't it?
        Yes, it is.

        > However, the nature of a CHAR(31) column is that it gets blank-padded to
        the
        > declared width, so the fact that it comes back with trailing blanks
        > isn't so surprising.
        No it isn't, but from the user point of view, how meta data is stored in the
        database does not matter;
        what matters is the result.
        The JDBC specs say that e.g. getTables -> "TABLE_NAME" should return
        the table name, i.e. the name I gave to the table, not a blank
        padded-string.

        > I'm curious to know if you've worked with other JDBC-driver/DB-engine
        > combinations that had different behavior for a CHAR type column (as
        > opposed to say VARCHAR).
        I worked with other dbs, and I never had problems with DatabaseMetaData.
        If I declare a field as CHAR(31), I expect to get a padded string, but if I
        query for the column name I expect to get exactly the real name, because it
        is meta data.
        BTW, this problem does not exist with InterClient.

        Massimo
      • David Jencks
        Ok, I think I fixed this one (tests work w/o trim) although the PRECISION named column is still a problem... david jencks
        Message 3 of 6 , Nov 3, 2001
        • 0 Attachment
          Ok, I think I fixed this one (tests work w/o trim) although the PRECISION
          named column is still a problem...

          david jencks

          On 2001.11.03 15:50:37 -0500 Massimo Ferrari wrote:
          > > That's somewhat annoying that it works the way it does, isn't it?
          > Yes, it is.
          >
          > > However, the nature of a CHAR(31) column is that it gets blank-padded
          > to
          > the
          > > declared width, so the fact that it comes back with trailing blanks
          > > isn't so surprising.
          > No it isn't, but from the user point of view, how meta data is stored in
          > the
          > database does not matter;
          > what matters is the result.
          > The JDBC specs say that e.g. getTables -> "TABLE_NAME" should return
          > the table name, i.e. the name I gave to the table, not a blank
          > padded-string.
          >
          > > I'm curious to know if you've worked with other JDBC-driver/DB-engine
          > > combinations that had different behavior for a CHAR type column (as
          > > opposed to say VARCHAR).
          > I worked with other dbs, and I never had problems with DatabaseMetaData.
          > If I declare a field as CHAR(31), I expect to get a padded string, but if
          > I
          > query for the column name I expect to get exactly the real name, because
          > it
          > is meta data.
          > BTW, this problem does not exist with InterClient.
          >
          > Massimo
          >
          >
          >
          >
          >
          >
          > To unsubscribe from this group, send an email to:
          > IB-Java-unsubscribe@egroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
          >
          >
          >
        • David Jencks
          And now I fixed the PRECISION at least for dialect 3.
          Message 4 of 6 , Nov 3, 2001
          • 0 Attachment
            And now I fixed the PRECISION at least for dialect 3.

            On 2001.11.04 00:51:59 -0500 David Jencks wrote:
            > Ok, I think I fixed this one (tests work w/o trim) although the PRECISION
            > named column is still a problem...
            >
            > david jencks
            >
            > On 2001.11.03 15:50:37 -0500 Massimo Ferrari wrote:
            > > > That's somewhat annoying that it works the way it does, isn't it?
            > > Yes, it is.
            > >
            > > > However, the nature of a CHAR(31) column is that it gets blank-padded
            > > to
            > > the
            > > > declared width, so the fact that it comes back with trailing blanks
            > > > isn't so surprising.
            > > No it isn't, but from the user point of view, how meta data is stored
            > in
            > > the
            > > database does not matter;
            > > what matters is the result.
            > > The JDBC specs say that e.g. getTables -> "TABLE_NAME" should return
            > > the table name, i.e. the name I gave to the table, not a blank
            > > padded-string.
            > >
            > > > I'm curious to know if you've worked with other JDBC-driver/DB-engine
            > > > combinations that had different behavior for a CHAR type column (as
            > > > opposed to say VARCHAR).
            > > I worked with other dbs, and I never had problems with
            > DatabaseMetaData.
            > > If I declare a field as CHAR(31), I expect to get a padded string, but
            > if
            > > I
            > > query for the column name I expect to get exactly the real name,
            > because
            > > it
            > > is meta data.
            > > BTW, this problem does not exist with InterClient.
            > >
            > > Massimo
            > >
            > >
            > >
            > >
            > >
            > >
            > > To unsubscribe from this group, send an email to:
            > > IB-Java-unsubscribe@egroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            > >
            > >
            > >
            > >
            > >
            >
            > To unsubscribe from this group, send an email to:
            > IB-Java-unsubscribe@egroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            >
            >
            >
            >
            >
          • Massimo Ferrari
            Great! Regards Massimo ... From: David Jencks To: Sent: Sunday, November 04, 2001 7:04 AM
            Message 5 of 6 , Nov 4, 2001
            • 0 Attachment
              Great!
              Regards
              Massimo

              ----- Original Message -----
              From: "David Jencks" <davidjencks@...>
              To: <IB-Java@yahoogroups.com>
              Sent: Sunday, November 04, 2001 7:04 AM
              Subject: Re: [IB-Java] Re: bugs in DatabaseMetaData


              > And now I fixed the PRECISION at least for dialect 3.
              >
              > On 2001.11.04 00:51:59 -0500 David Jencks wrote:
              > > Ok, I think I fixed this one (tests work w/o trim) although the
              PRECISION
              > > named column is still a problem...
              > >
              > > david jencks
              > >
              > > On 2001.11.03 15:50:37 -0500 Massimo Ferrari wrote:
              > > > > That's somewhat annoying that it works the way it does, isn't it?
              > > > Yes, it is.
              > > >
              > > > > However, the nature of a CHAR(31) column is that it gets
              blank-padded
              > > > to
              > > > the
              > > > > declared width, so the fact that it comes back with trailing blanks
              > > > > isn't so surprising.
              > > > No it isn't, but from the user point of view, how meta data is stored
              > > in
              > > > the
              > > > database does not matter;
              > > > what matters is the result.
              > > > The JDBC specs say that e.g. getTables -> "TABLE_NAME" should return
              > > > the table name, i.e. the name I gave to the table, not a blank
              > > > padded-string.
              > > >
              > > > > I'm curious to know if you've worked with other
              JDBC-driver/DB-engine
              > > > > combinations that had different behavior for a CHAR type column (as
              > > > > opposed to say VARCHAR).
              > > > I worked with other dbs, and I never had problems with
              > > DatabaseMetaData.
              > > > If I declare a field as CHAR(31), I expect to get a padded string, but
              > > if
              > > > I
              > > > query for the column name I expect to get exactly the real name,
              > > because
              > > > it
              > > > is meta data.
              > > > BTW, this problem does not exist with InterClient.
              > > >
              > > > Massimo
              > > >
              > > >
              > > >
              > > >
              > > >
              > > >
              > > > To unsubscribe from this group, send an email to:
              > > > IB-Java-unsubscribe@egroups.com
              > > >
              > > >
              > > >
              > > > Your use of Yahoo! Groups is subject to
              > > http://docs.yahoo.com/info/terms/
              > > >
              > > >
              > > >
              > > >
              > > >
              > >
              > > To unsubscribe from this group, send an email to:
              > > IB-Java-unsubscribe@egroups.com
              > >
              > >
              > >
              > > Your use of Yahoo! Groups is subject to
              http://docs.yahoo.com/info/terms/
              > >
              > >
              > >
              > >
              > >
              >
              > To unsubscribe from this group, send an email to:
              > IB-Java-unsubscribe@egroups.com
              >
              >
              >
              > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
              >
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.