Examples of createCommand()


Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

    public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException {

        try {
            DAS das = DAS.FACTORY.createDAS(getConnection());
            Command insert = das.createCommand("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate) values (?,?,?,?,?)");
            insert.setParameter(1, new Integer(id));
            insert.setParameter(2, stock.getSymbol());
            insert.setParameter(3, stock.getQuantity());
            insert.setParameter(4, stock.getPurchasePrice());
            insert.setParameter(5, DateConverter.INSTANCE.getColumnValue(stock.getPurchaseDate()));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

    public CustomerProfileData testgetCustomerByLoginIDThroughDASRead(final String logonID) throws Exception {
        InputStream mapping = createConfigStream();
        Connection conn = createConnection();
        DAS das = DAS.FACTORY.createDAS(mapping, conn);
        Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?");

        select.setParameter(1, logonID);

        DataObject root = select.executeQuery();
        conn.close();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

    protected static final String protocol = "jdbc:derby:";

    public void logDeposit(int id, String account, float amount) throws RemoteException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, account);
        insert.setParameter(3, ACCT_ACTION_TYPE_DEPOSIT);
        insert.setParameter(4, new Float(amount));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

         */
    }

    public void logWithdrawal(int id, String account, float amount) throws RemoteException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, account);
        insert.setParameter(3, ACCT_ACTION_TYPE_WITHDRAW);
        insert.setParameter(4, new Float(amount));

View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

         */
    }

    public void logPurchaseStock(int id, StockSummary stock) throws RemoteException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, stock.getSymbol());
        insert.setParameter(3, new Integer(stock.getQuantity()));
        insert.setParameter(4, STOCK_ACTION_TYPE_PURCHASE);
        insert.setParameter(5, new Integer(stock.getPurchaseLotNumber()));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

    public void logSellStock(int id, StockSummary stock, int quantity) throws RemoteException {

        String symbol = ((stock.getSymbol() != null) ? stock.getSymbol() : "null");
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, symbol);
        insert.setParameter(3, new Integer(quantity));
        insert.setParameter(4, STOCK_ACTION_TYPE_SELL);
        insert.setParameter(5, new Integer(stock.getPurchaseLotNumber()));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

            final AccountLog accountLog = accountFactory.createAccountLog();
            InputStream mapping = createConfigStream();

            Connection conn = getConnection();
            DAS das = DAS.FACTORY.createDAS(mapping, conn);
            Command select = das.createCommand("SELECT logSeqNo, accountNumber, actionType, amount FROM acctLog where id = ?");

            select.setParameter(1, customerID);

            DataObject root = select.executeQuery();
            accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry"));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

            select.setParameter(1, customerID);

            DataObject root = select.executeQuery();
            accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry"));

            select = das.createCommand("SELECT logSeqNo, Symbol, quantity, actionType, purchaseLotNumber  FROM stockLog where id = ?");
            select.setParameter(1, customerID);
            root = select.executeQuery();
            accountLog.getStockLogEntries().addAll(root.getList("StockLogEntry"));

            conn.close();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

    }

    public void testPaging() throws SQLException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        // Build command to read all customers
        Command custCommand = das.createCommand("select * from CUSTOMER order by ID");

        // Create a pager with the command
        Pager pager = new PagerImpl(custCommand, 2);

        // Get and work with first page
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()

    }

    public void testRandomPage() throws SQLException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        // Build the select command
        Command select = das.createCommand("select * from CUSTOMER order by ID");

        // Create a pager
        Pager pager = new PagerImpl(select, 2);

        // Get the first page
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.