Package net.sourceforge.squirrel_sql.client.session.schemainfo

Examples of net.sourceforge.squirrel_sql.client.session.schemainfo.SchemaInfo


   public Session(IApplication app, ISQLDriver driver, SQLAlias alias,
                  SQLConnection conn, String user, String password,
                  IIdentifier sessionId)
   {
      super();
      _schemaInfo = new SchemaInfo(app);

      if (app == null)
      {
         throw new IllegalArgumentException("null IApplication passed");
      }
View Full Code Here


    props = new SessionProperties();
    props.setLoadSchemasCatalogs(false);
    app = new MockApplication();
    app.getMockSessionManager().setSession(this);
    sqlAlias = new SQLAlias(new UidIdentifier());
    schemaInfo = new SchemaInfo(app);
    schemaInfo.initialLoad(this);
    prefs = app.getSquirrelPreferences();
    try
    {
      UIFactory.initialize(prefs, app);
View Full Code Here

      props = new SessionProperties();
      props.setLoadSchemasCatalogs(false);
      app = new MockApplication();
      app.getMockSessionManager().setSession(this);
      sqlAlias = new SQLAlias(new UidIdentifier());
      schemaInfo = new SchemaInfo(app);
      schemaInfo.initialLoad(this);
      prefs = app.getSquirrelPreferences();
      try {
        UIFactory.initialize(prefs, app);
      } catch (Throwable e) {
View Full Code Here

      try {
          ISession session = getSession();
          ISQLConnection con = session.getSQLConnection();
          stmt = con.createStatement();
          stmt.execute(createPlanTableSQL);
          SchemaInfo schemaInfo = session.getSchemaInfo();
          schemaInfo.refershCacheForSimpleTableName("PLAN_TABLE");
      } catch (SQLException ex) {
          result = false;
          getSession().showErrorMessage(ex);
          s_log.error(ex);
      } finally {
View Full Code Here

  {
    ITableInfo[] result = new ITableInfo[0];

    try
    {
      SchemaInfo schemaInfo = session.getSchemaInfo();
      result = schemaInfo.getITableInfos(catalog, schema, tableName);
    } catch (Exception e)
    {
      log.error("Encountered unexpected exception when attempting to "
            + "call schemaInfo.getTables with catalog = " + catalog + " schema = " + schema
            + " tableName = " + tableName);
View Full Code Here

        }
        if (colorStartPos != -1)
        {
          try
          {
            final SchemaInfo si = _session.getSchemaInfo();
            Token t;
            synchronized (doclock)
            {
              // we are playing some games with the lexer for efficiency.
              // we could just create a new lexer each time here, but instead,
              // we will just reset it so that it thinks it is starting at the
              // beginning of the document but reporting a funny start colorStartPos.
              // Reseting the lexer causes the close() method on the reader
              // to be called but because the close() method has no effect on the
              // DocumentReader, we can do this.
              syntaxLexer.reset(
                documentReader,
                0,
                colorStartPos,
                0);
              // After the lexer has been set up, scroll the reader so that it
              // is in the correct spot as well.
              documentReader.seek(colorStartPos);
              // we will highlight tokens until we reach a good stopping place.
              // the first obvious stopping place is the end of the document.
              // the lexer will return null at the end of the document and wee
              // need to stop there.
              t = getNextToken();
            }
                  SimpleAttributeSet errStyle = getMyStyle(IConstants.IStyleNames.ERROR);
                  ErrorInfo[] errInfoClone = _currentErrorInfos.toArray(new ErrorInfo[0]);
            while (t != null && t.getCharEnd() <= colorStartPos + colorLen + 1)
            {
              // this is the actual command that colors the stuff.
              // Color stuff with the description of the style matched
              // to the hash table that has been set up ahead of time.
              synchronized (doclock)
              {
                if (t.getCharEnd() <= document.getLength())
                {
                  String type = t.getDescription();
                  if (type.equals(IConstants.IStyleNames.IDENTIFIER))
                  {
                    final String data = t.getContents();
                    if (si.isTable(data))
                    {
                      type = IConstants.IStyleNames.TABLE;
                                 if(fireTableOrViewFoundEvent)
                                 {
                         fireTableOrViewFound(t.getContents());
                       }

                                 String upperCaseTableName = data.toUpperCase();
                                 if(false == _knownTables.contains(upperCaseTableName))
                                 {
                                    _knownTables.put(upperCaseTableName, upperCaseTableName);
                                    recolorColumns(upperCaseTableName);
                                 }

                    }
                    else if (si.isColumn(data))
                    {
                      type = IConstants.IStyleNames.COLUMN;
                    }
                    else if (si.isDataType(data))
                    {
                      type = IConstants.IStyleNames.DATA_TYPE;
                    }
                    else if (si.isKeyword(data))
                    {
                      type = IConstants.IStyleNames.RESERVED_WORD;
                    }
                  }
View Full Code Here

  public static ITableInfo getTableInfo(ISession session, String schema, String tableName)
    throws SQLException, MappingException, UserCancelledOperationException
  {
    ISQLConnection con = session.getSQLConnection();
    SchemaInfo schemaInfo = session.getSchemaInfo();
    // Currently, as of milestone 3, Axion doesn't support "schemas" like
    // other databases. So, set the schema to emtpy string if we detect
    // an Axion session.
    if (con.getSQLMetaData().getDriverName().toLowerCase().startsWith("axion"))
    {
      schema = "";
    }
    String catalog = null;
    // MySQL uses catalogs and not schemas
    if (DialectFactory.isMySQL(session.getMetaData()))
    {
      catalog = schema;
      schema = null;
    }
    // trim the table name in case of HADB
    tableName = tableName.trim();
    ITableInfo[] tis = schemaInfo.getITableInfos(catalog, schema, tableName);

    if (tis == null || tis.length == 0)
    {
      if (Character.isUpperCase(tableName.charAt(0)))
      {
        tableName = tableName.toLowerCase();
      }
      else
      {
        tableName = tableName.toUpperCase();
      }
      tis = schemaInfo.getITableInfos(null, schema, tableName);
      if (tis.length == 0)
      {
        if (Character.isUpperCase(tableName.charAt(0)))
        {
          tableName = tableName.toLowerCase();
        }
        else
        {
          tableName = tableName.toUpperCase();
        }
        tis = schemaInfo.getITableInfos(null, schema, tableName);
      }
    }
    if (tis.length == 0)
    {
      // i18n[DBUtil.error.tablenotfound=Couldn't locate table '{0}' in
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.client.session.schemainfo.SchemaInfo

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.