Skip to content

βœ”πŸŒ Multiple wrapper-classes for several languages and DB-Types

License

Notifications You must be signed in to change notification settings

TobiHatti/WrapSql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

95 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WrapSQL

GitHub GitHub Release Date GitHub release (latest by date including pre-releases) Nuget GitHub last commit GitHub issues GitHub language count

image

Nuget Nuget Nuget Nuget Nuget

Multiple wrapper-classes for several languages and DB-Types

Supported Languages and DB-Types

  • .Net (C#, F#, VB.Net)
    • MySQL
    • SQLite
    • ODBC
    • OleDb
  • PHP
    • MySQL

How to get the right version for your project

.Net:

Download the latest version of WrapSQL as a nuget-package from nuget.org or GitHub Packages.

  • WrapMySQL:

    • via command-line: Install-Package Endev.WrapSQL.WrapMySQL
    • Download on nuget.org
  • WrapSQLite:

    • via command-line: Install-Package Endev.WrapSQL.WrapSQLite
    • Download on nuget.org
  • WrapODBC:

    • via command-line: Install-Package Endev.WrapSQL.WrapODBC
    • Download on nuget.org
  • WrapOleDB:

    • via command-line: Install-Package Endev.WrapSQL.WrapOleDB
    • Download on nuget.org

PHP:

Get the latest version from the releases page

Documentation

Quick overview

The following methods/function exists for every port of WrapSQL in every language. Check corresponding readme for additional features.

// Creating a WrapSQL-Object (e.g. WrapMySQL)
using(WrapMySQL sql = new WrapMySQL("--- MySQL Connection String ---"))
{
    // Executes a non-query statement, e.g. UPDATE, INSERT, DELETE, ...
    sql.ExecuteNonQuery("UPDATE customers SET Firstname = ? WHERE ID = ?", firstName, customerID);

    // Returns a single value from a select-statement
    int completedOrderCount = sql.ExecuteScalar<int>("SELECT COUNT(*) FROM orders WHERE completed = ?", true);

    // Returns all effected rows retrieved by the select-statement
    using (MySQLDataReader reader = (MySQLDataReader)sql.ExecuteQuery("SELECT * FROM orders"))
    {
        while (reader.Read())
        {
            Console.WriteLine(reader["orderStatus"]);
        }
    }
}