GithubHelp home page GithubHelp logo

retroinfosys / android-sqlite-provider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from memtrip/sqlking

0.0 1.0 0.0 240 KB

This repository contains wrapper classes that encapsulate all Android SQLite behaviour in a set of generic methods. The provider allows database tables to be defined in models classes, the model objects can then be inserted or selected by helper methods.

android-sqlite-provider's Introduction

android-sqlite-wrapper

This repository contains wrapper classes that encapsulate all Android SQLite behaviour in a set of generic methods. The provider allows database tables to be defined in models classes, the model objects can then be inserted or selected by helper methods.

TODO:

  • Add methods that allow groupBy and having clauses to the SQLProvider
  • Validate SQLModel classes to ensure that the properties of the class match the values of the SQL table, this will help with debugging any SQL issues
  • Implement unit tests for SQLProvider and SQLDatabaseHelper methods

Example usage:

  • Copy the packages directly into your Android project
// create a new instance of a model class and populate it. The class represents
// a row in the "Message" database table
MessageModel messageModel = new MessageModel();
messageModel.setBody("This is a message body");
messageModel.setDate("10/08/2012");
messageModel.setViews(31431232);
messageModel.setRating(3.5f);
messageModel.setProfilePicture(messageModel.getBody().getBytes());
	
// open SQLite database connection
SQLProvider sqlProvider = new SQLProvider(getBaseContext());
sqlProvider.open();
		
// insert model into Message table
long id = sqlProvider.insert(MessageModel.class, messageModel);
		
// select all from Message table as a MessageModel[] array
MessageModel[] messageArray = sqlProvider.selectAll(MessageModel.class, new MessageModel(), null, null);
		
// close the SQLite database connection
sqlProvider.close();

android-sqlite-provider's People

Watchers

 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.