@Override public boolean addTransFare(TransFarePO po) throws RemoteException { // TODO Auto-generated method stub String driverID = po.getDriverID(); String orderID = po.getOrderID(); double money = po.getFare(); builder = new SQLBuilder(); builder.InsertInto(tableName, money_col, orderID_col, driverID_col) .Values(money, orderID, driverID); try { builder.excute(); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
public static void main(String[] args) { SQLBuilder sqlBuilder = new SQLBuilder(); // sqlBuilder.Select("T.account","T.balance").From("account").AS("T") // .Where("Balance").EQUALS(150).AND("Income").EQUALS(200); // System.out.println(sqlBuilder.getSQL()); // // sqlBuilder.clear(); // sqlBuilder.InsertInto("account", // "(balance,name,income)").Values("(15,100,'test')"); // System.out.println(sqlBuilder.getSQL()); // sqlBuilder.clear(); sqlBuilder.InsertInto("account").Values(15, 100, "test"); System.out.println(sqlBuilder.getSQL()); // sqlBuilder.clear(); sqlBuilder .Update("account") .Set("Name") .Assign("账户1") .Comma("balance") .Assign(12321.5) .Where("Income") .EQUALS(12345); System.out.println(sqlBuilder.getSQL()); // // sqlBuilder.clear(); // sqlBuilder.Update("account").Set("Name = '账户1'").Comma("balance = 12233") // .Where("Income = 12345"); // System.out.println(sqlBuilder.toString()); // // sqlBuilder.clear(); // sqlBuilder.DeleteFrom("account").Where("Name").EQUALS("账户1"); // System.out.println(sqlBuilder.getSQL()); sqlBuilder.handleString("2015-11-01"); System.out.println(sqlBuilder.getSQL()); sqlBuilder.clear(); sqlBuilder.handleString("2015-11-01 22:15:1"); System.out.println(sqlBuilder.getSQL()); sqlBuilder.clear(); Calendar calendar = Calendar.getInstance(); calendar.set(2015, 11, 11); sqlBuilder .Select("*") .From("stockoutorder") .Where("ins_id") .EQUALS("00110") .AND("time") .Between(calendar) .AND(calendar); System.out.println(sqlBuilder.toString()); sqlBuilder.clear(); sqlBuilder .InsertInto( PaymentListTable.tableName, PaymentListTable.paymentListID_col, PaymentListTable.total_col, PaymentListTable.payer_col, PaymentListTable.date_col, PaymentListTable.passed_col) .Values("11111", 50.3, "小春", Calendar.getInstance(), 0); System.out.println(sqlBuilder.toString()); sqlBuilder.clear(); sqlBuilder .Select("*") .From("billorder") .Where("time") .EQUALS("2015-11-26") .AND("order_id") .LIKE("0010001%"); System.out.println(sqlBuilder); sqlBuilder.clear(); }