|
1 |
| -SQLWrapper makes it easier to create code wrappers for SQL queries. It's a powerful tool that helps speed up development by reducing the need for manual coding. It works with databases various SQL database (MySQL, MariaDB, ...), checking the syntax and performance of SQL queries before you execute them. |
| 1 | +SQLWrapper makes it easier to create code wrappers for SQL queries. It's a powerful tool that helps speed up development by reducing the need for manual coding. It works with databases various SQL database (MySQL, MariaDB, ...), checking the syntax and performance of SQL queries before you execute them. |
2 | 2 |
|
3 | 3 | It's important to note that SQLWrapper isn't like other tools that map objects to database tables (ORMs). Instead, it directly generates code from your SQL queries and database structure, which performs better than tools like LINQ, EntityFramework, dapper, ... and doesn't have the same limitations.
|
4 | 4 |
|
5 | 5 | One feature is that it can look at your database's structure to check if your SQL queries are correct, and it can create an XML file listing all the data your queries need and return. Then, you can use XSLT templates to turn that XML into code in languages like C#, and more.
|
6 | 6 |
|
7 | 7 | Overall, SQLWrapper is a handy tool for making SQL code easier to work with, saving time, and helping you write better code.
|
8 | 8 |
|
| 9 | +## Links |
| 10 | +* [Change log](https://github.com/daikoz/SQLWrapper/blob/master/CHANGELOG.md) |
| 11 | +* [Official website](https://www.sqlwrapper.com) |
| 12 | +* [Package .NET](https://www.nuget.org/packages/Daikoz.SQLWrapper/) |
| 13 | +* [Documentation](https://github.com/daikoz/SQLWrapper/wiki) |
| 14 | +* [Issues/Bugs](https://github.com/daikoz/SQLWrapper/issues) |
| 15 | +* [Videos](https://www.youtube.com/@SQLWrapper) |
| 16 | +* [Facebook](https://www.facebook.com/sqlwrapper/) |
| 17 | +* [Twitter](https://twitter.com/sqlwrapper) |
| 18 | + |
9 | 19 | ## Getting started with package NuGet Daikoz.SQLWrapper
|
10 | 20 |
|
11 | 21 | **Video of demonstration:**
|
12 | 22 |
|
13 |
| -[](https://www.youtube.com/watch?v=xEeWnESZki0) |
| 23 | +[](https://www.youtube.com/watch?v=xEeWnESZki0) |
14 | 24 |
|
15 | 25 | The .NET package NuGet [Daikoz.SQLWrapper](https://www.nuget.org/packages/Daikoz.SQLWrapper) integrate SQLWrapper in build process of our .NET project.
|
16 | 26 |
|
@@ -85,14 +95,124 @@ To start, follow a minimal configuration file. Modify HOSTNAME, USERID, PASSWORD
|
85 | 95 | * A database helper if generate in file MyDataseHelper.cs
|
86 | 96 | * For each *.sql, a wrapper is generated
|
87 | 97 |
|
| 98 | + |
88 | 99 | ## Getting started with command line SQLWrapper
|
89 | 100 |
|
90 |
| -## Links |
91 |
| -* [Official web](https://www.sqlwrapper.com) |
92 |
| -* [Package .NET](https://www.nuget.org/packages/Daikoz.SQLWrapper/) |
93 |
| -* [Documentation](https://github.com/daikoz/SQLWrapper/wiki) |
94 |
| -* [Issues/Bugs](https://github.com/daikoz/SQLWrapper/issues) |
95 |
| -* [Videos](https://www.youtube.com/@SQLWrapper) |
96 |
| -* [Reddit](https://www.reddit.com/r/sqlwrapper/) |
97 |
| -* [Facebook](https://www.facebook.com/sqlwrapper/) |
98 |
| -* [Twitter](https://twitter.com/sqlwrapper) |
| 101 | +SQLWrapper can be use in console. |
| 102 | + |
| 103 | +### Database |
| 104 | + |
| 105 | +First, extract and cache database structure in XML File: |
| 106 | + |
| 107 | +``` dos |
| 108 | +>SQLWrapper help database |
| 109 | +SQL Wrapper Generator |
| 110 | +Copyright (C) DAIKOZ. All rights reserved. |
| 111 | +USAGE: |
| 112 | +Extract and cache database structure in XML file: |
| 113 | + SQLWrapper database --connectionstring "server=servernamedb;user id=userid;password='password';database=db1" --outputfile sqlwrapper-cachedb.xml --type mariadb --verbose |
| 114 | +
|
| 115 | + -t, --type Required. Type of database: mysql, mariadb. |
| 116 | +
|
| 117 | + -c, --connectionstring Required. List of .net database connection string (https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/connection-string-syntax). |
| 118 | +
|
| 119 | + -o, --outputfile Output XML file (default: stdout). |
| 120 | +
|
| 121 | + -v, --verbose Set output to verbose messages. |
| 122 | +
|
| 123 | + --help Display this help screen. |
| 124 | +
|
| 125 | + --version Display version information. |
| 126 | +``` |
| 127 | + |
| 128 | +**Example:** |
| 129 | + |
| 130 | +``` dos |
| 131 | +SQLWrapper database --connectionstring "server=servernamedb;user id=userid;password='password';database=db1" --outputfile sqlwrapper-cachedb.xml --type mariadb --verbose |
| 132 | +``` |
| 133 | + |
| 134 | +This command connect to **database** of **type** with connection information **connectionstring**. The output is written in **outputfile**. |
| 135 | + |
| 136 | +### Wrapper |
| 137 | + |
| 138 | +Generate the wrapper source code from SQL queries: |
| 139 | + |
| 140 | +``` dos |
| 141 | +>SQLWrapper help wrapper |
| 142 | +SQL Wrapper Generator |
| 143 | +Copyright (C) DAIKOZ. All rights reserved. |
| 144 | +USAGE: |
| 145 | +Generate code from sql request: |
| 146 | + SQLWrapper wrapper --database sqlwrapper-cachedb.xml --inputfiles request1.mysql request2.mysql --outputfile mysqlrequest.cs --params namespace=DAIKOZ classname=SQLWrapper --xslt Template\CSharp\charpADO.xslt |
| 147 | +
|
| 148 | + -d, --database Required. XML file of cache database structure to load. Generate it before with database command |
| 149 | +
|
| 150 | + -i, --inputfiles Required. SQL files. Relative or full path. wildcard * is supported for filename. |
| 151 | +
|
| 152 | + -o, --outputfile Output file |
| 153 | +
|
| 154 | + -p, --params XLST Parameters |
| 155 | +
|
| 156 | + -t, --customtypes Force custom type for database field (table.col=MyEmu |
| 157 | +
|
| 158 | + -x, --xslt XSLT file path to transform XML output. |
| 159 | +
|
| 160 | + -v, --verbose Set output to verbose messages. |
| 161 | +
|
| 162 | + --help Display this help screen. |
| 163 | +
|
| 164 | + --version Display version information. |
| 165 | +``` |
| 166 | + |
| 167 | +**Example:** |
| 168 | + |
| 169 | +``` dos |
| 170 | +SQLWrapper wrapper --database sqlwrapper-cachedb.xml --inputfiles request1.mysql request2.mysql --outputfile mysqlrequest.cs --params namespace=DAIKOZ classname=SQLWrapper --xslt Template\CSharp\charpADO.xslt |
| 171 | +``` |
| 172 | + |
| 173 | +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). |
| 174 | + |
| 175 | +### Helper |
| 176 | + |
| 177 | +Generate a source code helper to help the access to database. For example: the length of all text columns. |
| 178 | + |
| 179 | +``` dos |
| 180 | +>SQLWrapper help helper |
| 181 | +SQL Wrapper Generator |
| 182 | +Copyright (C) DAIKOZ. All rights reserved. |
| 183 | +USAGE: |
| 184 | +Generate code helper to access database: |
| 185 | + SQLWrapper helper --database sqlwrapper-cachedb.xml --outputfile helper.cs --xslt Template\CSharp\helper.xslt |
| 186 | +
|
| 187 | + -d, --database Required. XML file of cache database structure to load. Generate it before with database command |
| 188 | +
|
| 189 | + -o, --outputfile Output file |
| 190 | +
|
| 191 | + -p, --params XLST Parameters |
| 192 | +
|
| 193 | + -t, --customtypes Force custom type for database field (table.col=MyEmu |
| 194 | +
|
| 195 | + -x, --xslt XSLT file path to transform XML output. |
| 196 | +
|
| 197 | + -v, --verbose Set output to verbose messages. |
| 198 | +
|
| 199 | + --help Display this help screen. |
| 200 | +
|
| 201 | + --version Display version information. |
| 202 | +``` |
| 203 | + |
| 204 | +**Example:** |
| 205 | + |
| 206 | +``` dos |
| 207 | +SQLWrapper helper --database sqlwrapper-cachedb.xml --outputfile helper.cs --xslt Template\CSharp\helper.xslt |
| 208 | +``` |
| 209 | + |
| 210 | +This command create a **helper** for **database**. It use **XLST** file to generate the **outputfile**. |
| 211 | + |
| 212 | + |
| 213 | +## Template XLST |
| 214 | + |
| 215 | +In template section, you can found several XLST files to generate wrappers and helpers in several programming language. |
| 216 | +You can create or modify your own and use it with **--xslt** parameter. |
| 217 | + |
| 218 | + |
0 commit comments