⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ij.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }/** * ConnectStatement is CONNECT 'url' [ PROTOCOL proto ] 	[ USER 	String PASSWORD String ] 	[ATTRIBUTES attributeName = value [, attributeName = value]* ]	[ AS ident ], where url is the * url for the database, i.e. jdbc:protocol:dbname etc. * Attributes are connection attributes to  * <p> * There can only be one connection at a time; if there * is already one, it is put on hold and this one takes its place. * <p> * if a driver can't be found, the current protocol will * be added at the front. * <p> * the as ident part is used for set connection.  If you don't * specify a name, we create one that is CONNECTION# for the # * of open connections that now exists. If the name duplicates, * an error results. */  final public ijResult dynamicConnection(boolean simplifiedPath) throws ParseException, SQLException {        Token t;        Token userT = null;        Token passwordT = null;        String n = null, p = null, sVal;    String userS =  util.getSystemProperty(USER_PROPERTY);    String passwordS = util.getSystemProperty(PASSWORD_PROPERTY);        Properties connInfo = null;    t = jj_consume_token(STRING);    if (jj_2_61(2)) {      jj_consume_token(PROTOCOL);      p = identifier();    } else {      ;    }    if (jj_2_62(2)) {      jj_consume_token(USER);      userT = jj_consume_token(STRING);    } else {      ;    }    if (jj_2_63(2)) {      jj_consume_token(PASSWORD);      passwordT = jj_consume_token(STRING);    } else {      ;    }    if (jj_2_64(2)) {      jj_consume_token(ATTRIBUTES);      connInfo = attributeList();    } else {      ;    }    if (jj_2_65(2)) {      jj_consume_token(AS);      n = identifier();    } else {      ;    }                // t.image is a database URL                // we get the connection and salt it away                // for use with other statements.                //                // FUTURE: we could have the syntax be                // CONNECT <STRING> AS <IDENTIFIER>                // and have a SET CONNECTION string to                // re-activate a named connection.                // Or not, and wait for SQL-J to support that                // statement... although then we will have to                // figure out if we will allow that SQL-J through                // JDBC or not.                // get the value of the string                // n.b. at some point this will have to deal with ''s                if (simplifiedPath)                        // url for the database W/O 'jdbc:protocol:', i.e. just a dbname                        // For example,                        //		CONNECT TO 'test'                        // is equivalent to                        // 		CONNECT TO 'jdbc:derby:test'                        sVal = "jdbc:derby:" + stringValue(t.image);                else                        sVal = stringValue(t.image);                // add named protocol if it was specified                if (p != null) {                        String protocol = (String)namedProtocols.get(p);                        if (protocol == null) { {if (true) throw ijException.noSuchProtocol(p);} }                        sVal = protocol + sVal;                }                if (userT != null)                        userS = stringValue(userT.image);                if (passwordT != null)                        passwordS = stringValue(passwordT.image);                // add protocol if no driver matches url                boolean noDriver = false;                        // if we have a full URL, make sure it's loaded first                        try {                                if (sVal.startsWith("jdbc:"))                                        util.loadDriverIfKnown(sVal);                        } catch (Exception e) {                                // want to continue with the attempt                        }                        // By default perform extra checking on the URL attributes.                        // This checking does not change the processing.                        if (System.getProperty("ij.URLCheck") == null || Boolean.getBoolean("ij.URLCheck")) {                          URLCheck aCheck = new URLCheck(sVal);                        }                if (!sVal.startsWith("jdbc:") && (p == null) && (protocol != null)) {                        sVal = protocol + sVal;                }                // If no ATTRIBUTES on the connection get them from the                // defaults                if (connInfo == null)                        connInfo = util.updateConnInfo(userS,passwordS,                        utilInstance.getConnAttributeDefaults());                else                        connInfo = util.updateConnInfo(userS,passwordS, connInfo);                theConnection = DriverManager.getConnection(sVal,connInfo);                {if (true) return addSession( theConnection, n );}    throw new Error("Missing return statement in function");  }/**  * Handles CONNECT yadda.yadda.foo( stringArg, ... stringArg ) AS connectionName  */  final public ijResult staticConnection() throws ParseException, SQLException {        String                  name = null;        Vector                  idList;        int                             idx = 0;        int                             lastID = 0;        StringBuffer    buffer;        String                  className;        String                  methodName;        Class                   classC;        Method                  method;        int                             argCount;        String[]                args;        Class                   stringClass;        Class[]                 argTypes;        ijResult                result = null;    idList = staticMethodName();    args = staticMethodArgs();    if (jj_2_66(2)) {      jj_consume_token(AS);      name = identifier();    } else {      ;    }                lastID = idList.size() - 1;                buffer = new StringBuffer();                for ( ; idx < lastID; idx++ )                {                        if ( idx > 0 ) { buffer.append( "." ); }                        buffer.append( (String) idList.elementAt( idx ) );                }                methodName = (String) idList.elementAt( idx );                className = buffer.toString();                try {                        argCount = args.length;                        argTypes = new Class[ argCount ];                        stringClass = Class.forName( "java.lang.String" );                        for ( idx = 0; idx < argCount; idx++ ) { argTypes[ idx ] = stringClass; }                        classC = Class.forName( className );                        method = classC.getMethod( methodName, argTypes );                        theConnection = (Connection) method.invoke( null, args );                        result = addSession( theConnection, name );                }                catch (java.lang.reflect.InvocationTargetException ite) {                        Throwable t = ite.getTargetException();                        if (t instanceof SQLException)                                {if (true) throw (SQLException) t;}                        {if (true) throw new SQLException( t.toString() );}                }                catch (Exception e) { {if (true) throw new SQLException( e.toString() );} }                {if (true) return result;}    throw new Error("Missing return statement in function");  }/** * SetConnectionStatement is SET CONNECTION ident * <p> * Moves to the named session, if it exists. If it doesn't * exist, remains on the current session and returns an error. */  final public ijResult SetConnectionStatement() throws ParseException, SQLException {        String t;    jj_consume_token(SET);    jj_consume_token(CONNECTION);    t = identifier();                if (!currentConnEnv.haveSession(t)) {                        {if (true) throw ijException.noSuchConnection(t);}                }                currentConnEnv.setCurrentSession(t);                theConnection = currentConnEnv.getConnection();                {if (true) return new ijConnectionResult(theConnection);}    throw new Error("Missing return statement in function");  }/**	Shows the current connections for the current environment. */  final public ijResult ShowConnectionsStatement() throws ParseException, SQLException {    jj_consume_token(SHOW);    jj_consume_token(CONNECTIONS);                {if (true) return showConnectionsMethod(false);}    throw new Error("Missing return statement in function");  }/** * CommitStatement is simply COMMIT. * It commits the current transation. */  final public ijResult CommitStatement() throws ParseException, SQLException {    jj_consume_token(COMMIT);    if (jj_2_67(2)) {      jj_consume_token(WORK);    } else {      ;    }                haveConnection();                theConnection.commit();                {if (true) return null;}    throw new Error("Missing return statement in function");  }/** * RollbackStatement is simply ROLLBACK. * It undoes the current transation. */  final public ijResult RollbackStatement() throws ParseException, SQLException {    jj_consume_token(ROLLBACK);    if (jj_2_68(2)) {      jj_consume_token(WORK);    } else {      ;    }                haveConnection();                theConnection.rollback();                {if (true) return null;}    throw new Error("Missing return statement in function");  }/** * DisconnectStatement is simply DISCONNECT [ ALL | CURRENT | connectionName ] * it ends the specified connection(s) and * releases its statement resource. * <p> * If ALL is specified, it disconnects all available sessions * in the current environment. */  final public ijResult DisconnectStatement() throws ParseException, SQLException {        Token a = null;        String n = null;    jj_consume_token(DISCONNECT);    if (jj_2_72(2)) {      if (jj_2_69(2)) {        jj_consume_token(CURRENT);      } else if (jj_2_70(2)) {        a = jj_consume_token(ALL);      } else if (jj_2_71(2)) {        n = identifier();      } else {        jj_consume_token(-1);        throw new ParseException();      }    } else {      ;    }                if ( a == null ) {                        if (n == null) {                        // only remove the current session                            haveConnection();                            // Also need to release the session object                            currentConnEnv.removeCurrentSession();                            theConnection = null;                        }                        else {                            if (! currentConnEnv.haveSession(n))                                    {if (true) throw ijException.noSuchConnection(n);}                                currentConnEnv.removeSession(n);                            if (currentConnEnv.getSession() == null)                                    theConnection = null;                        }                } else {                        currentConnEnv.removeAllSessions();                        theConnection = null;                }                {if (true) return null;}    throw new Error("Missing return statement in function");  }  final public ijResult ExitStatement() throws ParseException, SQLException {    if (jj_2_73(2)) {      jj_consume_token(EXIT);                {if (true) return quit();}    } else if (jj_2_74(2)) {      jj_consume_token(QUIT);                {if (true) return quit();}    } else {      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }  final public ijResult IllegalStatementName() throws ParseException, SQLException {        Token s = null;    jj_consume_token(PREPARE);    jj_consume_token(PROCEDURE);    jj_consume_token(AS);    s = jj_consume_token(STRING);                // "procedure" is not allowed as a statement name. this is                // because "execute procedure" is a valid Foundation2000                // command                {if (true) throw ijException.illegalStatementName( "procedure" );}    throw new Error("Missing return statement in function");  }  final public ijResult PrepareStatement() throws ParseException, SQLException {        Token t;        String i;        PreparedStatement ps;        String sVal;    jj_consume_token(PREPARE);    i = identifier();    jj_consume_token(AS);    t = jj_consume_token(STRING);                haveConnection();                sVal = stringValue(t.image);                ps = theConnection.prepareStatement(sVal);                JDBCDisplayUtil.checkNotNull(ps,"prepared statement");                currentConnEnv.getSession().addPreparedStatement(i,ps);                // all we want callers to see are the warnings.                SQLWarning w = ps.getWarnings();                ps.clearWarnings();                {if (true) return new ijWarningResult(w);}    throw new Error("Missing return statement in function");  }  final public ijResult GetCursorStatement() throws ParseException, SQLException {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -