sqlite-analyzer


Source link: https://github.com/novoda/sqlite-analyzer

sqlite-analyzer

Code generation for Java/Android database access.

Description

Generates java/android database access code by analysing sqlite migration files or sqlite databases, keeping full control of what code is generated.

sqlite-analyzer creates an in-memory sqlite database, either from a given database file or by reading sql migrations, and analyzes its tables to construct a DatabaseModel. This model is then used to generate database access code.

This project uses sqlite-jdbc to create and analyze the database. Groovy is used to generate code, Gradle to hook the functionality into the android build system.

Adding to your project

To integrate sqlite-analyzer into your project, add the following at the beginning of the build.gradle of your project:

buildscript {

  repositories {

jcenter()
  
}

  dependencies {

classpath 'com.novoda:sqlite-analyzer:0.3.2'
  
}
 
}

To use the library with sqlite-provider, add these lines to the build.gradle of your project:

apply plugin: 'com.novoda.sqlite-analyzer'  sqliteAccess {

  migrationsDir 'src/main/assets/migrations'
  packageName 'com.novoda.sqliteprovider.demo.simple' 
}

See the sample projects for setup with android-sqlite-asset-helper.

Simple usage

Try ./gradlew clean assembleDebug and observe the generated code under build/generated/source/sqlite/debug/.

By default, it contains one single class DB that defines constants for the names of the tables and columns and introduces static accessor methods as well as model classes for all tables data.

The project comes with 2 demo applications that create and use database access code, one uses sqlite-provider, the other uses android-sqlite-asset-helper.

Use column names

queryBuilder.appendWhere(DB.Columns.Shop.Name + " like 'A%'")

Simplified use with static import

projection = new String[] {
Employees.Firstname, Employees.Lastname
}
;

Use model classes

public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {

  DB.Shop shop = DB.Shop.fromCursor(cursor);
 
}

Use helpers for ContentValues

ContentValues values = new ContentValues(1);
 DB.Shop.setName("New Shop", values);

Links

Here are a list of useful links:

  • We always welcome people to contribute new features or bug fixes, here is how
  • If you have a problem check the Issues Page first to see if we are working on it
  • For further usage or to delve more deeply checkout the Project Wiki
  • Looking for community help, browse the already asked Stack Overflow Questions or use the tag: support-sqlite-analyzer when posting a new question

Resources

An indicator like Morning Routine guide.It was originally based on BezierDemo.

Gradle plugin for j2objc (Java to Objective-C translation tool).

Working with Spans is ugly and difficult to manage, it's like working with a goblin of Moria. Don't understand the Spans? With AwesomeText you will only have to work with the classic Adapter Pattern. All the ease and potential of a pattern you already know how to use.

AndroidRandomColor library allows to generate random colors on Android.

IconButton is an Android button widget that allows you to center both the button's text and an icon.

mini-equalizer-library-android is created to let you use an animated equalizer inside your music related apps.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes