/**
   * Bind this LockTableNode. This means looking up the table, verifying it exists and getting the
   * heap conglomerate number.
   *
   * @exception StandardException Thrown on error
   */
  public void bindStatement() throws StandardException {
    CompilerContext cc = getCompilerContext();
    ConglomerateDescriptor cd;
    DataDictionary dd = getDataDictionary();
    SchemaDescriptor sd;

    String schemaName = tableName.getSchemaName();
    sd = getSchemaDescriptor(schemaName);

    // Users are not allowed to lock system tables
    if (sd.isSystemSchema()) {
      throw StandardException.newException(
          SQLState.LANG_NO_USER_DDL_IN_SYSTEM_SCHEMA, statementToString(), schemaName);
    }

    lockTableDescriptor = getTableDescriptor(tableName.getTableName(), sd);

    if (lockTableDescriptor == null) {
      // Check if the reference is for a synonym.
      TableName synonymTab = resolveTableToSynonym(tableName);
      if (synonymTab == null)
        throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName);
      tableName = synonymTab;
      sd = getSchemaDescriptor(tableName.getSchemaName());

      lockTableDescriptor = getTableDescriptor(synonymTab.getTableName(), sd);
      if (lockTableDescriptor == null)
        throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName);
    }

    // throw an exception if user is attempting to lock a temporary table
    if (lockTableDescriptor.getTableType() == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE) {
      throw StandardException.newException(
          SQLState.LANG_NOT_ALLOWED_FOR_DECLARED_GLOBAL_TEMP_TABLE);
    }

    conglomerateNumber = lockTableDescriptor.getHeapConglomerateId();

    /* Get the base conglomerate descriptor */
    cd = lockTableDescriptor.getConglomerateDescriptor(conglomerateNumber);

    /* Statement is dependent on the TableDescriptor and ConglomerateDescriptor */
    cc.createDependency(lockTableDescriptor);
    cc.createDependency(cd);

    if (isPrivilegeCollectionRequired()) {
      // need SELECT privilege to perform lock table statement.
      cc.pushCurrentPrivType(Authorizer.SELECT_PRIV);
      cc.addRequiredTablePriv(lockTableDescriptor);
      cc.popCurrentPrivType();
    }
  }