UtilityPack.SqlBuilder
1.1.3
dotnet add package UtilityPack.SqlBuilder --version 1.1.3
NuGet\Install-Package UtilityPack.SqlBuilder -Version 1.1.3
<PackageReference Include="UtilityPack.SqlBuilder" Version="1.1.3" />
paket add UtilityPack.SqlBuilder --version 1.1.3
#r "nuget: UtilityPack.SqlBuilder, 1.1.3"
// Install UtilityPack.SqlBuilder as a Cake Addin #addin nuget:?package=UtilityPack.SqlBuilder&version=1.1.3 // Install UtilityPack.SqlBuilder as a Cake Tool #tool nuget:?package=UtilityPack.SqlBuilder&version=1.1.3
SqlBuilder
Enum SqlFactoryType
- MANUAL
A totally manual command, the only supported operation is 'SetParam()' that works like a string.replace() - INSERT
An insert command structured like 'INSERT INTO table_name (...) VALUES (...);' - SELECT
A select command structured like 'SELECT .. FROM table_name;' - UPDATE
An update command structured like 'UPDATE table_name SET ...;' - DELETE
A delete command structured like 'DELETE FROM table_name ...;'
Enum SqlFactoryParam
- NULL
When a parameter should be set exactly as the value passed (param = values) - PLUS
When a parameter should be set as an addition of the value passed (param += value) - MINUS
When a parameter should be set as a subtraction of the value passed (param -= value)
Enum SqlFactoryJoin
- INNER
An inner join to attach to a command
Class Database
Methods
CreateManual( string text ) : SqlFactory
Create and return from zero a SqlFactoryCreateSelect( string tableName) : SqlFactory
Create and return a SqlFactory with a SELECT templateCreateInsert( string tableName) : SqlFactory
Create and return a SqlFactory with an INSERT templateCreateUpdate( string tableName) : SqlFactory
Create and return a SqlFactory with an UPDATE templateCreateDelete( string tableName) : SqlFactory
Create and return a SqlFactory with a DELETE templateGetCommand( ) : string
Returns the command clean of all temporary constructs and ready to be inserted into a databaseSetSelect( string index ) : SqlFactory
Set a select option inside the command, valid for SELECT typeSetParam( string index, object value, SqlFactoryParam type) : SqlFactory
Set a parameter inside the command, valid for MANUAL, INSERT and UPDATE typeSetWhere( string index, object value) : SqlFactory
Set where conditions inside the command, valid for SELECT, UPDATE and DELETE typeSetJoin( SqlFactoryJoin joinType, string tableName, string columnSX, string columnDX) : SqlFactory
Set a JOIN inside the command, valid for SELECT type
Example
// Create a new update on table USERS
SqlFactory sql = SqlFactory.CreateUpdate("users");
// Set all the parameters "param = value,"
sql.SetParam("nome", "mario");
sql.SetParam("cognome", "rossi");
sql.SetParam("anni", 30);
// Set a WHERE
sql.SetWhere("id", 106);
// Get the final command
// "UPDATE users SET nome='mario', cognome='rossi', anni=30 WHERE id=106;"
string command = sql.GetCommand();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.