Batching separate prepared npgsql commands

邮差的信 提交于 2019-12-06 15:27:22

Npgsql supports batching through including several statements in your CommandText, separated by semicolons. These are executed in a single network roundtrip, and can also be prepared:

cmd.CommandText = "SELECT ...; UPDATE ...";
cmd.Prepare();

Internally, Npgsql splits such commands on semicolons and prepares each statement separately (PostgreSQL does not actually recognize batches, only individual statements). In addition, Npgsql manages prepared statements on a statement-by-statement level, and knows to reuse already-existing statements. This means that if you prepare two commands which contain the same statements, those statements will share the same server-side prepared statement resource.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!