Examples of Prepared


Examples of org.lealone.command.Prepared

        return null;
    }

    private Prepared parseInTheRegion() {
        String[] regionNames = parseRegionNames();
        Prepared p = parsePrepared();
        p.setLocalRegionNames(regionNames);
        return p;
    }
View Full Code Here

Examples of org.lealone.command.Prepared

        }
    }

    @Override
    protected Prepared parse(String sql) {
        Prepared p = super.parse(sql);

        //TODO
        //1. Master只允许处理DDL
        //2. RegionServer碰到DDL时都转给Master处理
        //        if (session.isMaster() && !(p instanceof DefineCommand) && !(p instanceof TransactionCommand)) {
View Full Code Here

Examples of org.lealone.command.Prepared

     * @param systemSession the system session
     * @param listener the database event listener
     */
    public void execute(Database db, Session systemSession, DatabaseEventListener listener) {
        try {
            Prepared command = systemSession.prepare(sql);
            //System.out.println("execute id: " + id + ", sql=" + sql);
            command.setObjectId(id);
            command.setExecuteDirec(true);
            command.update();
        } catch (DbException e) {
            e = e.addSQL(sql);
            SQLException s = e.getSQLException();
            db.getTrace(Trace.DATABASE).error(s, sql);
            if (listener != null) {
View Full Code Here

Examples of org.lealone.command.Prepared

    }

    public void executeSQL(String sql) {
        try {
            fromZookeeper = true;
            Prepared p = systemSession.prepare(sql, true);
            p.setExecuteDirec(true);
            p.update();
        } finally {
            fromZookeeper = false;
        }
    }
View Full Code Here

Examples of org.lealone.command.Prepared

            // this is a delete
            if (deleteAction == RESTRICT) {
                checkRow(session, oldRow);
            } else {
                int i = deleteAction == CASCADE ? 0 : columns.length;
                Prepared deleteCommand = getDelete(session);
                setWhere(deleteCommand, i, oldRow);
                updateWithSkipCheck(deleteCommand);
            }
        } else {
            // this is an update
            if (updateAction == RESTRICT) {
                checkRow(session, oldRow);
            } else {
                Prepared updateCommand = getUpdate(session);
                if (updateAction == CASCADE) {
                    ArrayList<Parameter> params = updateCommand.getParameters();
                    for (int i = 0, len = columns.length; i < len; i++) {
                        Parameter param = params.get(i);
                        Column refCol = refColumns[i].column;
                        param.setValue(newRow.getValue(refCol.getColumnId()));
                    }
View Full Code Here

Examples of org.lealone.command.Prepared

        buildUpdateSQL();
        buildDeleteSQL();
    }

    private Prepared prepare(Session session, String sql, int action) {
        Prepared command = session.prepare(sql);
        if (action != CASCADE) {
            ArrayList<Parameter> params = command.getParameters();
            for (int i = 0, len = columns.length; i < len; i++) {
                Column column = columns[i].column;
                Parameter param = params.get(i);
                Value value;
                if (action == SET_NULL) {
View Full Code Here

Examples of org.lealone.command.Prepared

    public HBaseSecondaryIndexCursor(HBaseSecondaryIndex index, TableFilter filter, byte[] startKey, byte[] endKey) {
        secondaryIndex = index;
        session = (HBaseSession) filter.getSession();
        HRegionServer rs = session.getRegionServer();

        Prepared p = filter.getPrepared();
        if (!(p instanceof WithWhereClause))
            throw DbException.throwInternalError("not instanceof WithWhereClause: " + p);

        regionName = Bytes.toBytes(((WithWhereClause) p).getWhereClauseSupport().getRegionName());
        if (regionName == null)
            throw DbException.throwInternalError("regionName is null");

        fetchSize = p.getFetchSize();

        if (filter.getSelect() != null)
            columns = filter.getSelect().getColumns(filter);
        else
            columns = Arrays.asList(filter.getTable().getColumns());
View Full Code Here

Examples of org.lealone.command.Prepared

        buff.append(filter.getTable().getSQL());
        Expression filterCondition = filter.getFilterCondition();
        if (filterCondition != null) {
            buff.append(" WHERE ").append(StringUtils.unEnclose(filterCondition.getSQL()));
        }
        Prepared prepared = filter.getSession().prepare(buff.toString(), true);
        subqueryResult = prepared.query(-1);
    }
View Full Code Here

Examples of org.lealone.command.Prepared

     */
    public HBasePrimaryIndexCursor(TableFilter filter, SearchRow first, SearchRow last) {
        session = (HBaseSession) filter.getSession();
        HRegionServer rs = session.getRegionServer();

        Prepared p = filter.getPrepared();
        if (!(p instanceof WithWhereClause))
            throw DbException.throwInternalError("not instanceof WithWhereClause: " + p);

        regionName = Bytes.toBytes(((WithWhereClause) p).getWhereClauseSupport().getRegionName());
        if (regionName == null)
            throw DbException.throwInternalError("regionName is null");

        fetchSize = p.getFetchSize();
        defaultColumnFamilyName = ((HBaseTable) filter.getTable()).getDefaultColumnFamilyNameAsBytes();
        columnCount = filter.getTable().getColumns().length;

        //select语句
        //对于下面两种类型的sql,columns会是null
View Full Code Here

Examples of org.lealone.command.Prepared

        return count;
    }

    private void execute(String sql) {
        try {
            Prepared command = session.prepare(sql);
            if (command.isQuery()) {
                command.query(0);
            } else {
                command.update();
            }
            if (session.getAutoCommit()) {
                session.commit(false);
            }
        } catch (DbException e) {
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.