meadow-connection-mssql 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/README.md +15 -15
- package/docs/README.md +2 -2
- package/docs/_brand.json +18 -0
- package/docs/_cover.md +1 -1
- package/docs/_sidebar.md +8 -8
- package/docs/_topbar.md +1 -1
- package/docs/_version.json +3 -3
- package/docs/api/reference.md +1 -1
- package/docs/architecture.md +14 -167
- package/docs/diagrams/connection-lifecycle.excalidraw +2195 -0
- package/docs/diagrams/connection-lifecycle.mmd +28 -0
- package/docs/diagrams/connection-lifecycle.svg +2 -0
- package/docs/diagrams/connection-safety.excalidraw +2962 -0
- package/docs/diagrams/connection-safety.mmd +14 -0
- package/docs/diagrams/connection-safety.svg +2 -0
- package/docs/diagrams/connection-settings-flow.excalidraw +3380 -0
- package/docs/diagrams/connection-settings-flow.mmd +17 -0
- package/docs/diagrams/connection-settings-flow.svg +2 -0
- package/docs/diagrams/ddl-generation-flow.excalidraw +4028 -0
- package/docs/diagrams/ddl-generation-flow.mmd +21 -0
- package/docs/diagrams/ddl-generation-flow.svg +2 -0
- package/docs/diagrams/meadow-integration.excalidraw +2157 -0
- package/docs/diagrams/meadow-integration.mmd +25 -0
- package/docs/diagrams/meadow-integration.svg +2 -0
- package/docs/diagrams/query-execution-models.excalidraw +1969 -0
- package/docs/diagrams/query-execution-models.mmd +17 -0
- package/docs/diagrams/query-execution-models.svg +2 -0
- package/docs/diagrams/system-architecture.excalidraw +2254 -0
- package/docs/diagrams/system-architecture.mmd +31 -0
- package/docs/diagrams/system-architecture.svg +2 -0
- package/docs/index.html +6 -7
- package/docs/retold-catalog.json +148 -132
- package/docs/retold-keyword-index.json +6517 -2938
- package/package.json +8 -8
- package/source/Meadow-Connection-MSSQL.js +47 -1
- package/source/Meadow-MSSQL-Retry.js +47 -3
- package/source/Meadow-Schema-MSSQL.js +42 -0
- package/test/MSSQL-Retry_tests.js +90 -0
- package/docs/css/docuserve.css +0 -327
package/CONTRIBUTING.md
CHANGED
|
@@ -47,4 +47,4 @@ When in doubt, match what the surrounding code does.
|
|
|
47
47
|
|
|
48
48
|
## Repository Structure
|
|
49
49
|
|
|
50
|
-
Each module is its own git repository. The [retold](https://github.com/
|
|
50
|
+
Each module is its own git repository. The [retold](https://github.com/fable-retold/retold) repository tracks module organization but does not contain module source code. Direct your pull request to the specific module repository where your change belongs.
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Meadow Connection MSSQL
|
|
2
2
|
|
|
3
|
+
> **[Read the Meadow-Connection-Mssql Documentation](https://fable-retold.github.io/meadow-connection-mssql/)** - interactive docs with the full API reference.
|
|
4
|
+
|
|
3
5
|
A Microsoft SQL Server connection provider for the Meadow ORM. Wraps [mssql](https://github.com/tediousjs/node-mssql) (Tedious) as a Fable service, providing connection pooling with configurable timeouts, prepared statements, and DDL generation from Meadow table schemas.
|
|
4
6
|
|
|
5
|
-
[
|
|
6
|
-
[](https://badge.fury.io/js/meadow-connection-mssql)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[meadow-connection-mssql on npm](https://www.npmjs.com/package/meadow-connection-mssql) | [MIT License](LICENSE)
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -172,13 +172,13 @@ Generate a safe `DROP TABLE` statement using `IF OBJECT_ID` to check existence b
|
|
|
172
172
|
|
|
173
173
|
Meadow Connection MSSQL is a database connector for the Meadow data access layer:
|
|
174
174
|
|
|
175
|
-
- [meadow](https://github.com/
|
|
176
|
-
- [foxhound](https://github.com/
|
|
177
|
-
- [stricture](https://github.com/
|
|
178
|
-
- [meadow-endpoints](https://github.com/
|
|
179
|
-
- [meadow-connection-mysql](https://github.com/
|
|
180
|
-
- [meadow-connection-sqlite](https://github.com/
|
|
181
|
-
- [fable](https://github.com/
|
|
175
|
+
- [meadow](https://github.com/fable-retold/meadow) -- ORM and data access framework
|
|
176
|
+
- [foxhound](https://github.com/fable-retold/foxhound) -- Query DSL used by Meadow
|
|
177
|
+
- [stricture](https://github.com/fable-retold/stricture) -- Schema definition tool
|
|
178
|
+
- [meadow-endpoints](https://github.com/fable-retold/meadow-endpoints) -- RESTful endpoint generation
|
|
179
|
+
- [meadow-connection-mysql](https://github.com/fable-retold/meadow-connection-mysql) -- MySQL connector
|
|
180
|
+
- [meadow-connection-sqlite](https://github.com/fable-retold/meadow-connection-sqlite) -- SQLite connector
|
|
181
|
+
- [fable](https://github.com/fable-retold/fable) -- Application services framework
|
|
182
182
|
|
|
183
183
|
## Testing
|
|
184
184
|
|
|
@@ -196,10 +196,10 @@ npm run coverage
|
|
|
196
196
|
|
|
197
197
|
## Related Packages
|
|
198
198
|
|
|
199
|
-
- [meadow](https://github.com/
|
|
200
|
-
- [meadow-connection-mysql](https://github.com/
|
|
201
|
-
- [meadow-connection-rocksdb](https://github.com/
|
|
202
|
-
- [fable](https://github.com/
|
|
199
|
+
- [meadow](https://github.com/fable-retold/meadow) -- Data access and ORM
|
|
200
|
+
- [meadow-connection-mysql](https://github.com/fable-retold/meadow-connection-mysql) -- MySQL connection provider
|
|
201
|
+
- [meadow-connection-rocksdb](https://github.com/fable-retold/meadow-connection-rocksdb) -- RocksDB connection provider
|
|
202
|
+
- [fable](https://github.com/fable-retold/fable) -- Application services framework
|
|
203
203
|
|
|
204
204
|
## License
|
|
205
205
|
|
|
@@ -207,4 +207,4 @@ MIT
|
|
|
207
207
|
|
|
208
208
|
## Contributing
|
|
209
209
|
|
|
210
|
-
Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the [Retold Contributing Guide](https://github.com/
|
|
210
|
+
Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the [Retold Contributing Guide](https://github.com/fable-retold/retold/blob/main/docs/contributing.md).
|
package/docs/README.md
CHANGED
|
@@ -155,5 +155,5 @@ Meadow Connection MSSQL sits between the Meadow ORM layer and the SQL Server. It
|
|
|
155
155
|
- [Architecture](architecture.md) -- Design, data flow, and component responsibilities
|
|
156
156
|
- [Schema & Table Creation](schema.md) -- Generate MSSQL tables from Meadow schemas
|
|
157
157
|
- [API Reference](api/reference.md) -- Complete method and property documentation
|
|
158
|
-
- [Meadow](/meadow/
|
|
159
|
-
- [FoxHound](/
|
|
158
|
+
- [Meadow](https://fable-retold.github.io/meadow/) -- The data access layer
|
|
159
|
+
- [FoxHound](https://fable-retold.github.io/foxhound/) -- Query DSL used by Meadow
|
package/docs/_brand.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "meadow-connection-mssql",
|
|
3
|
+
"Name": "Meadow Connection Mssql",
|
|
4
|
+
"Tagline": "Microsoft SQL Server connection provider for Meadow",
|
|
5
|
+
"Palette": "mix",
|
|
6
|
+
"Icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\" width=\"96\" height=\"96\">\n\t\t<defs>\n\t\t\t<clipPath id=\"frame-meadow-connection-mssql-filled-light\">\n\t\t\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\"/>\n\t\t\t</clipPath>\n\t\t</defs>\n\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\" fill=\"#283bde\"/>\n\t\t<g clip-path=\"url(#frame-meadow-connection-mssql-filled-light)\"><path d=\"M 48.00,12.00 L 79.18,30.00 L 79.18,66.00 L 48.00,84.00 L 16.82,66.00 L 16.82,30.00 Z\" fill=\"rgba(255,255,255,0.18)\"/>\n\t\t\t\t\t<circle cx=\"48\" cy=\"48\" r=\"24\" fill=\"#e87e37\"/></g>\n\t\t<text x=\"48\" y=\"50\" text-anchor=\"middle\" dominant-baseline=\"central\"\n\t\t\tfont-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\"\n\t\t\tfont-size=\"28\" font-weight=\"600\"\n\t\t\tfill=\"#ffffff\" letter-spacing=\"-1\">MCM</text>\n\t</svg>",
|
|
7
|
+
"IconType": "svg",
|
|
8
|
+
"Favicon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\" width=\"96\" height=\"96\">\n\t\t<defs>\n\t\t\t<clipPath id=\"fav-meadow-connection-mssql-light\">\n\t\t\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\"/>\n\t\t\t</clipPath>\n\t\t</defs>\n\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\" fill=\"#283bde\"/>\n\t\t<g clip-path=\"url(#fav-meadow-connection-mssql-light)\"><path d=\"M 48.00,12.00 L 79.18,30.00 L 79.18,66.00 L 48.00,84.00 L 16.82,66.00 L 16.82,30.00 Z\" fill=\"rgba(255,255,255,0.22)\"/></g>\n\t\t<text x=\"48\" y=\"50\" text-anchor=\"middle\" dominant-baseline=\"central\"\n\t\t\tfont-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\"\n\t\t\tfont-size=\"60\" font-weight=\"800\"\n\t\t\tfill=\"#ffffff\" letter-spacing=\"-1\">M</text>\n\t</svg>",
|
|
9
|
+
"FaviconDark": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\" width=\"96\" height=\"96\">\n\t\t<defs>\n\t\t\t<clipPath id=\"fav-meadow-connection-mssql-dark\">\n\t\t\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\"/>\n\t\t\t</clipPath>\n\t\t</defs>\n\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\" fill=\"#7d88e6\"/>\n\t\t<g clip-path=\"url(#fav-meadow-connection-mssql-dark)\"><path d=\"M 48.00,12.00 L 79.18,30.00 L 79.18,66.00 L 48.00,84.00 L 16.82,66.00 L 16.82,30.00 Z\" fill=\"rgba(255,255,255,0.22)\"/></g>\n\t\t<text x=\"48\" y=\"50\" text-anchor=\"middle\" dominant-baseline=\"central\"\n\t\t\tfont-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\"\n\t\t\tfont-size=\"60\" font-weight=\"800\"\n\t\t\tfill=\"#101418\" letter-spacing=\"-1\">M</text>\n\t</svg>",
|
|
10
|
+
"Colors": {
|
|
11
|
+
"Primary": "#283bde",
|
|
12
|
+
"Secondary": "#e87e37",
|
|
13
|
+
"PrimaryLight": "#283bde",
|
|
14
|
+
"PrimaryDark": "#7d88e6",
|
|
15
|
+
"SecondaryLight": "#e87e37",
|
|
16
|
+
"SecondaryDark": "#eeb48e"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/docs/_cover.md
CHANGED
|
@@ -16,4 +16,4 @@ A wrapper around the [mssql](https://github.com/tediousjs/node-mssql) npm packag
|
|
|
16
16
|
[Architecture](architecture.md)
|
|
17
17
|
[Schema & Tables](schema.md)
|
|
18
18
|
[API Reference](api/reference.md)
|
|
19
|
-
[GitHub](https://github.com/
|
|
19
|
+
[GitHub](https://github.com/fable-retold/meadow-connection-mssql)
|
package/docs/_sidebar.md
CHANGED
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
- Retold Ecosystem
|
|
25
25
|
|
|
26
|
-
- [Meadow](/meadow/
|
|
27
|
-
- [FoxHound](/
|
|
28
|
-
- [Stricture](/
|
|
29
|
-
- [Meadow Endpoints](/meadow
|
|
30
|
-
- [Meadow Connection MySQL](/meadow
|
|
31
|
-
- [Meadow Connection SQLite](/meadow
|
|
32
|
-
- [Meadow Connection RocksDB](/meadow
|
|
33
|
-
- [Fable](
|
|
26
|
+
- [Meadow](https://fable-retold.github.io/meadow/)
|
|
27
|
+
- [FoxHound](https://fable-retold.github.io/foxhound/)
|
|
28
|
+
- [Stricture](https://fable-retold.github.io/stricture/)
|
|
29
|
+
- [Meadow Endpoints](https://fable-retold.github.io/meadow-endpoints/)
|
|
30
|
+
- [Meadow Connection MySQL](https://fable-retold.github.io/meadow-connection-mysql/)
|
|
31
|
+
- [Meadow Connection SQLite](https://fable-retold.github.io/meadow-connection-sqlite/)
|
|
32
|
+
- [Meadow Connection RocksDB](https://fable-retold.github.io/meadow-connection-rocksdb/)
|
|
33
|
+
- [Fable](https://fable-retold.github.io/fable/)
|
package/docs/_topbar.md
CHANGED
package/docs/_version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Name": "meadow-connection-mssql",
|
|
3
|
-
"Version": "1.0.
|
|
3
|
+
"Version": "1.0.23",
|
|
4
4
|
"Description": "Meadow MSSQL Plugin",
|
|
5
|
-
"GeneratedAt": "2026-
|
|
6
|
-
"GitCommit": "
|
|
5
|
+
"GeneratedAt": "2026-05-26T21:12:28.990Z",
|
|
6
|
+
"GitCommit": "52c4490"
|
|
7
7
|
}
|
package/docs/api/reference.md
CHANGED
|
@@ -6,7 +6,7 @@ Complete method and property documentation for `MeadowConnectionMSSQL`.
|
|
|
6
6
|
|
|
7
7
|
## Class: MeadowConnectionMSSQL
|
|
8
8
|
|
|
9
|
-
Extends `FableServiceProviderBase` from [fable-serviceproviderbase](https://github.
|
|
9
|
+
Extends `FableServiceProviderBase` from [fable-serviceproviderbase](https://fable-retold.github.io/fable-serviceproviderbase/).
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
const libMeadowConnectionMSSQL = require('meadow-connection-mssql');
|
package/docs/architecture.md
CHANGED
|
@@ -6,39 +6,8 @@ Meadow Connection MSSQL bridges the Meadow data access layer and Microsoft SQL S
|
|
|
6
6
|
|
|
7
7
|
## System Architecture
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
subgraph Application
|
|
12
|
-
A[Application Code]
|
|
13
|
-
B[Meadow ORM]
|
|
14
|
-
C[FoxHound Query DSL]
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
subgraph MeadowConnectionMSSQL["Meadow Connection MSSQL"]
|
|
18
|
-
D[MeadowConnectionMSSQL Service]
|
|
19
|
-
E[PreparedStatement Factory]
|
|
20
|
-
F[MSSQL Type Constants]
|
|
21
|
-
G[mssql Connection Pool]
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
subgraph Database["SQL Server"]
|
|
25
|
-
H[Microsoft SQL Server]
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
A -->|doCreate / doRead / doUpdate / doDelete| B
|
|
29
|
-
B -->|setProvider MSSQL| C
|
|
30
|
-
C -->|SQL + Parameters| D
|
|
31
|
-
D -->|Prepared Statements| E
|
|
32
|
-
D -->|Type Definitions| F
|
|
33
|
-
E --> G
|
|
34
|
-
F --> G
|
|
35
|
-
D --> G
|
|
36
|
-
G -->|TDS Protocol| H
|
|
37
|
-
|
|
38
|
-
style MeadowConnectionMSSQL fill:#e8f4f8,stroke:#2E7D74,stroke-width:2px
|
|
39
|
-
style Application fill:#f5f0e8,stroke:#423D37,stroke-width:1px
|
|
40
|
-
style Database fill:#fef3e2,stroke:#c97a2e,stroke-width:1px
|
|
41
|
-
```
|
|
9
|
+
<!-- bespoke diagram: edit diagrams/system-architecture.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
10
|
+

|
|
42
11
|
|
|
43
12
|
---
|
|
44
13
|
|
|
@@ -72,36 +41,8 @@ The `MSSQL` getter exposes the raw `mssql` npm package, giving access to SQL Ser
|
|
|
72
41
|
|
|
73
42
|
## Connection Lifecycle
|
|
74
43
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
participant App as Application
|
|
78
|
-
participant Fable as Fable Instance
|
|
79
|
-
participant MCS as MeadowConnectionMSSQL
|
|
80
|
-
participant Pool as mssql Pool
|
|
81
|
-
participant SQL as SQL Server
|
|
82
|
-
|
|
83
|
-
App->>Fable: new libFable(config)
|
|
84
|
-
App->>Fable: addServiceType('MeadowMSSQLProvider', ...)
|
|
85
|
-
App->>Fable: instantiateServiceProvider('MeadowMSSQLProvider')
|
|
86
|
-
Fable->>MCS: constructor(fable, manifest, hash)
|
|
87
|
-
MCS->>MCS: Copy MSSQL settings from fable.settings
|
|
88
|
-
MCS->>MCS: Default port to 1433
|
|
89
|
-
MCS-->>MCS: connected = false
|
|
90
|
-
|
|
91
|
-
App->>MCS: connectAsync(callback)
|
|
92
|
-
MCS->>Pool: mssql.connect(settings)
|
|
93
|
-
Note over Pool,SQL: Promise-based TDS handshake
|
|
94
|
-
Pool->>SQL: Establish TCP + TDS connection
|
|
95
|
-
SQL-->>Pool: Connected
|
|
96
|
-
Pool-->>MCS: Connection pool ready
|
|
97
|
-
MCS-->>MCS: connected = true
|
|
98
|
-
MCS-->>App: callback(null, pool)
|
|
99
|
-
|
|
100
|
-
App->>Pool: pool.query(sql)
|
|
101
|
-
Pool->>SQL: Execute query (TDS)
|
|
102
|
-
SQL-->>Pool: Result set
|
|
103
|
-
Pool-->>App: Promise resolves with { recordset }
|
|
104
|
-
```
|
|
44
|
+
<!-- bespoke diagram: edit diagrams/connection-lifecycle.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
45
|
+

|
|
105
46
|
|
|
106
47
|
---
|
|
107
48
|
|
|
@@ -109,25 +50,8 @@ sequenceDiagram
|
|
|
109
50
|
|
|
110
51
|
MSSQL supports two distinct query patterns:
|
|
111
52
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
subgraph Direct["Direct Query (pool.query)"]
|
|
115
|
-
A1[SQL String] --> B1[pool.query]
|
|
116
|
-
B1 --> C1[Promise]
|
|
117
|
-
C1 --> D1[result.recordset]
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
subgraph Prepared["Prepared Statement"]
|
|
121
|
-
A2[SQL Template] --> B2[ps.prepare]
|
|
122
|
-
B2 --> C2[ps.input types]
|
|
123
|
-
C2 --> D2[ps.execute params]
|
|
124
|
-
D2 --> E2[result.recordset]
|
|
125
|
-
E2 --> F2[ps.unprepare]
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
style Direct fill:#e8f4f8,stroke:#2E7D74
|
|
129
|
-
style Prepared fill:#f5f0e8,stroke:#423D37
|
|
130
|
-
```
|
|
53
|
+
<!-- bespoke diagram: edit diagrams/query-execution-models.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
54
|
+

|
|
131
55
|
|
|
132
56
|
### Direct Query
|
|
133
57
|
|
|
@@ -158,25 +82,8 @@ Meadow's MSSQL provider uses prepared statements for all CRUD operations.
|
|
|
158
82
|
|
|
159
83
|
## Connection Settings Flow
|
|
160
84
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
A[Constructor Called] --> B{fable.settings.MSSQL exists?}
|
|
164
|
-
B -->|Yes| C[Copy server, port, user, password, database]
|
|
165
|
-
B -->|No| D[No MSSQL config available]
|
|
166
|
-
C --> E{port provided?}
|
|
167
|
-
E -->|Yes| F[Use provided port]
|
|
168
|
-
E -->|No| G[Default to 1433]
|
|
169
|
-
F --> H[Store in this.options]
|
|
170
|
-
G --> H
|
|
171
|
-
|
|
172
|
-
H --> I[connectAsync called]
|
|
173
|
-
I --> J[Build connection settings]
|
|
174
|
-
J --> K[Add hardcoded pool/timeout settings]
|
|
175
|
-
K --> L[mssql.connect with Promise]
|
|
176
|
-
L --> M{Connection success?}
|
|
177
|
-
M -->|Yes| N[Set connected = true]
|
|
178
|
-
M -->|No| O[Pass error to callback]
|
|
179
|
-
```
|
|
85
|
+
<!-- bespoke diagram: edit diagrams/connection-settings-flow.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
86
|
+

|
|
180
87
|
|
|
181
88
|
### Hardcoded Pool Settings
|
|
182
89
|
|
|
@@ -198,29 +105,8 @@ These settings are applied internally and are not currently configurable via Fab
|
|
|
198
105
|
|
|
199
106
|
The `generateCreateTableStatement()` method walks a Meadow table schema and produces MSSQL DDL:
|
|
200
107
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
A[Meadow Table Schema] --> B[Walk Columns Array]
|
|
204
|
-
B --> C{DataType?}
|
|
205
|
-
C -->|ID| D["INT NOT NULL IDENTITY PRIMARY KEY"]
|
|
206
|
-
C -->|GUID| E["VARCHAR(254) DEFAULT '000...'"]
|
|
207
|
-
C -->|ForeignKey| F["INT UNSIGNED NOT NULL DEFAULT 0"]
|
|
208
|
-
C -->|Numeric| G["INT NOT NULL DEFAULT 0"]
|
|
209
|
-
C -->|Decimal| H["DECIMAL(Size)"]
|
|
210
|
-
C -->|String| I["VARCHAR(Size) DEFAULT ''"]
|
|
211
|
-
C -->|Text| J["TEXT"]
|
|
212
|
-
C -->|DateTime| K["DATETIME"]
|
|
213
|
-
C -->|Boolean| L["TINYINT DEFAULT 0"]
|
|
214
|
-
D --> M["CREATE TABLE [dbo].[TableName] (...)"]
|
|
215
|
-
E --> M
|
|
216
|
-
F --> M
|
|
217
|
-
G --> M
|
|
218
|
-
H --> M
|
|
219
|
-
I --> M
|
|
220
|
-
J --> M
|
|
221
|
-
K --> M
|
|
222
|
-
L --> M
|
|
223
|
-
```
|
|
108
|
+
<!-- bespoke diagram: edit diagrams/ddl-generation-flow.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
109
|
+

|
|
224
110
|
|
|
225
111
|
### MSSQL DDL Conventions
|
|
226
112
|
|
|
@@ -235,22 +121,8 @@ flowchart LR
|
|
|
235
121
|
|
|
236
122
|
## Connection Safety
|
|
237
123
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
A[connectAsync called] --> B{Callback provided?}
|
|
241
|
-
B -->|No| C[Log error, create no-op callback]
|
|
242
|
-
B -->|Yes| D{Pool already exists?}
|
|
243
|
-
C --> D
|
|
244
|
-
D -->|Yes| E[Log error with cleansed settings]
|
|
245
|
-
E --> F[Return existing pool via callback]
|
|
246
|
-
D -->|No| G[Log connection details]
|
|
247
|
-
G --> H[mssql.connect with Promise]
|
|
248
|
-
H --> I{Success?}
|
|
249
|
-
I -->|Yes| J[Set pool and connected = true]
|
|
250
|
-
J --> K[Return pool via callback]
|
|
251
|
-
I -->|No| L[Log error]
|
|
252
|
-
L --> M[Return error via callback]
|
|
253
|
-
```
|
|
124
|
+
<!-- bespoke diagram: edit diagrams/connection-safety.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
125
|
+

|
|
254
126
|
|
|
255
127
|
### Password Protection
|
|
256
128
|
|
|
@@ -264,33 +136,8 @@ flowchart TD
|
|
|
264
136
|
|
|
265
137
|
When a Meadow entity sets its provider to `'MSSQL'`, queries follow this path:
|
|
266
138
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
participant App as Application
|
|
270
|
-
participant Meadow as Meadow Entity
|
|
271
|
-
participant FH as FoxHound
|
|
272
|
-
participant Provider as Meadow-Provider-MSSQL
|
|
273
|
-
participant MCS as MeadowConnectionMSSQL
|
|
274
|
-
participant PS as PreparedStatement
|
|
275
|
-
participant Pool as mssql Pool
|
|
276
|
-
|
|
277
|
-
App->>Meadow: doReads(query, callback)
|
|
278
|
-
Meadow->>FH: Build SQL query
|
|
279
|
-
FH-->>Meadow: SQL string + parameters
|
|
280
|
-
Meadow->>Provider: Execute read
|
|
281
|
-
Provider->>MCS: Get preparedStatement
|
|
282
|
-
MCS-->>Provider: New mssql.PreparedStatement
|
|
283
|
-
Provider->>PS: input(name, type) for each param
|
|
284
|
-
Provider->>PS: prepare(sql)
|
|
285
|
-
PS->>Pool: Prepare on pool
|
|
286
|
-
Provider->>PS: execute(params)
|
|
287
|
-
PS->>Pool: Execute prepared query
|
|
288
|
-
Pool-->>PS: Result recordset
|
|
289
|
-
PS-->>Provider: result.recordset
|
|
290
|
-
Provider->>PS: unprepare()
|
|
291
|
-
Provider-->>Meadow: Marshalled records
|
|
292
|
-
Meadow-->>App: callback(error, query, records)
|
|
293
|
-
```
|
|
139
|
+
<!-- bespoke diagram: edit diagrams/meadow-integration.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow-connection-mssql/docs -->
|
|
140
|
+

|
|
294
141
|
|
|
295
142
|
The MSSQL provider uses prepared statements for all operations, with `SCOPE_IDENTITY()` for retrieving auto-generated IDs after inserts.
|
|
296
143
|
|