From 390c30d1b687f428bcfa0de778e7fd81f1c0b5b8 Mon Sep 17 00:00:00 2001 From: Yves Mancera Date: Sat, 27 Oct 2018 12:29:13 -0700 Subject: [PATCH 1/2] Mention how to use user defined variables --- Readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Readme.md b/Readme.md index 577cfae65..d3de946ba 100644 --- a/Readme.md +++ b/Readme.md @@ -370,6 +370,14 @@ using (var reader = connection.ExecuteReader("select * from Shapes")) } ``` +User Defined Variables +--------------------- +In order to use Non-parameter SQL variables with MySql Connector, you have to add the following option to your connection string: + +`Allow User Variables=True` + +Make sure you don't provide Dapper with a property to map. + Limitations and caveats --------------------- Dapper caches information about every query it runs, this allows it to materialize objects quickly and process parameters quickly. The current implementation caches this information in a `ConcurrentDictionary` object. Statements that are only used once are routinely flushed from this cache. Still, if you are generating SQL strings on the fly without using parameters it is possible you may hit memory issues. From bb88e8d4eff0a54a9478e8b94202dcad7325e0bc Mon Sep 17 00:00:00 2001 From: Yves Mancera Date: Tue, 30 Oct 2018 05:35:22 -0700 Subject: [PATCH 2/2] Add MySQL to title --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index d3de946ba..771ec3fcb 100644 --- a/Readme.md +++ b/Readme.md @@ -370,7 +370,7 @@ using (var reader = connection.ExecuteReader("select * from Shapes")) } ``` -User Defined Variables +User Defined Variables in MySQL --------------------- In order to use Non-parameter SQL variables with MySql Connector, you have to add the following option to your connection string: