private int getDefaultAccessLevel() throws StandardException {
    PersistentSet tc = lcc.getTransactionExecute();

    String modeS =
        (String) PropertyUtil.getServiceProperty(tc, Property.DEFAULT_CONNECTION_MODE_PROPERTY);
    if (modeS == null) return FULL_ACCESS;
    else if (StringUtil.SQLEqualsIgnoreCase(modeS, Property.NO_ACCESS)) return NO_ACCESS;
    else if (StringUtil.SQLEqualsIgnoreCase(modeS, Property.READ_ONLY_ACCESS)) return READ_ACCESS;
    else if (StringUtil.SQLEqualsIgnoreCase(modeS, Property.FULL_ACCESS)) return FULL_ACCESS;
    else {
      if (SanityManager.DEBUG)
        SanityManager.THROWASSERT(
            "Invalid value for property "
                + Property.DEFAULT_CONNECTION_MODE_PROPERTY
                + " "
                + modeS);
      return FULL_ACCESS;
    }
  }
  /**
   * Create the Constant information that will drive the guts of Execution.
   *
   * @exception StandardException Thrown on failure
   */
  public ConstantAction makeConstantAction() throws StandardException {
    TableElementList coldefs = tableElementList;

    // for each column, stuff system.column
    ColumnInfo[] colInfos = new ColumnInfo[coldefs.countNumberOfColumns()];

    int numConstraints = coldefs.genColumnInfos(colInfos);

    /* If we've seen a constraint, then build a constraint list */
    CreateConstraintConstantAction[] conActions = null;

    SchemaDescriptor sd =
        getSchemaDescriptor(tableType != TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE, true);

    if (numConstraints > 0) {
      conActions = new CreateConstraintConstantAction[numConstraints];

      coldefs.genConstraintActions(true, conActions, getRelativeName(), sd, getDataDictionary());
    }

    // if the any of columns are "long" and user has not specified a
    // page size, set the pagesize to 32k.
    // Also in case where the approximate sum of the column sizes is
    // greater than the bump threshold , bump the pagesize to 32k

    boolean table_has_long_column = false;
    int approxLength = 0;

    for (int i = 0; i < colInfos.length; i++) {
      DataTypeDescriptor dts = colInfos[i].dataType;
      if (dts.getTypeId().isLongConcatableTypeId()) {
        table_has_long_column = true;
        break;
      }

      approxLength += dts.getTypeId().getApproximateLengthInBytes(dts);
    }

    if (table_has_long_column || (approxLength > Property.TBL_PAGE_SIZE_BUMP_THRESHOLD)) {
      if (((properties == null) || (properties.get(Property.PAGE_SIZE_PARAMETER) == null))
          && (PropertyUtil.getServiceProperty(
                  getLanguageConnectionContext().getTransactionCompile(),
                  Property.PAGE_SIZE_PARAMETER)
              == null)) {
        // do not override the user's choice of page size, whether it
        // is set for the whole database or just set on this statement.

        if (properties == null) properties = new Properties();

        properties.put(Property.PAGE_SIZE_PARAMETER, Property.PAGE_SIZE_DEFAULT_LONG);
      }
    }

    return (getGenericConstantActionFactory()
        .getCreateTableConstantAction(
            sd.getSchemaName(),
            getRelativeName(),
            tableType,
            colInfos,
            conActions,
            properties,
            lockGranularity,
            onCommitDeleteRows,
            onRollbackDeleteRows));
  }
예제 #3
0
 public ReplicationLogger(String dbname) {
   verbose = PropertyUtil.getSystemBoolean(Property.REPLICATION_VERBOSE, true);
   this.dbname = dbname;
 }
 private boolean userOnAccessList(String listName) throws StandardException {
   PersistentSet tc = lcc.getTransactionExecute();
   String listS = (String) PropertyUtil.getServiceProperty(tc, listName);
   return IdUtil.idOnList(authorizationId, listS);
 }