@@ -411,6 +411,16 @@ var q = db.From<Person>()
411
411
db .UpdateOnly (new Person { FirstName = " JJ" , LastName = " Hendo" }, onlyFields : q );
412
412
```
413
413
414
+ Using an Object Dictionary:
415
+
416
+ ``` csharp
417
+ var updateFields = new Dictionary <string ,object > {
418
+ [nameof (Person .FirstName )] = " JJ" ,
419
+ };
420
+
421
+ db .UpdateOnly <Person >(updateFields , p => p .LastName == " Hendrix" );
422
+ ```
423
+
414
424
Using a typed SQL Expression:
415
425
416
426
``` csharp
@@ -2107,22 +2117,32 @@ public class PocoTable
2107
2117
2108
2118
[CustomField (" DECIMAL(18,4)" )]
2109
2119
public decimal ? DecimalColumn { get ; set ; }
2120
+
2121
+ [CustomField (OrmLiteVariables .MaxText )] // = {MAX_TEXT}
2122
+ public string MaxText { get ; set ; }
2123
+
2124
+ [CustomField (OrmLiteVariables .MaxTextUnicode )] // = {NMAX_TEXT}
2125
+ public string MaxUnicodeText { get ; set ; }
2110
2126
}
2111
2127
2112
2128
db .CreateTable <PocoTable >();
2113
2129
```
2114
2130
2115
- Generates and executes the following SQL:
2131
+ Generates and executes the following SQL in SQL Server :
2116
2132
2117
2133
``` sql
2118
2134
CREATE TABLE "PocoTable "
2119
2135
(
2120
2136
" Id" INTEGER PRIMARY KEY ,
2121
2137
" CharColumn" CHAR (20 ) NULL ,
2122
- " DecimalColumn" DECIMAL (18 ,4 ) NULL
2123
- );
2138
+ " DecimalColumn" DECIMAL (18 ,4 ) NULL ,
2139
+ " MaxText" VARCHAR (MAX) NULL ,
2140
+ " MaxUnicodeText" NVARCHAR(MAX) NULL
2141
+ );
2124
2142
```
2125
2143
2144
+ > OrmLite replaces any variable placeholders with the value in each RDBMS DialectProvider's ` Variables ` Dictionary.
2145
+
2126
2146
#### Pre / Post Custom SQL Hooks when Creating and Dropping tables
2127
2147
2128
2148
Pre / Post Custom SQL Hooks allow you to inject custom SQL before and after tables are created or dropped, e.g:
@@ -2877,6 +2897,30 @@ public class Table
2877
2897
}
2878
2898
```
2879
2899
2900
+ ### Bitwise operators
2901
+
2902
+ The Typed SqlExpression bitwise operations support depends on the RDBMS used.
2903
+
2904
+ E.g. all RDBMS's support Bitwise ` And ` and ` Or ` operators:
2905
+
2906
+ ``` csharp
2907
+ db .Select <Table >(x => (x .Id | 2 ) == 3 );
2908
+ db .Select <Table >(x => (x .Id & 2 ) == 2 );
2909
+ ```
2910
+
2911
+ All RDBMS Except for SQL Server support bit shift operators:
2912
+
2913
+ ``` csharp
2914
+ db .Select <Table >(x => (x .Id << 1 ) == 4 );
2915
+ db .Select <Table >(x => (x .Id >> 1 ) == 1 );
2916
+ ```
2917
+
2918
+ Whilst only SQL Server and MySQL Support Exclusive Or:
2919
+
2920
+ ``` csharp
2921
+ db .Select <Table >(x => (x .Id ^ 2 ) == 3 );
2922
+ ```
2923
+
2880
2924
## SQL Server Features
2881
2925
2882
2926
### Memory Optimized Tables
0 commit comments