PotatoSQLite 1.1.0

Suggested Alternatives

Potato.SQLite 1.1.0

Additional Details

The PotatoSQLite package has been deprecated and is no longer maintained. It has been renamed to Potato.SQLite for better clarity and naming consistency. Please migrate to Potato.SQLite to continue receiving updates and support. Thank you for your understanding.

dotnet add package PotatoSQLite --version 1.1.0
                    
NuGet\Install-Package PotatoSQLite -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PotatoSQLite" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PotatoSQLite" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PotatoSQLite" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PotatoSQLite --version 1.1.0
                    
#r "nuget: PotatoSQLite, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PotatoSQLite@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PotatoSQLite&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PotatoSQLite&version=1.1.0
                    
Install as a Cake Tool

PotatoSQLite Library - README

The PotatoSQLite library is a helper class designed to simplify interactions with SQLite databases in .NET applications. It supports database initialization, data manipulation (CRUD operations), and utility functions for SQLite.

Features

  • Database Initialization: Automatically creates the SQLite database file if it does not exist.
  • CRUD Operations: Provides asynchronous methods to insert, update, delete, and query data.
  • Parameterized Queries: Protects against SQL injection.
  • Flexible Initialization: Allows for optional configuration of base image URIs.

Installation

  1. Add the PotatoSQLite class to your project.
  2. Ensure you have the System.Data.SQLite NuGet package installed.
dotnet add package System.Data.SQLite

Usage

1. Initialize the Helper Class

using PotatoSQLite;

// With base image URI
var helper = new Helper("C:\\databases", "example.db", new Uri("http://example.com/images"));

// Without base image URI
var helperWithoutImage = new Helper("C:\\databases", "example.db");

2. Insert Data

Insert a Collection of Rows
var data = new List<Dictionary<string, object>>
{
    new Dictionary<string, object> { { "Name", "Potato" }, { "Type", "Vegetable" } },
    new Dictionary<string, object> { { "Name", "Tomato" }, { "Type", "Fruit" } },
};

await helper.InsertDataAsync("Products", data);
Insert Data and Get the Last Inserted ID
int lastId = await helper.InsertReturnDataAsync("Products", data);
Console.WriteLine($"Last inserted ID: {lastId}");

3. Query Data

Read All Rows from a Table
var rows = await helper.ReadAllDataAsync("Products");
foreach (var row in rows)
{
    Console.WriteLine(string.Join(", ", row.Select(kvp => $"{kvp.Key}: {kvp.Value}")));
}
Read Data with Conditions
var conditions = new Dictionary<string, object> { { "Type", "Vegetable" } };
var rowsWithConditions = await helper.ReadDataAsync("Products", conditions);

4. Update Data

Update Rows with Specific Conditions
var updatedValues = new Dictionary<string, object> { { "Name", "Sweet Potato" } };
var conditions = new Dictionary<string, object> { { "Name", "Potato" } };

await helper.UpdateDataAsync("Products", updatedValues, conditions);

5. Delete Data

var conditions = new Dictionary<string, object> { { "Name", "Potato" } };

await helper.DeleteDataAsync("Products", conditions);

Notes

  • Connection Management: The library manages database connections internally. You do not need to explicitly open or close connections.
  • Thread Safety: Ensure proper thread synchronization if using the library in multi-threaded applications.
  • SQL Injection Prevention: Always use parameterized queries for safe interactions.

Contributing

Contributions are welcome! If you encounter a bug or want to add new features, feel free to submit a pull request or file an issue.


License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 144 11/23/2024 1.1.0 is deprecated.