statement 和 prepared statement?

2018-07-03 17:40 更新

Statement每次執(zhí)行sql語(yǔ)句,數(shù)據(jù)庫(kù)都要執(zhí)行sql語(yǔ)句的編譯. 最好用于僅執(zhí)行一次查詢并返回結(jié)果的情形,效率高于PreparedStatement.

Prepared statements offer better performance, as they are pre-compiled. Use when you plan to use the SQL statements many times.

Prepared statements are more secure because they use bind variables, which can prevent SQL injection attack.

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)