Skip to content

Commit 9fb63e6

Browse files
committed
Reverted some F# docs by Copilot, because FSharp.Formatting started to crash due to them.
1 parent dcaae87 commit 9fb63e6

7 files changed

Lines changed: 52 additions & 155 deletions

File tree

docs/content/core/sqlite.fsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(*** hide ***)
1+
(*** hide ***)
22
#I @"../../../bin/lib/netstandard2.0"
33
#r "FSharp.Data.SqlProvider.Common.dll"
44
#r "FSharp.Data.SqlProvider.dll"
@@ -95,8 +95,10 @@ let customers =
9595
9696
When you do insert operation, after .SubmitUpdates call you can get inserted rowid like this:
9797
98-
*)
99-
98+
```fsharp
10099
let myCustomer = ctx.Main.Customers.``Create(CompanyName)``("MyCompany")
101100
ctx.SubmitUpdates()
102101
let rowid = myCustomer.GetColumn("rowid") : int
102+
```
103+
104+
*)

src/SQLProvider.Common/Operators.fs

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ type SelectOperations =
100100
module ColumnSchema =
101101

102102
type alias = string
103-
/// <summary>
104103
/// Represents WHERE clause conditions for SQL queries.
105104
/// Supports complex boolean expressions with AND/OR operators and nested conditions.
106-
/// </summary>
107105
type Condition =
108106
// this is (table alias * column name * operator * right hand value ) list * (the same again list)
109107
// basically any AND or OR expression can have N terms and can have N nested condition children
@@ -121,10 +119,8 @@ module ColumnSchema =
121119
/// Expression that cannot be translated to SQL
122120
| NotSupported of System.Linq.Expressions.Expression
123121

124-
/// <summary>
125122
/// Represents SQL functions and operations that can be applied to columns.
126123
/// These operations are translated to database-specific SQL functions.
127-
/// </summary>
128124
and CanonicalOp =
129125
//String functions
130126
/// Extracts a substring from the specified position to the end
@@ -230,9 +226,7 @@ module ColumnSchema =
230226
/// Casts a value to INTEGER type
231227
| CastInt
232228

233-
/// <summary>
234229
/// Represents a column with optional operations applied to it.
235-
/// </summary>
236230
and SqlColumnType =
237231
/// A key column used for grouping or joining
238232
| KeyColumn of string
@@ -241,9 +235,7 @@ module ColumnSchema =
241235
/// A column used in aggregate operations
242236
| GroupColumn of AggregateOperation * SqlColumnType
243237

244-
/// <summary>
245238
/// Represents either a database column or a constant value in SQL expressions.
246-
/// </summary>
247239
// More recursion, because you mighn want to say e.g.
248240
// where (x.Substring(x.IndexOf("."), (x.Length-x.IndexOf("."))
249241
and SqlItemOrColumn =
@@ -252,9 +244,7 @@ module ColumnSchema =
252244
/// A constant value to be used in SQL expressions
253245
| SqlConstant of obj
254246

255-
/// <summary>
256247
/// Represents parameters for SQL projections (SELECT clause elements).
257-
/// </summary>
258248
type ProjectionParameter =
259249
/// A direct entity column reference
260250
| EntityColumn of string
@@ -263,72 +253,52 @@ module ColumnSchema =
263253

264254
// Dummy operators, these are placeholders that are replaced in the expression tree traversal with special server-side operations such as In, Like
265255
// The operators here are used to force the compiler to statically check against the correct types
266-
/// <summary>
256+
267257
/// Contains custom SQL operators for use in query expressions.
268258
/// These operators are translated to their SQL equivalents during query compilation.
269-
/// </summary>
270259
[<AutoOpenAttribute>]
271260
module Operators =
272-
/// <summary>
273261
/// SQL IN operator. Tests if a value exists in a sequence.
274-
/// Example: where (customer.Country |=| ["USA"; "Canada"])
275-
/// </summary>
276-
/// <param name="a">The value to test</param>
277-
/// <param name="b">The sequence to search in</param>
278-
/// <returns>Always false at compile time - replaced with SQL IN during query execution</returns>
262+
/// param a: The value to test
263+
/// param b: The sequence to search in
264+
/// returns: Always false at compile time - replaced with SQL IN during query execution
279265
let (|=|) (a:'a) (b:'a seq) = false
280266

