Skip to content

Commit 5f4ab6a

Browse files
author
zzzprojects
committed
Update docs2
Update docs2
1 parent ee58643 commit 5f4ab6a

16 files changed

+158
-158
lines changed

docs2/pages/api/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ permalink: api
66

77
Let take a very short overview with the API
88

9-
{% include template-example.html %}
10-
{% highlight csharp %}
9+
10+
```csharp
1111
SELECT SQLNET::New('x+y').ValueInt('x', 1).ValueInt('y', 2).EvalInt() as Result
12-
{% endhighlight %}
12+
```
1313
{% include component-try-it.html href='http://sqlfiddle.com/#!18/9eecb/1123' %}
1414

1515

docs2/pages/api/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ permalink: configuration
77
Optional stored procedure for License and Configuration
88

99

10-
{% include template-example.html %}
11-
{% highlight csharp %}
10+
11+
```csharp
1212

1313
CREATE PROCEDURE SQLNET_GlobalConfiguration
1414
AS
@@ -31,7 +31,7 @@ return true;
3131
').Eval()
3232

3333
END
34-
{% endhighlight %}
34+
```
3535

3636
## Configuration Register & Unregister
3737

docs2/pages/api/eval.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Evaluate the code or expression and return the result.
1717
- EvalUniqueIdentifier
1818
- EvalVarBinary
1919

20-
{% include template-example.html %}
21-
{% highlight csharp %}
20+
21+
```csharp
2222
DECLARE @sqlnet SQLNET = SQLNET::New('x+y').ValueInt('x', 1).ValueInt('y', 2).Root();
2323

2424
DECLARE @value_variant SQL_VARIANT = @sqlnet.Eval();
@@ -27,7 +27,7 @@ DECLARE @value_decimal DECIMAL(18, 2) = CAST(@sqlnet.Eval() AS DECIMAL(18, 2))
2727

2828
-- SELECT 3, 3, 3.00
2929
SELECT @value_variant as variant , @value_int as int, @value_decimal as decimal
30-
{% endhighlight %}
30+
```
3131
{% include component-try-it.html href='http://sqlfiddle.com/#!18/58568/15' %}
3232

3333
## EvalReadAccess
@@ -50,8 +50,8 @@ Evaluate the code or expression allowing "Read" and return the result.
5050

5151
Evaluate the code or expression and return a new SQLNET object with the result in the parameter name "value"
5252

53-
{% include template-example.html %}
54-
{% highlight csharp %}
53+
54+
```csharp
5555
-- Eval and create a new SQLNET object
5656
DECLARE @sqlnet SQLNET = SQLNET::New('var list = new List<int>() { 1, 2, 3, 4}')
5757
DECLARE @result SQLNET = @sqlnet.EvalSQLNET()
@@ -60,15 +60,15 @@ DECLARE @result SQLNET = @sqlnet.EvalSQLNET()
6060
-- SELECT 4
6161
SELECT @result.Code('value.Count').EvalInt() as Result
6262
Useful to optimize code with object initialization like Regex.
63-
{% endhighlight %}
63+
```
6464
{% include component-try-it.html href='http://sqlfiddle.com/#!18/9eecb/989' %}
6565

6666
## EXEC SQLNET_EvalResultSet
6767

6868
Stored Procedures that evaluate code or expression and return a Result Set.
6969

70-
{% include template-example.html %}
71-
{% highlight csharp %}
70+
71+
```csharp
7272
-- REQUIRE EXTERNAL_ACCESS permission
7373
DECLARE @sqlnet SQLNET = SQLNET::New('
7474
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
@@ -80,7 +80,7 @@ return dir.GetFiles("*.*").Select(x => x.FullName).OrderBy(x => x).ToList();')
8080
-- SELECT * FROM DesktopFiles ORDER BY File.Fullname
8181
EXEC dbo.SQLNET_EvalResultSet @sqlnet
8282
You can output the result to the client or insert it in a table like a normal procedure.
83-
{% endhighlight %}
83+
```
8484

8585

8686
## EvalTVF
@@ -94,8 +94,8 @@ Evaluate the code or expression from a Table-Valued Function (TVF).
9494
- SQLNET_EvalTVF_5 (SQL_VARIANT, ..., SQL_VARIANT)
9595
- SQLNET_EvalTVF_String
9696

