Torque
  1. Torque
  2. TORQUE-16

LockTables is faulty in some adapters

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.1.1, 3.2
    • Fix Version/s: 4.0-beta1
    • Component/s: Runtime
    • Labels:
      None
    • Environment:
      mssql, oracle
    • Old Scarab Id:
      TRQS334

      Description

      Sent to me from Michael Beier

      in some adapters (e.g mssql, sybase) lockTables is implemented as follows:

      public void lockTable(Connection con, String table) throws SQLException
      {
      Statement statement = con.createStatement();

      stmt.append("SELECT next_id FROM ")
      .append(table)
      .append(" FOR UPDATE");
      }

      Problem is that the column next_id does not exist in most tables.
      Suggested is to replace this as follows:
      Mssql:
      {
      Statement statement = con.createStatement();

      StringBuffer stmt = new StringBuffer();
      stmt.append("SELECT * FROM ")
      .append(table)
      .append(" WITH (TABLOCKX)");

      statement.executeQuery(stmt.toString());
      }

      Oracle:
      public void lockTable(Connection con, String table) throws SQLException
      {
      Statement statement = con.createStatement();

      StringBuffer stmt = new StringBuffer();
      stmt.append("SELECT * FROM ")
      .append(table)
      .append(" FOR UPDATE");

      statement.executeQuery(stmt.toString());
      }

        Activity

        Thomas Fox created issue -
        Thomas Fox made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Thomas Fox [ tfischer ]
        Fix Version/s 4.0 [ 12312102 ]
        Resolution Fixed [ 1 ]
        Thomas Fox made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        2099d 17h 41m 1 Thomas Fox 30/Jan/12 17:52
        Resolved Resolved Closed Closed
        237d 13h 14m 1 Thomas Fox 24/Sep/12 08:06

          People

          • Assignee:
            Thomas Fox
            Reporter:
            Thomas Fox
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development