Package com.commander4j.db

Examples of com.commander4j.db.JDBQuery


  {
    JDBQuery.closeStatement(listStatement);

    String temp = "";

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();

    temp = Common.hostList.getHost(Common.selectedHostID).getSqlstatements().getSQL("JDBPallet.selectWithExpiry");

    query.addText(temp);

    query.addText(" where sscc in (" + mList + ")");

    for (int t = 0; t <= (mItems.size() - 1); t++)
    {
      query.addParameter(mItems.get(t));
    }

    query.appendSort("sscc", "asc");
    query.applyRestriction(false, "none", 0);
    query.bindParams();

    listStatement = query.getPreparedStatement();
  }
View Full Code Here


    catch (SQLException e)
    {
      e.printStackTrace();
    }
   
    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);

    query.clear();

    if (dlg_table.getTableName().toUpperCase().endsWith("SYS_USERS"))
    {
      query.addText("select user_id,user_comment from " + dlg_table.getTableName());
    }
    else
    {
    query.addText("select * from " + dlg_table.getTableName());
    }

    if (((String) jComboBoxCriteria.getSelectedItem()).equals("") == false)
    {
      if (jTextFieldCriteria.getText().equals("") == false)
      {
        String type = "";
        type = dlg_table.getColumnTypeForField((String) jComboBoxCriteria.getSelectedItem());

        if (type.equals("java.math.BigDecimal"))
        {
          query.addParamtoSQL((String) jComboBoxCriteria.getSelectedItem() + " = ", JUtility.stringToBigDecimal(jTextFieldCriteria.getText().toString()));
        }
        if (type.equals("java.lang.String"))
        {
          query.addParamtoSQL((String) jComboBoxCriteria.getSelectedItem() + " LIKE ", "%" + jTextFieldCriteria.getText() + "%");
        }
        if (type.equals("java.sql.Timestamp"))
        {
          query.addParamtoSQL((String) jComboBoxCriteria.getSelectedItem() + " LIKE ", "%" + jTextFieldCriteria.getText() + "%");
        }

      }
    }
   
    if (hideInactive)
    {
      query.addParamtoSQL("ACTIVE = ", "Y");
    }


    query.appendSort(jComboBoxOrderBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    query.applyRestriction(false,"none", 0);

    query.bindParams();

    listStatement = query.getPreparedStatement();
  }
View Full Code Here

    super();
    setIconifiable(true);
    getContentPane().setBackground(Color.WHITE);
    initGUI();

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();
    query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}SYS_LANGUAGE where 1=2"));
    query.bindParams();
    listStatement = query.getPreparedStatement();
    populateList();

    final JHelp help = new JHelp();
    help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_LANGUAGE_ADMIN"));

View Full Code Here

    JDBQuery.closeStatement(listStatement);
   
    String temp = "";

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();

    temp = "select * from {schema}SYS_LANGUAGE";
    query.addText(JUtility.substSchemaName(schemaName, temp));

    if (textFieldText.getText().equals("") == false)
    {
      query.addParamtoSQL("text like ", "%" + textFieldText.getText() + "%");
    }

    if (textFieldResourceKey.getText().equals("") == false)
    {
      query.addParamtoSQL("resource_key like ", "%" + textFieldResourceKey.getText() + "%");
    }

    if (textFieldMnemonic.getText().equals("") == false)
    {
      query.addParamtoSQL("mnemonic = ", textFieldMnemonic.getText());
    }

    query.addParamtoSQL("language_id = ", ((String) comboBoxLanguageID.getSelectedItem()).toString());

    query.appendSort("resource_key,language_id", "asc");

    query.bindParams();
    listStatement = query.getPreparedStatement();
  }