97-
{% include template-example.html %}
98-
{% highlight csharp %}
97+
98+
```csharp
9999
CREATE FUNCTION [dbo].[fn_Split]
100100
(
101101
@input VARCHAR(MAX) ,
@@ -117,5 +117,5 @@ GO
117117

118118
-- SPLIT with multiple delimiters (',' and ';')
119119
SELECT * FROM dbo.fn_Split('1, 2, 3; 4; 5', ',|;')
120-
{% endhighlight %}
120+
```
121121
{% include component-try-it.html href='http://sqlfiddle.com/#!18/b738f/2' %}

docs2/pages/api/options.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ permalink: options
66

77
AutoDispose object and delegate from the cache after the code has been evaluated.
88

9-
{% include template-example.html %}
10-
{% highlight csharp %}
9+
10+
```csharp
1111
-- SELECT 3
1212
SELECT SQLNET::New('1+2').AutoDispose().EvalInt() as Result
1313

14-
{% endhighlight %}
14+
```
1515
{% include component-try-it.html href='http://sqlfiddle.com/#!18/9eecb/994' %}
1616

1717
Don't worry, we have you covered! Object and Delegate are automatically disposed after a period of time without activity.
@@ -22,22 +22,22 @@ Sets the code or expression to evaluate.
2222

2323
DECLARE @sqlnet SQLNET = SQLNET::New('')
2424

25-
{% include template-example.html %}
26-
{% highlight csharp %}
25+
26+
```csharp
2727
DECLARE @sqlnet SQLNET = SQLNET::New('')
2828

2929
-- SELECT 3
3030
SELECT @sqlnet.Code('1+2').EvalInt() as Result
3131

32-
{% endhighlight %}
32+
```
3333
{% include component-try-it.html href='http://sqlfiddle.com/#!18/9eecb/1125' %}
3434

3535
## Dispose()
3636

3737
Dispose object and delegate from the cache
3838

39-
{% include template-example.html %}
40-
{% highlight csharp %}
39+
40+
```csharp
4141
DECLARE @sqlnet SQLNET = SQLNET::New('x + y')
4242

4343
SELECT @sqlnet
@@ -59,7 +59,7 @@ SELECT @sqlnet
5959

6060
--Not work because dipose...
6161
SELECT @sqlnet.getcode() as Result
62-
{% endhighlight %}
62+
```
6363
{% include component-try-it.html href='http://sqlfiddle.com/#!18/9eecb/996' %}
6464

6565
Don't worry, we have you covered! Object and Delegate are automatically disposed after a period of time without activity.
@@ -68,8 +68,8 @@ Don't worry, we have you covered! Object and Delegate are automatically disposed
6868

6969
Change the security context to impersonate the credential of the one who runs the T-SQL statements.
7070

71-
{% include template-example.html %}
72-
{% highlight csharp %}
71+
72+
```csharp
7373
-- REQUIRE EXTERNAL_ACCESS permission
7474
DECLARE @sqlnet SQLNET = SQLNET::New('
7575
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
@@ -81,7 +81,7 @@ return dir.GetFiles("*.*").Select(x => x.FullName).OrderBy(x => x).ToList();')
8181
-- SELECT * FROM DesktopFiles ORDER BY File.Fullname
8282
EXEC dbo.SQLNET_EvalResultSet @sqlnet
8383

84-
{% endhighlight %}
84+
```
8585

8686

8787
Impersonate the current execution context under which the routine is executing.
@@ -90,12 +90,12 @@ Impersonate the current execution context under which the routine is executing.
9090

9191
Root is required when the expression already specified value. This feature has been added to allow Parallelism.
9292

93-
{% include template-example.html %}
94-
{% highlight csharp %}
93+
94+
```csharp
9595
DECLARE @sqlnet SQLNET = SQLNET::New('x+y').ValueInt('y', 2).Root()
9696

9797
-- SELECT 3
9898
SELECT @sqlnet.ValueInt('x', 1).EvalInt() as Result
9999

100-
{% endhighlight %}
100+
```
101101
{% include component-try-it.html href='http://sqlfiddle.com/#!18/9eecb/997' %}

docs2/pages/api/value.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Add or update a value associated with the specified key.
2020
- ValueTinyInt
2121
- ValueXml
2222

