From 64660a3e5c5b80e1fe71b21c2d604db876fcfd93 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@users.noreply.github.com> Date: Thu, 14 Dec 2023 19:46:43 +0800 Subject: [PATCH] Updated Insert Data (markdown) --- Insert-Data.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Insert-Data.md b/Insert-Data.md index d4e7d83..06392b6 100644 --- a/Insert-Data.md +++ b/Insert-Data.md @@ -117,7 +117,13 @@ bulk insert test reference (10 fields) > The test results are all based on the same operating system, and all are preheated. -## 4. Insert the specified columns +## 4. Dynamic tablename + +```csharp +fsql.Insert(items).AsTable("Topic_201903").ExecuteAffrows(); +``` + +## 5. Insert the specified columns ```csharp var t3 = fsql.Insert(items).InsertColumns(a => a.Title).ExecuteAffrows(); @@ -133,7 +139,7 @@ var t4 = fsql.Insert(items).InsertColumns(a =>new { a.Title, a.Clicks }).Execute //(@Clicks9, @Title9) ``` -## 5. Ignore the specified columns +## 6. Ignore the specified columns ```csharp var t5 = fsql.Insert(items).IgnoreColumns(a => a.CreateTime).ExecuteAffrows(); @@ -149,7 +155,7 @@ var t6 = fsql.Insert(items).IgnoreColumns(a => new { a.Title, a.CreateTime }).Ex //(@Clicks5), (@Clicks6), (@Clicks7), (@Clicks8), (@Clicks9) ``` -## 6. Column Insertion Priority +## 7. Column Insertion Priority ```csharp All Columns < Specified columns (InsertColumns) < Ignored Columns (IgnoreColumns) @@ -159,7 +165,7 @@ All Columns < Specified columns (InsertColumns) < Ignored Columns (IgnoreColumns - Otherwise, when using `InsertColumns` and not using `IgnoreColumns`, only the specified columns are inserted into the database; - Otherwise, in the case of using `IgnoreColumns`, only unspecified columns are inserted into the database. -## 7、Dictionary Insert +## 8、Dictionary Insert ```csharp var dic = new Dictionary(); @@ -169,7 +175,7 @@ dic.Add("name", "xxxx"); fsql.InsertDict(dic).AsTable("table1").ExecuteAffrows(); ``` -## 8. Import table data +## 9. Import table data ```csharp int affrows = fsql.Select() @@ -189,7 +195,7 @@ limit 10 Note: Because `Clicks` and `CreateTime` are not selected, it'll use the value set by the target entity attribute `[Column(InsertValueSql = xx)]`, or the default value of `C#` of the target entity attribute. -## 9. `Insert Ignore Into` (MySql only) +## 10. `Insert Ignore Into` (MySql only) ```csharp fsql.Insert().MySqlIgnoreInto().AppendData(items).ExecuteAffrows(); @@ -198,11 +204,11 @@ fsql.Insert().MySqlIgnoreInto().AppendData(items).ExecuteAffrows(); //(@Clicks5), (@Clicks6), (@Clicks7), (@Clicks8), (@Clicks9) ``` -## 10. `On Duplicate Key Update` (MySql only) +## 11. `On Duplicate Key Update` (MySql only) [More information...](Insert-or-Update#6-on-duplicate-key-update-mysql-only) -## 11. `On Conflict Do Update` (PostgreSQL only) +## 12. `On Conflict Do Update` (PostgreSQL only) [More information...](Insert-or-Update#7-on-conflict-do-update-postgresql-only)