可能有点愚蠢的问题,但我坚持不懈。
这是我的动态INSERT查询,使用Spring的import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window : UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow()
window!.rootViewController = UIViewController()
window!.rootViewController!.view.backgroundColor = .blue
window!.makeKeyAndVisible()
let a = AlertView()
a.show()
return true
}
}
class AlertView : UIViewController,UIAlertViewDelegate{
var done : ((_ buttonIndex: Int)->Void)?
func show(){
var createAccountErrorAlert: UIAlertView = UIAlertView()
createAccountErrorAlert.delegate = self
createAccountErrorAlert.title = "Oops"
createAccountErrorAlert.message = "Could not create account!"
createAccountErrorAlert.addButton(withTitle: "Dismiss")
createAccountErrorAlert.addButton(withTitle: "Retry")
createAccountErrorAlert.show()
}
func alertView(_ alertView: UIAlertView, clickedButtonAt buttonIndex: Int){
print("Why delegate of alert view does not work?")
}
}
getJdbcTemplate().queryForObject()
以下是示例请求:
StringBuilder sb = new StringBuilder();
sb.append("INSERT INTO goods_temp (item_title, item_descr, item_email, item_phone, item_images, item_price, owner, dateTime_created, category_id, subcategory_id, repost_to, type_sell");
if(condo.getTitle()!=null){sb.append(", condo_name");}
if(condo.getAddress()!=null){sb.append(", condo_address");}
if(condo.getCity()!=null){sb.append(", condo_city");}
if(condo.getCountry()!=null){sb.append(", condo_country");}
if(condo.getLatitude()!=null){sb.append(", condo_latitude");}
if(condo.getLongitude()!=null){sb.append(", condo_longitude");}
if(condo.getLocationType()!=null){sb.append(", condo_location_type");}
if(item.getExtra_data()!=null){sb.append(", extra_data");}
sb.append(") ");
sb.append("VALUES ( ");
sb.append("'"+item.getItemTitle().replaceAll("\'s", "").replaceAll("[-+.^:,']","").trim()+"'");
sb.append(", '"+item.getItemDescr().trim()+"'");
sb.append(", '"+item.getItemEmail().trim()+"'");
sb.append(", '"+item.getItemPhone()+"'");
sb.append(", '"+tempImgArray+"'");
sb.append(", '"+item.getItemPrice()+"'");
sb.append(", '"+item.getOwner()+"'");
sb.append(", "+new Timestamp(item.getTimestamp().getTime()) );
sb.append(", "+item.getCategory_id());
sb.append(", "+item.getSubcategory_id());
sb.append(", '"+tempRepostToArray+"'");
sb.append(", "+item.getType_sell());
if(condo.getTitle()!=null){sb.append(", '"+condo.getTitle()+"'");}
if(condo.getAddress()!=null){sb.append(", '"+condo.getAddress()+"'");}
if(condo.getCity()!=null){sb.append(", '"+condo.getCity()+"'");}
if(condo.getCountry()!=null){sb.append(", '"+condo.getCountry()+"'");}
if(condo.getLatitude()!=null){sb.append(", '"+condo.getLatitude()+"'");}
if(condo.getLongitude()!=null){ sb.append(", '"+condo.getLongitude()+"'");}
if(condo.getLocationType()!=null){sb.append(", '"+condo.getLocationType().stringValue()+"'");}
if(item.getExtra_data()!=null){sb.append(", '"+item.getExtra_data()+"'");}
sb.append(" )");
错误我从中获取:
INSERT INTO goods_temp (item_title, item_descr, item_email, item_phone, item_images, item_price, owner, dateTime_created, category_id, subcategory_id, repost_to, type_sell, condo_name, condo_address, condo_location_type) VALUES ( 'HP Pavilion G7 17inch laptop', 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhh', 'plimpa.contact@gmail.com', '65767657', '{}', '6456', 'plimpa.contact', 2017-07-04 14:53:14.045, 4, 21, '{}', true, 'hgfhgfh', 'fghgfhfghfgh', 'CONDO' ) RETURNING item_id;
问题:
如何跟踪哪些特定字段的格式错误?