Skip to content

Commit 6782297

Browse files
authored
Update README.md
1 parent 0533dce commit 6782297

File tree

1 file changed

+121
-2
lines changed

1 file changed

+121
-2
lines changed

README.md

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ One feature is that it can look at your database's structure to check if your SQ
66

77
Overall, SQLWrapper is a handy tool for making SQL code easier to work with, saving time, and helping you write better code.
88

9+
910
## Getting started with package NuGet Daikoz.SQLWrapper
1011

1112
**Video of demonstration:**
1213

13-
[![Watch the video](https://raw.githubusercontent.com/daikoz/SQLWrapper/master/img/video.jpg)](https://www.youtube.com/watch?v=xEeWnESZki0)
14+
[![Watch the video](https://img.youtube.com/vi/xEeWnESZki0/hqdefault.jpg)](https://www.youtube.com/watch?v=xEeWnESZki0)
1415

1516
The .NET package NuGet [Daikoz.SQLWrapper](https://www.nuget.org/packages/Daikoz.SQLWrapper) integrate SQLWrapper in build process of our .NET project.
1617

@@ -85,10 +86,128 @@ To start, follow a minimal configuration file. Modify HOSTNAME, USERID, PASSWORD
8586
* A database helper if generate in file MyDataseHelper.cs
8687
* For each *.sql, a wrapper is generated
8788

89+
8890
## Getting started with command line SQLWrapper
8991

92+
SQLWrapper can be use in console.
93+
94+
### Database
95+
96+
First, extract and cache database structure in XML File:
97+
98+
``` dos
99+
>SQLWrapper help database
100+
SQL Wrapper Generator
101+
Copyright (C) DAIKOZ. All rights reserved.
102+
USAGE:
103+
Extract and cache database structure in XML file:
104+
SQLWrapper database --connectionstring "server=servernamedb;user id=userid;password='password';database=db1" --outputfile sqlwrapper-cachedb.xml --type mariadb --verbose
105+
106+
-t, --type Required. Type of database: mysql, mariadb.
107+
108+
-c, --connectionstring Required. List of .net database connection string (https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/connection-string-syntax).
109+
110+
-o, --outputfile Output XML file (default: stdout).
111+
112+
-v, --verbose Set output to verbose messages.
113+
114+
--help Display this help screen.
115+
116+
--version Display version information.
117+
```
118+
119+
**Example:**
120+
121+
``` dos
122+
SQLWrapper database --connectionstring "server=servernamedb;user id=userid;password='password';database=db1" --outputfile sqlwrapper-cachedb.xml --type mariadb --verbose
123+
```
124+
125+
This command connect to **database** of **type** with connection information **connectionstring**. The output is written in **outputfile**.
126+
127+
### Wrapper
128+
129+
Generate the wrapper source code from SQL queries:
130+
131+
``` dos
132+
>SQLWrapper help wrapper
133+
SQL Wrapper Generator
134+
Copyright (C) DAIKOZ. All rights reserved.
135+
USAGE:
136+
Generate code from sql request:
137+
SQLWrapper wrapper --database sqlwrapper-cachedb.xml --inputfiles request1.mysql request2.mysql --outputfile mysqlrequest.cs --params namespace=DAIKOZ classname=SQLWrapper --xslt Template\CSharp\charpADO.xslt
138+
139+
-d, --database Required. XML file of cache database structure to load. Generate it before with database command
140+
141+
-i, --inputfiles Required. SQL files. Relative or full path. wildcard * is supported for filename.
142+
143+
-o, --outputfile Output file
144+
145+
-p, --params XLST Parameters
146+
147+
-t, --customtypes Force custom type for database field (table.col=MyEmu
148+
149+
-x, --xslt XSLT file path to transform XML output.
150+
151+
-v, --verbose Set output to verbose messages.
152+
153+
--help Display this help screen.
154+
155+
--version Display version information.
156+
```
157+
158+
**Example:**
159+
160+
``` dos
161+
SQLWrapper wrapper --database sqlwrapper-cachedb.xml --inputfiles request1.mysql request2.mysql --outputfile mysqlrequest.cs --params namespace=DAIKOZ classname=SQLWrapper --xslt Template\CSharp\charpADO.xslt
162+
```
163+
164+
This command create a **wrapper** from **database** for 2 queries defined in **inputfiles**. It use the **XSLT** file to generate the **outputfile**. **params** give parameters defined in **XLST** file (here the namespace).
165+
166+
### Helper
167+
168+
Generate a source code helper to help the access to database. For example: the length of all text columns.
169+
170+
``` dos
171+
>SQLWrapper help helper
172+
SQL Wrapper Generator
173+
Copyright (C) DAIKOZ. All rights reserved.
174+
USAGE:
175+
Generate code helper to access database:
176+
SQLWrapper helper --database sqlwrapper-cachedb.xml --outputfile helper.cs --xslt Template\CSharp\helper.xslt
177+
178+
-d, --database Required. XML file of cache database structure to load. Generate it before with database command
179+
180+
-o, --outputfile Output file
181+
182+
-p, --params XLST Parameters
183+
184+
-t, --customtypes Force custom type for database field (table.col=MyEmu
185+
186+
-x, --xslt XSLT file path to transform XML output.
187+
188+
-v, --verbose Set output to verbose messages.
189+
190+
--help Display this help screen.
191+
192+
--version Display version information.
193+
```
194+
195+
**Example:**
196+
197+
``` dos
198+
SQLWrapper helper --database sqlwrapper-cachedb.xml --outputfile helper.cs --xslt Template\CSharp\helper.xslt
199+
```
200+
201+
This command create a **helper** for **database**. It use **XLST** file to generate the **outputfile**.
202+
203+
204+
## Template XLST
205+
206+
In template section, you can found several XLST files to generate wrappers and helpers in several programming language.
207+
You can create or modify your own and use it with **--xslt** parameter.
208+
90209
## Links
91-
* [Official web](https://www.sqlwrapper.com)
210+
* [Official website](https://www.sqlwrapper.com)
92211
* [Package .NET](https://www.nuget.org/packages/Daikoz.SQLWrapper/)
93212
* [Documentation](https://github.com/daikoz/SQLWrapper/wiki)
94213
* [Issues/Bugs](https://github.com/daikoz/SQLWrapper/issues)

0 commit comments

Comments
 (0)