Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

highsql

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highsql

High level MySQL utility

  • 1.0.3
  • npm
  • Socket score

Version published
Weekly downloads
10
Maintainers
0
Weekly downloads
 
Created
Source

MySQL Connection Manager

npm version License

A simple and secure Node.js module for managing MySQL database connections.

Features

  • Promise-based: Utilizes mysql2/promise for a modern asynchronous interface.
  • Prepared Statements: Prioritizes security against SQL injection attacks.
  • Flexible Queries: Allows executing arbitrary SQL statements (with caution).

Installation

npm install highsql

Usage

import Connection from 'highsql';

async function main() {
    const conn = new Connection('your_host', 'your_user', 'your_password', 'your_database');
    await conn.connect();

    // Example: Select data
    const [rows, fields] = await conn.select('*', 'users', 'id = 1');

    // Example: Insert data (use prepared statements!)
    await conn.insert('users', '(name, email)', '("Alice", "email@highsql.com")');

    // Example: Update data
    await conn.update('users', 'email = "email@highsql.com"', 'id = 1');

    // Example: Delete data
    await conn.delete('users', 'id = 1');

    await conn.close();
}

main();

Functions table

FunctionDescriptionParametersReturns
connect()Establishes a connection to the MySQL database.NoneNone
close()Closes the connection to the MySQL database.NoneNone
select()Executes a SELECT query.columns, table, where[rows, fields]
insert()Executes an INSERT query.table, columns, valuesNone
update()Executes an UPDATE query.table, set, whereNone
delete()Executes a DELETE query.table, whereNone
query()Executes an arbitrary SQL statement.sql[rows, fields]

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 29 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc