Skip to content
Permalink
Browse files

docs: Fix preparation persistence example

  • Loading branch information...
DanielSchuessler authored and roji committed May 31, 2019
1 parent 4088226 commit 6ee48bd2df7267a6e63f513ffdbff1d5569e74b5
Showing with 4 additions and 4 deletions.
  1. +4 −4 doc/prepare.md
@@ -60,15 +60,15 @@ Starting from 3.2, all prepared statements are persistent - they no longer get c
using (var conn = new NpgsqlConnection(...)
using (var cmd = new NpgsqlCommand("<some_sql>", conn) {
conn.Open();
conn.Prepare(); // First time on this physical connection, Npgsql prepares with PostgreSQL
conn.ExecuteNonQuery();
cmd.Prepare(); // First time on this physical connection, Npgsql prepares with PostgreSQL
cmd.ExecuteNonQuery();
}
using (var conn = new NpgsqlConnection(...)
using (var cmd = new NpgsqlCommand("<some_sql>", conn) {
conn.Open(); // We assume the pool returned the same physical connection used above
conn.Prepare(); // The connection already has a prepared statement for <some_sql>, this doesn't need to do anything
conn.ExecuteNonQuery();
cmd.Prepare(); // The connection already has a prepared statement for <some_sql>, this doesn't need to do anything
cmd.ExecuteNonQuery();
}
```

0 comments on commit 6ee48bd

Please sign in to comment.
You can’t perform that action at this time.