Package com.orientechnologies.orient.core.command

Examples of com.orientechnologies.orient.core.command.OCommandRequest



  public List<ODocument> get(QueryParams criteria) throws SqlInjectionException, InvalidCriteriaException {
    if (Logger.isTraceEnabled()) Logger.trace("Method Start");
    List<ODocument> result = null;
    OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME, false, criteria);
    try{
      result = DbHelper.selectCommandExecute(command, criteria.getParams());
    }catch (OCommandExecutionException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
     
View Full Code Here


  }
 
  public long getCount(QueryParams criteria) throws SqlInjectionException{
    if (Logger.isTraceEnabled()) Logger.trace("Method Start");
    List<ODocument> result = null;
    OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME, true, criteria);
    try{
      result = DbHelper.selectCommandExecute(command, criteria.getParams());
    }catch (OCommandExecutionException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
     
View Full Code Here

   * @return an OCommandRequest object ready to be passed to the {@link #selectCommandExecute(com.orientechnologies.orient.core.command.OCommandRequest, Object[])} (OCommandRequest, String[])} method
   * @throws SqlInjectionException If the query is not a select statement
   */
  public static OCommandRequest selectCommandBuilder(String from, boolean count, QueryParams criteria) throws SqlInjectionException{
    ODatabaseRecordTx db =  DbHelper.getConnection();
    OCommandRequest command = db.command(new OSQLSynchQuery<ODocument>(
        selectQueryBuilder(from, count, criteria)
        ));
    if (!command.isIdempotent()) throw new SqlInjectionException();
    if (Logger.isDebugEnabled()) Logger.debug("commandBuilder: ");
    if (Logger.isDebugEnabled()) Logger.debug("  " + criteria.toString());
    if (Logger.isDebugEnabled()) Logger.debug("  " + command.toString());
    return command;
  }
View Full Code Here

   * @param theQuery
   * @return
   */
  public static OCommandRequest genericSQLStatementCommandBuilder (String theQuery){
    ODatabaseRecordTx db =  DbHelper.getConnection();
    OCommandRequest command = db.command(new OCommandSQL(theQuery));
    return command;
  }
View Full Code Here

   * @param statement
   * @param params
   * @return
   */
  public static Object genericSQLStatementExecute(String statement, Object[] params){
    OCommandRequest command = genericSQLStatementCommandBuilder(statement);
    Object ret = genericSQLCommandExecute(command,params);
    return ret;
  }
View Full Code Here

    public List<ODocument> getAll(){
        List<ODocument> docs = null;
        QueryParams criteria = QueryParams.getInstance();
        try {
            OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME, false, criteria);
            docs =DbHelper.commandExecute(command,criteria.getParams());
        } catch (SqlInjectionException e) {
            //swallow no injection possible
        }
        return docs;
View Full Code Here

   * @param criteria
   * @return
   * @throws SqlInjectionException
   */
  public List<ODocument>executeQuery(String oclass, QueryParams criteria) throws SqlInjectionException{
    OCommandRequest command = DbHelper.selectCommandBuilder(oclass, false, criteria);
    List<ODocument> result = null;
    try{
      result = DbHelper.selectCommandExecute(command, criteria.getParams());
    }catch (OCommandSQLParsingException e){
      throw new InvalidCriteriaException(e);
View Full Code Here

   * @param commandString
   * @param params
   */
  public void executeCommand(String commandString, Object[] params) {
    ODatabaseRecordTx db =  DbHelper.getConnection();
    OCommandRequest command=db.command(new OCommandSQL(commandString));
    //Logger.debug("########## is in transaction??  : " + db.getTransaction().isActive());
    command.execute(params);
  }
View Full Code Here

    public List<ODocument> getAll(QueryParams params) throws SqlInjectionException{
        if (Logger.isTraceEnabled()) Logger.trace("Method Start");
        List<ODocument> docs= null;
        params = params==null?QueryParams.getInstance():params;
        OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME,params.justCountTheRecords(),params);
        docs = DbHelper.commandExecute(command,params.getParams());

        if (Logger.isTraceEnabled()) Logger.trace("Method End");
        return docs;
    }
View Full Code Here

  public Object execute(final OServer iServer, ODistributedServerManager iManager, final ODatabaseDocumentTx database)
      throws Exception {
    ODistributedServerLog.debug(this, iManager.getLocalNodeName(), getNodeSource(), DIRECTION.IN, "execute command=%s db=%s",
        text.toString(), database.getName());

    final OCommandRequest cmd = database.command(new OCommandSQL(text));

    if (params != null)
      // EXECUTE WITH PARAMETERS
      return cmd.execute(params);

    return cmd.execute();
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.command.OCommandRequest

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.