Skip to content

Files

Latest commit

 

History

History
59 lines (43 loc) · 1.5 KB

README.md

File metadata and controls

59 lines (43 loc) · 1.5 KB

MySQL Simple

This Dart library aims to simplify and streamline the process of interacting with MySQL databases.

Features

  • Establish a connection to a MySQL database.
  • Execute SQL queries and retrieve results.
  • Create tables with specified column definitions.
  • Retrieve all elements or specific columns from a table.
  • Search for items in the database with various search options.
  • Insert, update, and delete elements in the database.

Getting started

Add the following line to your pubspec.yaml file:

dependencies:
  mysql_client: 0.0.27
  mysqlsimple:
    git: git//github.com/HeNew4/MySQLSimple

Usage

Import MySQL Simple

import 'package:mysqlsimple/mysqlsimple.dart'; 

Demo of MySQL Simple

void main() async {
  // Create Conection
  var db = DataBase('localhost', 'root', 'password', 'colors', 3306);
  // Get All Elements of 'Palette'
  var getAllElements = await db.getAllElements('palette');
  print(getAllElements);

  // Get Element of 'Palette'
  var searchElement = await db.searchElements('palette', 'id', '1');
  print(searchElement);

  // Insert Element of 'Palette'
  await db.insertElement('palette', ['id', 'name', 'hex_code'], ['6', 'white', '#FFFFFF']);

  // Update Element of 'Palette'
  await db.updateElement('palette', '6', [['name', 'White']]);

  // Delete Element of 'Palette'
  await db.deleteElement('palette', '6');
}

Additional information

Contributions are welcome! If you want to improve this library, open an issue or send a pull request.