281-
/// <summary>
282267
/// SQL NOT IN operator. Tests if a value does not exist in a sequence.
283-
/// Example: where (customer.Country |<>| ["USA"; "Canada"])
284-
/// </summary>
285-
/// <param name="a">The value to test</param>
286-
/// <param name="b">The sequence to search in</param>
287-
/// <returns>Always false at compile time - replaced with SQL NOT IN during query execution</returns>
268+
/// param a: The value to test
269+
/// param b: The sequence to search in
270+
/// returns: Always false at compile time - replaced with SQL NOT IN during query execution
288271
let (|<>|) (a:'a) (b:'a seq) = false
289272

290-
/// <summary>
291273
/// SQL LIKE operator for pattern matching with wildcards.
292-
/// Example: where (customer.Name =% "John%")
293-
/// </summary>
294-
/// <param name="a">The value to test</param>
295-
/// <param name="b">The pattern to match (use % and _ as wildcards)</param>
296-
/// <returns>Always false at compile time - replaced with SQL LIKE during query execution</returns>
274+
/// param a: The value to test
275+
/// param b: The pattern to match
276+
/// returns: Always false at compile time - replaced with SQL LIKE during query execution
297277
let (=%) (a:'a) (b:string) = false
298278

299-
/// <summary>
300279
/// SQL NOT LIKE operator for negated pattern matching.
301-
/// Example: where (customer.Name <>% "John%")
302-
/// </summary>
303-
/// <param name="a">The value to test</param>
304-
/// <param name="b">The pattern to reject</param>
305-
/// <returns>Always false at compile time - replaced with SQL NOT LIKE during query execution</returns>
280+
/// param a: The value to test
281+
/// param b: The pattern to reject
282+
/// returns>Always false at compile time - replaced with SQL NOT LIKE during query execution
306283
let (<>%) (a:'a) (b:string) = false
307284

308285
/// Left join helper function for internal use
309286
let private leftJoin (a:'a) = a
310287

311-
/// <summary>
312288
/// Left outer join operator. Performs a left join on a related table.
313-
/// Example: for customer in ctx.Main.Customers do
314-
/// for order in (!!) customer.``main.Orders by CustomerID`` do
315-
/// </summary>
316-
/// <param name="a">The related table queryable</param>
317-
/// <returns>A queryable that performs a left outer join</returns>
289+
/// Used after "in" and before the context.tablename
290+
/// param a: The related table queryable
291+
/// A queryable that performs a left outer join
318292
let (!!) (a:IQueryable<'a>) = query { for x in a do select (leftJoin x) }
319293

320-
/// <summary>
321294
/// Calculates the standard deviation of numeric values in a column.
322295
/// Used in aggregate queries with groupBy.
323-
/// </summary>
324-
/// <param name="a">The column value</param>
325-
/// <returns>Always 1m at compile time - replaced with SQL STDDEV during query execution</returns>
296+
/// param a: The column value
297+
/// returns: Always 1m at compile time - replaced with SQL STDDEV during query execution
326298
let StdDev (a:'a) = 1m
327299

328-
/// <summary>
329300
/// Calculates the variance of numeric values in a column.
330301
/// Used in aggregate queries with groupBy.
331-
/// </summary>
332-
/// <param name="a">The column value</param>
333-
/// <returns>Always 1m at compile time - replaced with SQL VARIANCE during query execution</returns>
302+
/// param a: The column value
303+
/// returns: Always 1m at compile time - replaced with SQL VARIANCE during query execution
334304
let Variance (a:'a) = 1m

src/SQLProvider.Common/SqlRuntime.Async.fs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ open FSharp.Data.Sql.Common
88
open FSharp.Data.Sql.Patterns
99
open System.Linq
1010

11-
/// <summary>
1211
/// Provides asynchronous operations for SQL queries.
1312
/// Use these functions when you need to execute queries asynchronously to avoid blocking threads.
14-
/// </summary>
1513
module AsyncOperations =
1614

17-
/// <summary>
1815
/// Executes a queryable asynchronously and returns the results as a sequence.
1916
/// This is useful for executing large queries without blocking the calling thread.
20-
/// </summary>
21-
/// <param name="s">The queryable to execute</param>
22-
/// <returns>A task that yields a sequence of results</returns>
17+
/// param s: The queryable to execute
18+
/// returns: A task that yields a sequence of results
2319
let executeAsync (s:Linq.IQueryable<'T>) =
2420
let inline yieldseq (en: IEnumerator<'T>) =
2521
seq {

src/SQLProvider.Common/SqlRuntime.Common.fs

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ open Microsoft.FSharp.Reflection
1616
open System.Collections.Concurrent
1717
open System.Runtime.Serialization
1818

19-
/// <summary>
2019
/// Specifies the database provider type for the SQL type provider.
2120
/// Each provider has its own specific implementation for SQL generation and data type mapping.
22-
/// </summary>
2321
type DatabaseProviderTypes =
2422
/// Microsoft SQL Server using SqlClient provider
2523
| MSSQLSERVER = 0
@@ -46,16 +44,14 @@ type DatabaseProviderTypes =
4644
/// External/custom database provider
4745
| EXTERNAL = 11
4846

49-
/// <summary>Specifies the direction for relationship navigation.</summary>
47+
/// Specifies the direction for relationship navigation.
5048
type RelationshipDirection =
5149
/// Navigate to child records (foreign key relationships)
5250
Children = 0
5351
/// Navigate to parent records (primary key relationships)
5452
| Parents = 1
5553

56-
/// <summary>
5754
/// Specifies how to handle case sensitivity when generating table and column names.
58-
/// </summary>
5955
type CaseSensitivityChange =
6056
/// Keep original casing from the database
6157
| ORIGINAL = 0
@@ -64,9 +60,7 @@ type CaseSensitivityChange =
6460
/// Convert all names to lowercase
6561
| TOLOWER = 2
6662

67-
/// <summary>
6863
/// Specifies how to represent nullable database columns in the generated types.
69-
/// </summary>
7064
type NullableColumnType =
7165
/// Nullable types are just Unchecked default. (Old false.)
7266
| NO_OPTION = 0
@@ -75,9 +69,7 @@ type NullableColumnType =
7569
/// ValueOption is more performant.
7670
| VALUE_OPTION = 2
7771

78-
/// <summary>
7972
/// Specifies the quote character style for ODBC connections when dealing with table and column names containing spaces or special characters.
80-
/// </summary>
8173
type OdbcQuoteCharacter =
8274
/// Use default quoting for the ODBC driver
8375
| DEFAULT_QUOTE = 0
@@ -87,15 +79,13 @@ type OdbcQuoteCharacter =
8779
| SQUARE_BRACKETS = 2
8880
/// Plain, no special names: alias
8981
| NO_QUOTES = 3 // alias
90-
/// Amazon Redshift style: "alias" & Firebird style too
82+
/// Amazon Redshift style: "alias" and Firebird style too
9183
| DOUBLE_QUOTES = 4
9284
/// Single quote: 'alias'
9385
| APHOSTROPHE = 5
9486

95-
/// <summary>
9687
/// Specifies which SQLite library to use for connections.
9788
/// Different libraries may have different capabilities and platform support.
98-
/// </summary>
9989
type SQLiteLibrary =
10090
/// .NET Framework default
10191
| SystemDataSQLite = 0
@@ -106,16 +96,12 @@ type SQLiteLibrary =
10696
/// Microsoft.Data.Sqlite. May support .NET Standard 2.0 contract in the future.
10797
| MicrosoftDataSqlite = 3
10898

109-
/// <summary>
11099
/// Contains events for monitoring SQL query execution and debugging.
111100
/// Use these events to log, debug, or analyze the SQL queries generated by the type provider.
112-
/// </summary>
113101
module public QueryEvents =
114102

115-
/// <summary>
116103
/// Contains information about a SQL command being executed, including the command text,
117104
/// parameters, and connection information for debugging and monitoring purposes.
118-
/// </summary>
119105
type SqlEventData = {
120106
/// The text of the SQL command being executed.
121107
Command: string
@@ -158,18 +144,9 @@ module public QueryEvents =
158144

159145
let private sqlEvent = Event<SqlEventData>()
160146

161-
/// <summary>
162147
/// Event that fires immediately before the execution of every generated query.
163148
/// Listen to this event to display or debug the content of your queries.
164149
/// This is useful for logging, performance monitoring, and debugging SQL generation.
165-
/// </summary>
166-
/// <example>
167-
/// <code>
168-
/// QueryEvents.SqlQueryEvent.Add(fun event ->
169-
/// printfn "Executing: %s" event.Command
170-
/// printfn "Parameters: %A" event.Parameters)
171-
/// </code>
172-
/// </example>
173150
[<CLIEvent>]
174151
let SqlQueryEvent = sqlEvent.Publish
175152

@@ -206,10 +183,8 @@ module public QueryEvents =
206183
let internal PublishExpression(e) = expressionEvent.Trigger(e)
207184

208185
[<Struct>]
209-
/// <summary>
210186
/// Represents the current state of a database entity for change tracking purposes.
211187
/// Used internally by the SQL provider to determine what operations need to be performed during SubmitUpdates().
212-
/// </summary>
213188
type EntityState =
214189
/// Entity has not been modified since it was loaded
215190
| Unchanged
@@ -222,10 +197,8 @@ type EntityState =
222197
/// Entity has been deleted from the database
223198
| Deleted
224199

225-
/// <summary>
226200
/// Specifies how to handle conflicts when inserting records with duplicate primary keys.
227201
/// Currently supported only on databases that have UPSERT capabilities.
228-
/// </summary>
229202
[<Struct>]
230203
type OnConflict =
231204
/// Throws an exception if the primary key already exists (default behaviour).
@@ -237,16 +210,8 @@ type OnConflict =
237210
/// Currently supported only on PostgreSQL 9.5+
238211
| DoNothing
239212

240-
/// <summary>
241213
/// Attribute for mapping entity properties to database columns with different names.
242214
/// Use this when your database column name differs from your preferred F# property name.
243-
/// </summary>
244-
/// <example>
245-
/// <code>
246-
/// [&lt;MappedColumn("customer_id")&gt;]
247-
/// member x.CustomerId = x.GetColumn&lt;int&gt;("customer_id")
248-
/// </code>
249-
/// </example>
250215
type MappedColumnAttribute(name: string) =
251216
inherit Attribute()
252217
/// Gets the database column name this property maps to
@@ -569,11 +534,9 @@ type SqlEntity(dc: ISqlDataContext, tableName, columns: ColumnLookup, activeColu
569534
override __.ShouldSerializeValue(_) = false })
570535
|> Seq.cast<PropertyDescriptor> |> Seq.toArray )
571536

572-
/// <summary>
573537
/// The main interface for SQL data context operations. This interface provides all the core functionality
574538
/// for querying, creating, updating, and deleting data through the SQL type provider.
575539
/// Users typically access this through the generated GetDataContext() method.
576-
/// </summary>
577540
and ISqlDataContext =
578541
/// Connection string to database
579542
abstract ConnectionString : string
@@ -616,10 +579,8 @@ and ISqlDataContext =
616579
/// Context meant to be read operations only
617580
abstract IsReadOnly : bool
618581

619-
/// <summary>
620582
/// Interface implemented by generated types that provide access to the underlying data context.
621583
/// This allows access to the ISqlDataContext for advanced operations.
622-
/// </summary>
623584
type IWithDataContext =
624585
/// Gets the underlying SQL data context
625586
abstract DataContext : ISqlDataContext

src/SQLProvider.Common/SqlRuntime.Transactions.fs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ namespace FSharp.Data.Sql.Transactions
22

33
open System
44

5-
/// <summary>
65
/// Transaction isolation level for database operations.
76
/// Corresponds to the System.Transactions.IsolationLevel but provides SQL provider specific functionality.
8-
/// </summary>
97
type IsolationLevel =
108
/// Highest isolation level - transactions are completely isolated from each other
119
| Serializable = 0
@@ -24,10 +22,8 @@ type IsolationLevel =
2422
/// Special value to indicate that no transaction should be created
2523
| DontCreateTransaction = 99
2624

27-
/// <summary>
2825
/// Configuration options for database transactions.
2926
/// Corresponds to the System.Transactions.TransactionOptions.
30-
/// </summary>
3127
[<Struct>]
3228
type TransactionOptions = {
3329
/// Maximum time the transaction can remain active before timing out
@@ -36,9 +32,7 @@ type TransactionOptions = {
3632
IsolationLevel : IsolationLevel
3733
}
3834

39-
/// <summary>
4035
/// Utility functions for converting between different transaction isolation level representations.
41-
/// </summary>
4236
module TransactionUtils =
4337
let internal toSystemTransactionsIsolationLevel isolationLevel =
4438
match isolationLevel with
@@ -51,12 +45,10 @@ module TransactionUtils =
5145
| IsolationLevel.Unspecified -> System.Transactions.IsolationLevel.Unspecified
5246
| _ -> failwithf "Unhandled IsolationLevel value: %A." isolationLevel
5347

54-
/// <summary>
5548
/// Converts SQL provider isolation level to System.Data.IsolationLevel.
5649
/// Use this when you need to work directly with ADO.NET connection transactions.
57-
/// </summary>
58-
/// <param name="isolationLevel">The SQL provider isolation level</param>
59-
/// <returns>The corresponding System.Data.IsolationLevel</returns>
50+
/// param isolationLevel: The SQL provider isolation level
51+
/// returns: The corresponding System.Data.IsolationLevel
6052
let toSystemDataIsolationLevel isolationLevel =
6153
match isolationLevel with
6254
| IsolationLevel.Serializable -> System.Data.IsolationLevel.Serializable

0 commit comments

Comments
 (0)