Skip to content

Commit 4a300f3

Browse files
committed
Support temp tables in scripts (thanks @davidtme!)
Closes #2 Closes #3
1 parent c88d853 commit 4a300f3

27 files changed

+4800
-908
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Release notes
22
==============
33

4+
### vNext
5+
6+
* Support temp tables for scripts (thanks [@davidtme](davidtme)!) (#2, #3)
7+
48
### 0.1.2 (2020-12-17)
59

610
* Added package logo

facil_reference.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ rulesets:
143143
skipParamDto: true
144144

145145
- for: SQL/MyScript.sql
146-
# 'params' allows you to specify settings for individual parameters.
146+
147+
# 'params' allows you to specify settings for individual script parameters.
147148
#
148149
# Type inference in scripts is limited due to limitations in SQL Server's
149150
# sp_describe_undeclared_parameters, which Facil uses to get parameter information
@@ -175,6 +176,29 @@ rulesets:
175176
# user-defined table type. Note that table-valued parameters can not be
176177
# nullable.
177178
type: dbo.MultiColNull
179+
180+
# If a script uses temp tables that must be loaded by Facil (effectively acting as
181+
# parameters for the script), place the definitions here. Note that while this
182+
# property can be overridden by later matching script rules, it is not merged (or
183+
# removed); the last specified tempTables array for any given script will be used.
184+
#
185+
# Note that the temp table definitions will be executed during build, so don't do
186+
# anything dangerous here.
187+
tempTables:
188+
# You can supply the definition directly as a string.
189+
- definition: |
190+
CREATE TABLE #myTempTable(
191+
Col1 INT NOT NULL PRIMARY KEY,
192+
Col2 NVARCHAR(100) NULL
193+
)
194+
195+
# If using a single line, remember to enclose in quotes (otherwise everything
196+
# after # will be a YAML comment and not be part of the definition)
197+
- definition: "CREATE TABLE #myTempTable(Col1 INT NOT NULL)"
198+
199+
# You can also specify a path to a SQL file containing the definition. The
200+
# path is relative to your project directory.
201+
- definition: path/to/my/tempTableDefinition.sql
178202

179203

180204
# Facil can generate DTO record types for tables. These can then (automatically or

0 commit comments

Comments
 (0)