Examples of HibernateDialect


Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

   
    private class DialectTypeListListener implements ItemListener {
       
        public void itemStateChanged(ItemEvent e) {
            String dbName = (String)dialectList.getSelectedItem();
            HibernateDialect dialect = DialectFactory.getDialect(dbName);
            if (!dialect.supportsColumnComment()) {
                commentTextArea.setEditable(false);
                //i18n[ColumnDetailsDialog.columnCommentLabel={0} does not
                //support column comments]
                String noColumnSupportMsg =
                    s_stringMgr.getString(
                            "ColumnDetailsDialog.columnCommentToolTip",
                            dbName);
                commentTextArea.setToolTipText(noColumnSupportMsg);
            } else {
                commentTextArea.setEditable(true);
                commentTextArea.setToolTipText(null);
            }
            if (_mode == MODIFY_MODE) {
                if (!dialect.supportsAlterColumnNull()) {
                    nullableCheckBox.setEnabled(false);
                    //i18n[ColumnDetailsDialog.columnNullLabel={0} does not
                    //support altering column nullability]
                    String noColumnSupportMsg =
                        s_stringMgr.getString("ColumnDetailsDialog.columnNullToolTip",
                                              dbName);
                    nullableCheckBox.setToolTipText(noColumnSupportMsg);
                } else {
                    nullableCheckBox.setEnabled(true);
                    nullableCheckBox.setToolTipText(null);
                }
                if (!dialect.supportsRenameColumn()) {
                    //i18n[ColumnDetailsDialog.columnNameTootTip={0} does not
                    //support altering column name]
                    String noColNameChange =
                        s_stringMgr.getString("ColumnDetailsDialog.columnNameTootTip",
                                              dbName);
                    columnNameTextField.setEditable(false);
                    columnNameTextField.setToolTipText(noColNameChange);
                } else {
                    columnNameTextField.setEditable(true);
                    columnNameTextField.setToolTipText(null);                   
                }
                if (!dialect.supportsAlterColumnType()) {
                    //i18n[ColumnDetailsDialog.columnTypeTootTip={0} does not
                    //support altering column type]    
                    String noColTypeChange =
                        s_stringMgr.getString("ColumnDetailsDialog.columnTypeTootTip",
                                              dbName);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

            csprefs.setQualifyTableNames(prefs.isQualifyTableNames());
            csprefs.setUseDoubleQuotes(prefs.isUseDoubleQuotes());

            List<ITableInfo> tables = convertArrayToList(dbObjs);
           
            HibernateDialect dialect =
                DialectFactory.getDialect(DialectFactory.SOURCE_TYPE,
                                          _session.getApplication().getMainFrame(),
                                          md);
            List<String> sqls =
                dialect.getCreateTableSQL(tables, md, csprefs, isJdbcOdbc);
            String sep = _session.getQueryTokenizer().getSQLStatementSeparator();
           
            for (String sql : sqls) {
                result.append(sql);
                result.append("\n");
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

    int colJdbcType = colInfo.getDataType();
    if (colJdbcType == java.sql.Types.OTHER)
    {
      try
      {
        HibernateDialect dialect = DialectFactory.getDialect(session.getMetaData());
        String typeName = colInfo.getTypeName().toUpperCase();
        int parenIndex = typeName.indexOf("(");
        if (parenIndex != -1)
        {
          typeName = typeName.substring(0, parenIndex);
        }
        colJdbcType = dialect.getJavaTypeForNativeType(colInfo.getTypeName());
      } catch (Exception e)
      {
        log.error("replaceOtherDataType: unexpected exception - " + e.getMessage());
      }
    }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

    {
      result.append(" NOT NULL");
    } else
    {
      ISession destSession = prov.getCopyDestSession();
      HibernateDialect d = DialectFactory.getDialect(
         DialectFactory.DEST_TYPE, destSession.getApplication().getMainFrame(), destSession.getMetaData());
      String nullString = d.getNullColumnString().toUpperCase();
      result.append(nullString);
    }
    return result.toString();
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

   */
  public static String getMaxColumnLengthSQL(ISession sourceSession, TableColumnInfo colInfo,
        String tableName, boolean tableNameIsQualified) throws UserCancelledOperationException
  {
    StringBuilder result = new StringBuilder();
    HibernateDialect dialect = DialectFactory.getDialect(
       DialectFactory.SOURCE_TYPE, sourceSession.getApplication().getMainFrame(),
       sourceSession.getMetaData());
    String lengthFunction = dialect.getLengthFunction(colInfo.getDataType());
    if (lengthFunction == null)
    {
      log.error("Length function is null for dialect=" + dialect.getClass().getName() + ". Using 'length'");
      lengthFunction = "length";
    }
    String maxFunction = dialect.getMaxFunction();
    if (maxFunction == null)
    {
      log.error("Max function is null for dialect=" + dialect.getClass().getName() + ". Using 'max'");
      maxFunction = "max";
    }
    result.append("select ");
    result.append(maxFunction);
    result.append("(");
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

        String typeName = dbObj.getDatabaseObjectType().getName();
       
        log.debug("PasteTableAction.checkSession: dbObj type="+typeName+
                  " name="+dbObj.getSimpleName());

        HibernateDialect d =
            DialectFactory.getDialect(DialectFactory.DEST_TYPE,
                                      session.getApplication().getMainFrame(),
                                      session.getMetaData());
        if (!d.canPasteTo(dbObj)) {
            //i18n[PasteTableAction.error.destdbobj=The destination database
            //doesn't support copying tables into '{0}' objects.\n Please
            //select a schema to paste into.]
            String errmsg =
                s_stringMgr.getString("PasteTableAction.error.destdbobj",
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

                }
            }
        }
        String result = null;
        JFrame mainFrame = destSession.getApplication().getMainFrame();
        HibernateDialect destDialect =
            DialectFactory.getDialect(DialectFactory.DEST_TYPE,
                                      mainFrame,
                                      destSession.getMetaData());

        if (s_log.isDebugEnabled()) {
            s_log.debug(
                    "ColTypeMapper.mapColType: using dialect type: "+
                    destDialect.getClass().getName()+" to find name for column "+
                    colInfo.getColumnName()+" in table "+destTableName+
                    " with type id="+colJdbcType+" ("+
                    JDBCTypeMapper.getJdbcTypeName(colJdbcType)+")");
        }
        if (destDialect != null) {
            HibernateDialect sourceDialect =
                DialectFactory.getDialect(DialectFactory.SOURCE_TYPE,
                                          mainFrame,
                                          sourceSession.getMetaData());
           
            int precision = sourceDialect.getPrecisionDigits(size, colJdbcType);
           
            if (precision > destDialect.getMaxPrecision(colJdbcType)) {
                precision = destDialect.getMaxPrecision(colJdbcType);
            }
            int scale = colInfo.getDecimalDigits();
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

   
    private static int getColumnLength(ISession sourceSession,
                                       TableColumnInfo colInfo)
        throws UserCancelledOperationException
    {
        HibernateDialect dialect =
            DialectFactory.getDialect(DialectFactory.SOURCE_TYPE,
                                      sourceSession.getApplication().getMainFrame(),
                                      sourceSession.getMetaData());
        int length = colInfo.getColumnSize();
        int type = colInfo.getDataType();
        length = dialect.getColumnLength(length, type);
        return length;
    }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

   */
  public static String getMaxColumnLengthSQL(ISession sourceSession, TableColumnInfo colInfo,
    String tableName, boolean tableNameIsQualified) throws UserCancelledOperationException
  {
    StringBuilder result = new StringBuilder();
    HibernateDialect dialect =
      DialectFactory.getDialect(DialectFactory.SOURCE_TYPE, sourceSession.getApplication().getMainFrame(),
        sourceSession.getMetaData());
    String lengthFunction = dialect.getLengthFunction(colInfo.getDataType());
    if (lengthFunction == null)
    {
      log.error("Length function is null for dialect=" + dialect.getClass().getName() + ". Using 'length'");
      lengthFunction = "length";
    }
    String maxFunction = dialect.getMaxFunction();
    if (maxFunction == null)
    {
      log.error("Max function is null for dialect=" + dialect.getClass().getName() + ". Using 'max'");
      maxFunction = "max";
    }
    result.append("select ");
    result.append(maxFunction);
    result.append("(");
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect

                    ISQLDatabaseMetaData md = session.getMetaData();
                    // TODO: Need to define a better approach to getting dialects.
                    // That is, we don't really want to ever prompt the user in this
                    // case.  It's always Oracle.  Yet, we may have a new OracleDialect
                    // at some point.
                    HibernateDialect dialect = DialectFactory.getDialect("Oracle");
                   
                    // TODO: How to let the user customize this??
                    CreateScriptPreferences prefs = new CreateScriptPreferences();
                   
                    ITableInfo[] tabs = new ITableInfo[] { (ITableInfo)getDatabaseObjectInfo() };
                    List<ITableInfo> tables = Arrays.asList(tabs);
                    // Handle table source
                    List<String> sqls = dialect.getCreateTableSQL(tables, md, prefs, false);
                    String sep = session.getQueryTokenizer().getSQLStatementSeparator();
                    for (String sql : sqls) {
                        buf.append(sql);
                        buf.append(sep);
                        buf.append("\n");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.