方式一:
update tbareainfo set areaname = :areaname, province = :province, updversion = :updversion 1
where areaid = :areaid and updversion = :updversion
方式二:
update tbareainfo set areaname = :areaname, province = :province, city = :city, ofserver = :ofserver,
ofsite = :ofsite, exptype = :exptype, memotext = :memotext, updversion = :updversion 1
where areaid = :areaid and updversion = :updversion
------------------------------------------------------------------------------------------------------------------------------------
方式二:用户即使更新了一个字段,或全部字段,都会把整行的数据提交上来用绑定变量覆盖更新;
即客户端发给数据库的SQL都是固定的.
更新的字段很多(但可能只更新了某一个或几个字段),减少了SQL的硬解析。
------------------------------------------------------------------------------------------------------------------------------------
方式一:根据用户实际修改的字段来确定set中的字段个数,比如修改了areaname,则
update set areaname = :areaname where xxxx=xxx
修改了province ,和city
update set province = :province,city=:city where xxxx=xxx
更新的字段少了,但是增加了SQL的硬解析。
请问这两种方式的优缺点是什么呢?性能有什么区别?