GithubHelp home page GithubHelp logo

vlostman / local-sqlite-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrickmoffitt/local-sqlite-example

1.0 1.0 0.0 6.24 MB

Demonstrates database-driven Electron using local SQLite with SQL.js.

License: MIT License

CSS 9.16% HTML 18.09% JavaScript 72.75%

local-sqlite-example's Introduction

Logo

How to Build an Electron App with a Local SQLite3 Database That's Portable.

This project demonstrates how to install and use a local SQLite3 database in Electron using SQL.js. SQL.js is a port of SQLite to JavaScript, by compiling the SQLite C code with Emscripten. Using only JavaScript means there are no C bindings or node-gyp compilations to deal with.

Updates

January 2018

  • Updated SQL.js to 0.4.0
  • Updated Bootstrap to 4.0.0-beta.3. Form validation was revised to agree with current documentation. Improved responsive layout and UTF-8 support.
  • Dropped all non-functional UI features.

Quick Code Tour

  • The code entry point is in package.json under the key "main". The value is "main.js"
  • main.js calls model.initDb() from model.js which creates a new SQLite3 database from schema.sql. A callback creates a BrowserWindow and loads index.html.
  • index.html loads Bootstrap's CSS in the <head> tag and renderer.js after the closing <body> tag.
  • renderer.js loads Cheerio, jQuery, Bootstrap and it's dependency; Tether.
  • A composed HTML pattern is used to load the markup.
  • The application's database work is all done in model.js. Here you'll find functions to open and close the database as well as functions to select, insert, update, and delete records. Prepared statements are used throughout.
  • The application opens with a list of people. Click a red X to delete a person's record.

People

  • Click a pencil (shown above) to edit a person:

Edit

  • Click Add in the left rail to add a new person record:

Add

Uninstalling

Please note that running this application will install a tiny SQLite database in the folder returned by electron.app.getPath('userData'). To uninstall simply delete this folder.

local-sqlite-example's People

Contributors

patrickmoffitt avatar

Stargazers

Pedro Pimienta M. avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.