Socket
Socket
Sign inDemoInstall

cordova-sqlite-dbfile-plugin

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cordova-sqlite-dbfile-plugin

Connect to sqlite file and interact with it


Version published
Maintainers
1
Install size
29.5 kB
Created

Readme

Source

Sqlite File plugin

A simple plugin to access to a Sqlite File in the device (Not to a sqlite db instantiated in the device nor to create one)

Contributors are welcome.

Platforms supported

  • android
  • iOS (Partial)

Installation

cordova plugin add cordova-sqlite-file-plugin

Easy Use

The object JJdbFile is expose in the window:

Methonds

  • read(options, async, successCallback, errorCallback)
    • options {Object} -
      • useSqlFile: {Boolean} - Define if use a SQL file or a SQL string
      • sqlFilePath: {String} - Path to the SQL file (By now is relative to the asset folder)
      • queryParams: {Array} - Params to replaces in the SQL sentence
      • multiple: {Boolean} - If true, split the sentence in each ; and execute in order
    • async {Boolean} - Define if should use the main thread or not
    • successCallback {Function} - Function to call in plugin success
    • errorCallback {Function} - Function to call in plugin fail
  • execute(options, async, successCallback, errorCallback)
    • options {Object} -
      • useSqlFile: {Boolean} - Define if use a SQL file or a SQL string
      • sqlFilePath: {String} - Path to the SQL file (By now is relative to the asset folder)
      • queryParams: {Array(String|Number)} - Params to replaces in the SQL sentence
      • multiple: {Boolean} - If true, split the sentence in each ; and execute in order
    • async {Boolean} - Define if should use the main thread or not
    • successCallback {Function} - Function to call in plugin success
      • Params:
        • response: {Object} -
          • success: {Boolean} -
          • data: {Any} -
          • message: {String} -
    • errorCallback {Function} - Function to call in plugin fail

Use Example

To Read

var dbFile      = new JJdbFile("path/to/db/file");
dbFile.read({
    useSqlFile  : true
    sqlFilePath : "Path/To/SQL/File"
    queryParams : []
    multiple    : false
}, true, function(response){
    if(response.success){
        console.log("All Ok")
    }
    console.log("Not Ok, success false")
}, function(){
    console.log("Not Ok, fail")
})

There is a big TODO list, but in resume

  • Write a better documentation
  • Support the queries file locations in others locations and not just assets
  • Allow to use SQL sentence (Not just file)
  • It could be valid to connect with an instance (Thinking)

Keywords

FAQs

Last updated on 24 Jan 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc