Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-188

dbName == null should be interpreted as default database

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0-beta1
    • None
    • None

    Description

      If the name of a database is null, it should be hendled exactly as if the name of the database was set to the default database's name

      Background: In the Torque 4 trunk, the setDbName in the generated peers is generated as follows:
      private static void setDbName(Criteria crit) throws TorqueException
      {
      if (!Torque.isInit())

      { throw new TorqueException("Torque is not initialized"); }

      if (Torque.getDefaultDB().equals(crit.getDbName()))
      {
      crit.setDbName(${peerClassName}.DATABASE_NAME);
      }
      }
      So if I set the database name to the name of the default db it is always switched to the name of the table's default when querying the database, which I did not mean to do.
      In Torque 3 the check was == instead of equals, which did the trick but caused findbugs to yell.
      The clean solution is to use null for "not set" in the criteria.

      Attachments

        Activity

          People

            tfischer Thomas Fox
            tfischer Thomas Fox
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: