Package org.lealone.command

Examples of org.lealone.command.CommandRemote


    @Override
    public synchronized void flush(Session session) {
        HBaseSession s = (HBaseSession) session;
        if (s.getRegionServer() != null) {
            SessionRemote sr = null;
            CommandRemote cr = null;
            try {
                sr = SessionRemotePool.getMasterSessionRemote(s.getOriginalProperties());
                cr = SessionRemotePool.getCommandRemote(sr, "ALTER SEQUENCE " + getSQL() + " NEXT VALUE MARGIN", null, 1);
                //cr.executeUpdate();
                ResultInterface ri = cr.executeQuery(-1, false);
                ri.next();
                valueWithMargin = ri.currentRow()[0].getLong();
                value = valueWithMargin - increment * cacheSize;
            } catch (Exception e) {
                throw DbException.convert(e);
            } finally {
                SessionRemotePool.release(sr);
                if (cr != null)
                    cr.close();
            }
        } else if (s.getMaster() != null) {
            super.flush(session);
        }
    }
View Full Code Here


        return getCommandRemote(sessionRemote, sql, prepared.getParameters(), prepared.getFetchSize());
    }

    public static CommandRemote getCommandRemote(SessionRemote sr, String sql, List<Parameter> parameters, int fetchSize) {
        CommandRemote cr = (CommandRemote) sr.prepareCommand(sql, fetchSize);

        //传递最初的参数值到新的CommandRemote
        if (parameters != null) {
            ArrayList<? extends ParameterInterface> newParams = cr.getParameters();
            for (int i = 0, size = parameters.size(); i < size; i++) {
                newParams.get(i).setValue(parameters.get(i).getParamValue(), true);
            }
        }
View Full Code Here

    }

    @Override
    public synchronized CommandInterface prepareCommand(String sql, int fetchSize) {
        checkClosed();
        return new CommandRemote(this, transferList, sql, fetchSize);
    }
View Full Code Here

                return updateCount;
            } finally {
            }
        } else {
            SessionRemote sr = null;
            CommandRemote cr = null;
            try {
                sr = SessionRemotePool.getMasterSessionRemote(session.getOriginalProperties());
                cr = SessionRemotePool.getCommandRemote(sr, sql, getParameters(), dc.getFetchSize());
                int updateCount = cr.executeUpdate();
                refreshMetaTable();
                return updateCount;
            } catch (Exception e) {
                throw DbException.convert(e);
            } finally {
                SessionRemotePool.release(sr);
                if (cr != null)
                    cr.close();
            }
        }
    }
View Full Code Here

                return dc.query(maxRows);
            } finally {
            }
        } else {
            SessionRemote sr = null;
            CommandRemote cr = null;
            try {
                sr = SessionRemotePool.getMasterSessionRemote(session.getOriginalProperties());
                cr = SessionRemotePool.getCommandRemote(sr, sql, getParameters(), dc.getFetchSize());
                ResultInterface ri = cr.executeQuery(maxRows, false);
                refreshMetaTable();
                return ri;
            } catch (Exception e) {
                throw DbException.convert(e);
            } finally {
                SessionRemotePool.release(sr);
                if (cr != null)
                    cr.close();
            }
        }
    }
View Full Code Here

            int updateCount = iom.internalUpdate();

            if (!servers.isEmpty()) {
                List<CommandInterface> commands = New.arrayList(servers.size());
                for (Map.Entry<String, Map<String, List<String>>> e : servers.entrySet()) {
                    CommandRemote c = SessionRemotePool.getCommandRemote(session, prepared, e.getKey(), //
                            getPlanSQL(insertFromSelect, sortedInsertMode, e.getValue().entrySet()));

                    commands.add(c);
                }

                updateCount += CommandParallel.executeUpdate(commands);
            }

            if (table.isColumnsModified()) {
                table.setColumnsModified(false);
                SessionInterface si = SessionRemotePool.getMasterSessionRemote(session.getOriginalProperties());
                for (Column c : alterColumns) {
                    CommandInterface ci = si.prepareCommand(alterTable + c.getCreateSQL(true), 1);
                    ci.executeUpdate();
                }
            }
            if (isTopTransaction)
                session.commit(false);
View Full Code Here

TOP

Related Classes of org.lealone.command.CommandRemote

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.