Package net.sourceforge.squirrel_sql.fw.sql

Examples of net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo


            // get the nullability information and pass it into the ResultSet
            // Unfortunately, not all DBMSs provide the column number in object 17 as stated in the
            // SQL documentation, so we have to guess that the result set is in column order
            for (int i = 0; i < columnInfos.length; i++) {
                boolean isNullable = true;
                TableColumnInfo info = columnInfos[i];
                if (info.isNullAllowed() == DatabaseMetaData.columnNoNulls) {
                    isNullable = false;
                }
                if (i < colDefs.length) {
                    colDefs[i].setIsNullable(isNullable);
                }
View Full Code Here


    try
    {
      final ISQLConnection conn = session.getSQLConnection();
        TableColumnInfo[] infos = conn.getSQLMetaData().getColumnInfo((ITableInfo)_objectInfo);
        for (int i = 0; i < infos.length; i++) {
           TableColumnInfo info = infos[i];
           columnNames.add(info.getColumnName());
        }
    }
    catch (SQLException ex)
    {
      session.getApplication().showErrorDialog(
View Full Code Here

  {
    ArrayList<String> result = new ArrayList<String>();
    String alterClause = DialectUtils.ALTER_COLUMN_CLAUSE;
    for (int i = 0; i < columns.length; i++)
    {
      TableColumnInfo info = columns[i];
      String notNullSQL = DialectUtils.getColumnNullableAlterSQL(info, false, this, alterClause, true, qualifier, prefs);
      result.add(notNullSQL);
    }
    result.add(DialectUtils.getAddPrimaryKeySQL(ti, pkName, columns, false, qualifier, prefs, this));
    return result.toArray(new String[result.size()]);
View Full Code Here

    addPKSQL.append(" ADD CONSTRAINT ");
    addPKSQL.append(pkName);
    addPKSQL.append(" PRIMARY KEY (");
    for (int i = 0; i < columns.length; i++)
    {
      TableColumnInfo info = columns[i];
      if (info.isNullable().equals("YES"))
      {
        String alterClause = DialectUtils.ALTER_COLUMN_CLAUSE;
        String notNullSql =
          DialectUtils.getColumnNullableAlterSQL(info, false, this, alterClause, true, qualifier, prefs);

        result.add(notNullSql);
      }
      addPKSQL.append(DialectUtils.shapeIdentifier(info.getColumnName(), prefs, this));
      if (i + 1 < columns.length)
      {
        addPKSQL.append(", ");
      }
    }
View Full Code Here

      int index = 0;
      for (String columnName : columnNames) {
         Integer columnDataType = dataTypes.get(index++);

         TableColumnInfo info = getEasyMockTableColumnInfo(catalogName,
                                                           schemaName,
                                                           tableName,
                                                           columnName,
                                                           columnDataType,
                                                           10,
View Full Code Here

   public static TableColumnInfo getEasyMockTableColumnInfo(String catalogName,
         String schemaName, String tableName, String columnName, int dataType,
         int columnSize, String defaultValue, String remarks,
         int decimalDigits, int octetLength, int radix, boolean nullable) {
      TableColumnInfo info = createMock(TableColumnInfo.class);
      expect(info.getCatalogName()).andReturn(catalogName).anyTimes();
      expect(info.getSchemaName()).andReturn(schemaName).anyTimes();
      expect(info.getTableName()).andReturn(tableName).anyTimes();
      expect(info.getColumnName()).andReturn(columnName).anyTimes();
      expect(info.getDataType()).andReturn(dataType).anyTimes();
      expect(info.getTypeName()).andReturn(JDBCTypeMapper.getJdbcTypeName(dataType))
                                .anyTimes();
      expect(info.getColumnSize()).andReturn(columnSize).anyTimes();
      expect(info.getDatabaseObjectType()).andReturn(DatabaseObjectType.COLUMN)
                                          .anyTimes();
      expect(info.getDefaultValue()).andReturn(defaultValue).anyTimes();
      expect(info.getRemarks()).andReturn(remarks).anyTimes();
      expect(info.getDecimalDigits()).andReturn(decimalDigits).anyTimes();
      expect(info.getOctetLength()).andReturn(octetLength).anyTimes();
      expect(info.getQualifiedName()).andReturn(schemaName + "." + tableName
            + "." + columnName).anyTimes();
      expect(info.getRadix()).andReturn(radix).anyTimes();
      if (nullable) {
         expect(info.isNullable()).andReturn("YES").anyTimes();
         expect(info.isNullAllowed()).andReturn(1).anyTimes();
      } else {
         expect(info.isNullable()).andReturn("NO").anyTimes();
         expect(info.isNullAllowed()).andReturn(0).anyTimes();
      }
      replay(info);
      return info;
   }
View Full Code Here

    *           the new column size
    * @return
    */
   public static TableColumnInfo setEasyMockTableColumnInfoSize(
         final TableColumnInfo info, final int newSize) {
      TableColumnInfo result = getEasyMockTableColumnInfo(info.getCatalogName(),
                                                          info.getSchemaName(),
                                                          info.getTableName(),
                                                          info.getColumnName(),
                                                          info.getDataType(),
                                                          newSize,
View Full Code Here

    *           the new column size
    * @return
    */
   public static TableColumnInfo setEasyMockTableColumnInfoNullable(
         final TableColumnInfo info, final boolean nullable) {
      TableColumnInfo result = getEasyMockTableColumnInfo(info.getCatalogName(),
                                                          info.getSchemaName(),
                                                          info.getTableName(),
                                                          info.getColumnName(),
                                                          info.getDataType(),
                                                          info.getColumnSize(),
View Full Code Here

    *           the new column data type
    * @return
    */
   public static TableColumnInfo setEasyMockTableColumnInfoType(
         final TableColumnInfo info, final int dataType) {
      TableColumnInfo result = getEasyMockTableColumnInfo(info.getCatalogName(),
                                                          info.getSchemaName(),
                                                          info.getTableName(),
                                                          info.getColumnName(),
                                                          dataType,
                                                          info.getColumnSize(),
View Full Code Here

      if (nullable) {
         isNullableInt = 1;
         isNullableStr = "yes";
      }
      TableColumnInfo info = new TableColumnInfo("TestCatalog",
                                                 "TestSchema",
                                                 "TestTable",
                                                 columnName,
                                                 type,
                                                 JDBCTypeMapper.getJdbcTypeName(type), // typeName
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.