View Full Code Here

  private PreparedStatement buildSQLr()
  {
   
    PreparedStatement result;
   
    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();

    query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}APP_MHN"));

    query.addParamtoSQL("MHN_Number=", jTextFieldMHN.getText());
    query.addParamtoSQL("recorder=", jTextFieldRecorder.getText());
    query.addParamtoSQL("initiator=", jTextFieldInitiator.getText());
    query.addParamtoSQL("authorisor=",jTextFieldAuthorisor.getText());

    if (jTextFieldComment.getText().equals("") == false)
    {
      query.addParamtoSQL("upper(comment) LIKE ", "%" + jTextFieldComment.getText().toUpperCase() + "%");
    }
   
    if (jTextFieldReason.getText().equals("")==false)
    {
      String sel = "";
      if (query.getCriteriaCount()==0)
      {
        sel = " where ";
      }
      else
      {
        sel = " and ";
      }
      query.setCriterialCount(query.getCriteriaCount()+3);
      query.addText(sel+"(reason1 = ? or reason2 = ? or reason3 = ?)");
      query.addParameter(jTextFieldReason.getText());
      query.addParameter(jTextFieldReason.getText());
      query.addParameter(jTextFieldReason.getText());
    }
       
    query.addParamtoSQL("status=", jTextFieldStatus.getSelectedItem().toString());
    query.addParamtoSQL("required_resource=", jTextFieldResource.getText());
   
    if (checkBoxCreatedFrom.isSelected())
    {
    query.addParamtoSQL("date_created>=", JUtility.getTimestampFromDate(dateControlCreatedFrom.getDate()));
    }

    if (checkBoxCreatedTo.isSelected())
    {
    query.addParamtoSQL("date_created<=", JUtility.getTimestampFromDate(dateControlCreatedTo.getDate()));
    }

    if (checkBoxExpectedFrom.isSelected())
    {
      query.addParamtoSQL("date_expected>=", JUtility.getTimestampFromDate(dateControlExpectedFrom.getDate()));
    }

    if (checkBoxExpectedTo.isSelected())
    {
      query.addParamtoSQL("date_expected<=", JUtility.getTimestampFromDate(dateControlExpectedTo.getDate()));
    }

    if (checkBoxResolvedFrom.isSelected())
    {
      query.addParamtoSQL("date_resolved>=", JUtility.getTimestampFromDate(dateControlResolvedFrom.getDate()));
    }

    if (checkBoxResolvedTo.isSelected())
    {
      query.addParamtoSQL("date_resolved<=", JUtility.getTimestampFromDate(dateControlResolvedTo.getDate()));
    }   
   
    query.appendSort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    query.applyRestriction(false,"none",0);
    query.bindParams();
    result = query.getPreparedStatement();
   
    return result;
  }
View Full Code Here

    super();

    lang = new JDBLanguage(Common.selectedHostID, Common.sessionID);

    initGUI();
    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();
    query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}APP_MHN where 1=2"));
    query.applyRestriction(false, "none", 0);
    query.bindParams();
    listStatement = query.getPreparedStatement();
    populateList();

    final JHelp help = new JHelp();
    help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_ADMIN_MHN"));
    {
View Full Code Here

    final JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 30, 150, 255);
    desktopPane.add(scrollPane);

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();
    query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}APP_PALLET where 1=2"));
    query.bindParams();
    listStatement = query.getPreparedStatement();

    list_despatch = new JList4j<JDBDespatch>();
    list_despatch.addListSelectionListener(new ListSelectionListener()
    {
      public void valueChanged(ListSelectionEvent e)
View Full Code Here

    catch (SQLException e)
    {
      e.printStackTrace();
    }

    JDBQuery q = new JDBQuery(Common.selectedHostID, Common.sessionID);
    String temp = "";
    q.clear();

    temp = Common.hostList.getHost(Common.selectedHostID).getSqlstatements().getSQL("JDBPallet.select");

    q.addText(temp);

    if (list_despatch.getModel().getSize() > 0)
    {
      if (list_despatch.getSelectedIndex() >= 0)
      {
        JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

        q.addParamtoSQL("despatch_no <> ", d.getDespatchNo());

      }
    }

    if (textFieldDespatchNo.getText().equals("") == false)
    {
      q.addParamtoSQL("despatch_No = ", textFieldDespatchNo.getText());
    }

    if (textFieldDespatchLocationFrom.getText().equals("") == false)
    {
      q.addParamtoSQL("location_id = ", textFieldDespatchLocationFrom.getText());
    }

    if (textFieldSSCC.getText().equals("") == false)
    {
      q.addParamtoSQL("sscc like ", textFieldSSCC.getText());
    }

    if (textFieldMaterial.getText().equals("") == false)
    {
      q.addParamtoSQL("material like ", textFieldMaterial.getText());
    }

    if (textFieldBatch.getText().equals("") == false)
    {
      q.addParamtoSQL("batch_number like ", textFieldBatch.getText());
    }

    q.addParamtoSQL("Confirmed = ", "Y");

    q.addParamtoSQL("status=", ((String) comboBoxPalletStatus.getSelectedItem()).toString());


    q.appendSort("sscc", "asc");
    q.applyRestriction(jCheckBoxLimit.isSelected(), Common.hostList.getHost(Common.selectedHostID).getDatabaseParameters().getjdbcDatabaseSelectLimit(), spinnerUnassignedLimit.getValue());
    q.bindParams();

    listStatement = q.getPreparedStatement();
  }
View Full Code Here

    final JHelp help = new JHelp();
    help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_LOOKUP"));

    setSequence(dlg_sort_descending);

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();
    query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}"+dlg_table.getTableName()+" where 1=2"));
    query.bindParams();
    listStatement = query.getPreparedStatement();
    buildSQL();
    populateList();
   
    if (JLaunchLookup.dlgAutoExec)
    {
View Full Code Here

    JDBQuery.closeStatement(listStatement);

    String temp = "";

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
    query.clear();

    temp = Common.hostList.getHost(Common.selectedHostID).getSqlstatements().getSQL("JDBQMSample.selectWithLimit");

    query.addText(temp);

    query.addParamtoSQL("sample_id = ", sampleID);

    query.applyRestriction(false, "none", 0);
    query.bindParams();
    listStatement = query.getPreparedStatement();
  }
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBQuery

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.