23-
{% include template-example.html %}
24-
{% highlight csharp %}
23+
24+
```csharp
2525
-- SELECT 3
2626
SELECT SQLNET::New('x+1').ValueInt('x', 2).EvalInt() as Result
2727

@@ -34,7 +34,7 @@ SELECT SQLNET::New('x.Length').ValueBinary('x', 0x11).Eval() as Result
3434
-- SELECT 'ZZZ Projects'
3535
SELECT SQLNET::New('"ZZZ " + x').ValueString('x', 'Projects').Eval() as Result
3636

37-
{% endhighlight %}
37+
```
3838
{% include component-try-it.html href='http://sqlfiddle.com/#!18/009cc/2' %}
3939

4040
For maximum performance, the right Value[Type] should be always used over Val && Value
@@ -51,8 +51,8 @@ For maximum performance, the right Value[Type] should be always used over Val &&
5151
- ValueInt
5252
- ValueTinyInt
5353

54-
{% include template-example.html %}
55-
{% highlight csharp %}
54+
55+
```csharp
5656
DECLARE @x1 INT = NULL;
5757
DECLARE @x2 INT = 2;
5858

@@ -64,22 +64,22 @@ SELECT @sqlnet.ValueNullableInt('x', @x1).EvalInt() as Result
6464
-- SELECT 3
6565
SELECT @sqlnet.ValueNullableInt('x', @x2).EvalInt() as Result
6666

67-
{% endhighlight %}
67+
```
6868
{% include component-try-it.html href='http://sqlfiddle.com/#!18/1cdb6/5' %}
6969

7070
## ValueSQLNET
7171

7272
Add or update a value associated with the specified key. The parameter "value" from the previously resolved expression is used.
7373

74-
{% include template-example.html %}
75-
{% highlight csharp %}
74+
75+
```csharp
7676
DECLARE @sqlnet SQLNET = SQLNET::New('var list = new List<int>() { 1, 2, 3, 4}')
7777
DECLARE @result SQLNET = @sqlnet.EvalSQLNET()
7878

7979
-- SELECT 4
8080
SELECT SQLNET::New('x.Count').ValueSQLNET('x', @result).Eval() AS Result
8181

82-
{% endhighlight %}
82+
```
8383
{% include component-try-it.html href='http://sqlfiddle.com/#!18/3149e/2' %}
8484

8585
## GetValue
@@ -94,13 +94,13 @@ Gets the value associated with the specified key.
9494
- GetValueString(string key)
9595
- GetValueTinyInt(string key)
9696

97-
{% include template-example.html %}
98-
{% highlight csharp %}
97+
98+
```csharp
9999
-- SELECT 1
100100
SELECT SQLNET::New('x + 1').Val('x', 1).GetValue('x') as Result
101101

102102
-- SELECT 1
103103
SELECT SQLNET::New('x + 1').Val('x', 1).GetValueBigInt('x') as Result
104104

105-
{% endhighlight %}
105+
```
106106
{% include component-try-it.html href='http://sqlfiddle.com/#!18/3149e/6' %}

docs2/pages/faq/faq-eval-sql-net.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ You are worried about performance? Don't worry, Eval SQL.NET is super-fast and c
4040

4141
Result highly vary depending of your SQL Server performance and expression to evaluate.
4242

43-
{% include template-example.html %}
44-
{% highlight csharp %}
43+
44+
```csharp
4545

4646
DECLARE @startTime DATETIME,
4747
@endTime DATETIME
@@ -63,7 +63,7 @@ PRINT 'StartTime = ' + CONVERT(VARCHAR(30), @startTime, 121)
6363
PRINT 'EndTime = ' + CONVERT(VARCHAR(30), @endTime, 121)
6464
PRINT 'Duration = ' + CONVERT(VARCHAR(30), @endTime - @starttime, 114)
6565

66-
{% endhighlight %}
66+
```
6767
{% include component-try-it.html href='http://sqlfiddle.com/#!18/3149e/10' %}
6868

6969
## Security
@@ -84,13 +84,13 @@ However if you build the string to evaluate as you build a dynamic SQL, then the
8484

8585
In C#, decimal must be suffixed with "m" to make them valid. By default "1.1" in C# is a double which cannot be added with decimal value.
8686

87-
{% include template-example.html %}
88-
{% highlight csharp %}
87+
88+
```csharp
8989

9090
// Trow exception
9191
SELECT SQLNET::New('(x)+1.1234').Val('x', 1.1).Eval() as Result
9292

9393
-- SELECT 2.2234
9494
SELECT SQLNET::New('(x)+1.1234m').Val('x', 1.1).Eval() as Result
95-
{% endhighlight %}
95+
```
9696
{% include component-try-it.html href='http://sqlfiddle.com/#!18/3149e/11' %}

