Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
expo-sqlite-query-helper
Advanced tools
expo-sqlite
Query Helper 🦮SQLite query helper library for expo-sqlite
yarn add expo-sqlite-query-helper
npm install --save expo-sqlite-query-helper
import { useEffect } from 'react';
import Database, { createTable, insert } from 'expo-sqlite-query-helper';
const App = () => {
Database('myDatabase.db');
useEffect(() => {
createTable('user', {
name: 'TEXT',
email: 'TEXT'
}).then((row, rowAffected, insertID) =>
console.log('success', row, rowAffected, insertID)
);
insert([{ name: 'Jhon', email: 'jhon@test.com' }], 'user')
.then((row, rowAffected, insertID) => {
console.log('success', row, rowAffected, insertID);
})
.catch((e) => console.log(e));
}, []);
};
import Database from "expo-sqlite-query-helper";
Database(databaseName:string, version:string);
databaseName
(String) - Name of the database to create. Default is "esqh.db"
.
Reference: expo-sql
's SQLite.openDatabase
Async function to create new table.
under the hood it runs CREATE TABLE IF NOT EXIST
.
import { createTable } from 'expo-sqlite-query-helper';
createTable(tableName: string, columns: { [key: string]: string });
tableName
- Name of the table to create.
columns
- Column object, key is name of column, value is type & other arguments for columns (as per sqlite).
Async function to run insert data into the table, Takes array of objects to insert into specified table.
under the hood it runs INSERT INTO table (...columns{keys}) values ...(columns{values});
import { insert } from 'expo-sqlite-query-helper';
insert(table: string, data: InsertObject[]);
tableName
- Name of the table to insert data.
data
- array of objects to insert into table.
example: [{name:"test1",email:"test1@emmail.com"},{name:"test2",email:"test2@exmail.com"}]
.
Return promise resolving with
rowsAffected, insertId, lastQuery
Async function to search specified parameter or select everything from the given table.
under the hood it runs SELECT * FROM tableName ?WHERE param{key}=param{value};
import { search } from 'expo-sqlite-query-helper';
search (
tableName: string,
param: InsertObject | null ,
order_by: InsertObject | null,
limit: number | null ,
extra: string = ""
);
tableName
- Name of the table to search.
param: {column:value}
- objects to search.
example: {name:"test1"}
order_by : {column:"ASC"|"DESC"}
- object to order the search result.
example: {id:"DESC"}
limit
- Number of records to return.
extra
- Extra SQL query if any, It will be printed just after SELECT commmand.
Return promise resolving with
rows
, rowsAffected
, insertId
Async function to run update data in the table, Takes an objects to update into specified table & coulumn.
under the hood it runs UPDATE table SET (...data{keys}) values(...data{values}) WHERE where{key}=where{value};
import { update } from 'expo-sqlite-query-helper';
update(
tableName: string,
data: InsertObject,
where: { [key: string]: string }
)
tableName
- Name of the table to insert data.
data
- An objects to Update into table.
example: [{name:"test1",email:"test1@emmail.com"},{name:"test2",email:"test2@exmail.com"}]
.
where
- Object with key as column name & value as value to search in Where clause.
example: {name:"test1"}
.
Return promise resolving with
rowsAffected, insertId, lastQuery
Async function to run delete data from the table, Takes table name and object to delete perticular row.
Note: If we pass only table name, it will delete complete data from the mentioned table
under the hood it runs DELETE FROM table WHERE param{key}=param{value}
import { delete } from 'expo-sqlite-query-helper';
update(
tableName: string,
param: { [key: string]: string },
ectra: string
)
tableName
- Name of the table to insert data.
param
- Object with key as column name & value. Matching row will be deleted.
example: {name:"test1"}
.
Return promise resolving with
rowsAffected, insertId, lastQuery
Async function to Drop a table from database. It takes a table name as arg.
under the hood it runs DROP TABLE IF EXISTS table
.
import { dropTable } from 'expo-sqlite-query-helper';
dropTable(tableName: string);
tableName
- Name of the table to create.
Todo
FAQs
SQLite query helper library for expo-sqlite
The npm package expo-sqlite-query-helper receives a total of 7 weekly downloads. As such, expo-sqlite-query-helper popularity was classified as not popular.
We found that expo-sqlite-query-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.