docs2/pages/problems/sql-server-eval.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Multiple partial solutions exists like using "EXEC(Transact-SQL)" which is limit
99

1010
**SQL Eval.NET** is a complete solution which, not only lets you evaluate dynamic arithmetic expression, but lets you use the full C# language directly in T-SQL stored procedures, functions and triggers.
1111

12-
{% include template-example.html %}
13-
{% highlight csharp %}
12+
13+
```csharp
1414
DECLARE @tableFormula TABLE (Formula VARCHAR(255), X INT, Y INT, Z INT)
1515

1616
INSERT INTO @tableFormula
@@ -21,7 +21,7 @@ VALUES ( 'x+y*z', 1, 2, 3 ),
2121
-- Select_1: 9
2222
SELECT SQLNET::New(Formula).ValueInt('x', X).ValueInt('y', Y).ValueInt('z', Z).EvalInt() as Result
2323
FROM @tableFormula
24-
{% endhighlight %}
24+
```
2525
{% include component-try-it.html href='http://sqlfiddle.com/#!18/2f73a/1' %}
2626

2727
## SQL Eval - Arithmetic / Math Expression
@@ -40,8 +40,8 @@ Eval SQL.NET supports all C# operators including operators precedence and parent
4040

4141
Evaluating an expression is very fast and scalable. You can see performance 3-20x faster than User-Defined Function (UDF) and you can evaluate an expression as much as ONE MILLION times under a second.
4242

43-
{% include template-example.html %}
44-
{% highlight csharp %}
43+
44+
```csharp
4545
DECLARE @items TABLE (Quantity INT, Price MONEY)
4646

4747
INSERT INTO @items
@@ -61,7 +61,7 @@ SELECT * ,
6161
@customColumn.ValueInt('quantity', Quantity).Val('price', Price).EvalString() as Result
6262
FROM @items
6363
WHERE @customFilter.ValueInt('quantity', Quantity).Val('price', Price).EvalBit() = 1
64-
{% endhighlight %}
64+
```
6565
{% include component-try-it.html href='http://sqlfiddle.com/#!18/4ed27/1' %}
6666

6767
## SQL Eval - Dynamic Expression
@@ -83,8 +83,8 @@ Eval SQL.NET is flexible and supports almost all C# keywords and features includ
8383
- Lambda Expression
8484
- LINQ
8585

86-
{% include template-example.html %}
87-
{% highlight csharp %}
86+
87+
```csharp
8888
CREATE PROCEDURE [dbo].[Select_Switch] @x INT, @y INT, @z INT
8989
AS
9090
BEGIN
@@ -113,7 +113,7 @@ EXEC Select_Switch 2, 2, 3
113113
EXEC Select_Switch 3, 2, 3
114114
-- RETURN 8
115115
EXEC Select_Switch 4, 2, 3
116-
{% endhighlight %}
116+
```
117117
{% include component-try-it.html href='http://sqlfiddle.com/#!18/6b73d/2' %}
118118

119119
## SQL Eval - Framework class Library
@@ -130,8 +130,8 @@ You have a complex SQL and you know C# Syntax and C# Object could make this prob
130130

131131
Eval SQL.NET improve readability and maintainability over complex SQL. It supports all [.NET framework class libraries](https://msdn.microsoft.com/en-us/library/gg145045.aspx) (FCL) that are supported by [SQL CLR Framework Libraries](https://docs.microsoft.com/en-us/sql/relational-databases/clr-integration/database-objects/supported-net-framework-libraries).
132132
133-
{% include template-example.html %}
134-
{% highlight csharp %}
133+
134+
```csharp
135135
-- CREATE test
136136
DECLARE @t TABLE (Id INT , Input VARCHAR(MAX))
137137
INSERT INTO @t VALUES ( 1, '1, 2, 3; 4; 5' ), ( 2, '6;7,8;9,10' )
@@ -144,7 +144,7 @@ FROM @t AS A
144144
CROSS APPLY ( SELECT *
145145
FROM dbo.SQLNET_EvalTVF_1(@sqlnet.ValueString('input', Input))
146146
) AS B
147-
{% endhighlight %}
147+
```
148148
{% include component-try-it.html href='http://sqlfiddle.com/#!18/ca1ba/2' %}
149149

150150
## Conclusion

0 commit comments

Comments
 (0)