FORUMS

[Library] DBXDroid - Simple ORM Library for Android SQLite Database

134 posts
Thanks Meter: 107
 
Post Reply Email Thread
DBXDroid
Simple ORM Library for Android SQLite Database


Description

This is android library to simplify Android SQlite Database
It become very tedious to write large Android SQLite Open helper for simple database usage. So I developed this library to create android databases very easily using straight forward functions.
Github Project Link - DBXDroid-Github
Direct Download Link - DBXDroid-Sourceforge

Features
  • Create Android SQLite Database
  • Add Tables to database
  • Insert new entry to tables
  • Fetch entries from tables
  • Ability to interact with database directly using getDatabase() function.


Compatibility

DBXDroid library is compatible for Android 2.3+


Installation

To use DBXDroid ,
  • Download Library
  • Extract it to DBXDroid directory
  • Copy it to your Android Project Workspace
  • Add it as a project to your Android ADT
  • Edit properties of your project -> Android -> Library -> Add DBXDroid as Library
  • Library is now ready to use


Use

1. Define Database

Code:
DBXDatabase studentDatabase;
studentDatabase = new DBXDatabase("college.db", this);
2. Create ColumnList

Code:
DBXColumnList studentColumns = new DBXColumnList();
studentColumns.addColumn(new DBXColumn("student_id",DBXFieldType.INTEGER));
studentColumns.addColumn(new DBXColumn("student_name",DBXFieldType.TEXT));
studentColumns.addColumn(new DBXColumn("student_dept",DBXFieldType.VARCHAR));

3. Add new Table to Database

Code:
studentDatabase.addTable(new DBXTable("students", studentColumns));

4. Create Database

Code:
try {
    studentDatabase.createDatabase();
} catch (Exception e) {
    e.printStackTrace();
}

5. Open Database

Code:
try {
    studentDatabase.openDatabase();
} catch (Exception e) {
    e.printStackTrace();
}

6. Inserting new Entry to table

Code:
DBXFieldValuePairList studentFieldsList = new DBXFieldValuePairList();
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_id", Integer.parseInt(studentID)));
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_name", studentName));
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_dept", studentDept));

try {
    if (studentDatabase.insertEntry("students", studentFieldsList) != -1) {

        Toast.makeText(this, "Added", Toast.LENGTH_SHORT).show();
    }
} catch (Exception e) {
    e.printStackTrace();
}

7. Fetching Entries

Code:
DBXResult dbxResult = studentDatabase.getEntries("students");
String[][] result = dbxResult.getResults();

8. Access Database Directly

Code:
public SQLiteDatabase getDatabase();
This method returns SQLiteDatabase object reference for your database, So you can interact normally and directly to database


9. Closing Database

Code:
try {
    studentDatabase.closeDatabase();
} catch (Exception e) {
    e.printStackTrace();
}
Refer DBXDroidDemo for Full Demo



License

DBXDroid is under the GNU General Public License v3.0 License.
The Following 11 Users Say Thank You to aditya.kamble For This Useful Post: [ View ] Gift aditya.kamble Ad-Free
9th December 2014, 07:53 AM |#2  
Junior Member
Thanks Meter: 1
 
More
Post sdk? or jdk
s.o.s so this is a java script object oriented based sql form relational database that has a sdk acting like the LRAD filtering data through normal forms?

If you decide to further inspect the contents of the p32m x 360f512 l.h file (it is a simple
text file that you can open with the MPLAB editor), you will see that it contains an
incredibly long list of definitions for all the names of the internal special-function
registers (often referred to in the documentation as the SFRs ) of the chosen PIC32 model.
If the include file is accurate, those names reflect exactly those being used in the device
datasheet and the PIC32 reference manual.
Here is a segment of the p32m x 360f512 l.h file in which the special-function register that
controls the watchdog module ( WDTCON ) and each of its individual bits are assigned their
conventional names:
...
extern volatile unsigned int WDTCON__attribute__
((section( " sfrs " )));
typedef union {
struct {
unsigned WDTCLR:1;
The Adventure Begins 7
unsigned WDTWEN:1;
unsigned SWDTPS0:1;
unsigned SWDTPS1:1;
unsigned SWDTPS2:1;
unsigned SWDTPS3:1;
unsigned SWDTPS4:1;
unsigned :7;
unsigned FRZ:1;
unsigned ON:1;
};
...
Back to our Hello.c source file; let ’ s add a couple more lines that will introduce you to
the main() function:
main()
{
}
What we have now is already a complete, although still empty and pretty useless, C
language program. In between those two curly brackets is where we will soon put the first
few instructions of our embedded-control application.
Independently of this function position in the file, whether in the first lines on top or
the last few lines in a million-lines file, the main() function is the place where the
microcontroller will go first at power-up or after each subsequent reset. This is actually an
oversimplification. After a reset or at power-up, but before entering the main() function,
the microcontroller will execute a short initialization code segment automatically
inserted by the MPLAB C32 linker. This is known as the Startup code or crt0 code (or
simply c0 in the traditional C language literature). The Startup code will perform basic
housekeeping chores, including the all important initialization of the stack, among many
other things.
The Following User Says Thank You to 101 dalmatians For This Useful Post: [ View ] Gift 101 dalmatians Ad-Free
12th December 2014, 07:51 PM |#3  
Member
Thanks Meter: 14
 
More
Info 2
Quote:
Originally Posted by aditya.kamble

DBXDroid
Simple ORM Library for Android SQLite Database


Description

...

This is no ORM library. There is no mapping from or to objects in this code. Have a look at http://en.wikipedia.org/wiki/Object-relational_mapping for the differences. As examples for real ORM libraries for android, OrmLite or GreenDAO come to mind.

Furthermore, there are a lot of problems with this code.
1st February 2015, 03:58 AM |#4  
aditya.kamble's Avatar
OP Senior Member
Flag India
Thanks Meter: 107
 
More
Tutorial Its ORM Like Library
Quote:
Originally Posted by onlyolli

This is no ORM library. There is no mapping from or to objects in this code. Have a look at http://en.wikipedia.org/wiki/Object-relational_mapping for the differences. As examples for real ORM libraries for android, OrmLite or GreenDAO come to mind.

Furthermore, there are a lot of problems with this code.

Yeah it is not fully ORM library but it is ORM like library which provides easier functions can be adopted fast by developer when they dont have time to learn proper ORM library
1st February 2015, 04:01 PM |#5  
Member
Thanks Meter: 14
 
More
Nope, sorry, it is really not. All it is is a few functions to create a database schema programmatically and a few functions to do some conversion from and to strings. This is nothing anyone should touch if he/she wants to do proper android software development. If you dont have the time to learn some real ORM tool, then you're better of not developing at all. It takes just a few minutes to get started with something like SugarORM (have a look at http://satyan.github.io/sugar/getting-started.html to see what i mean) which provides a real benefit to your application.
19th October 2015, 08:52 PM |#6  
Junior Member
Thanks Meter: 0
 
More
JDXA ORM for Android
You may want to check out JDXA, a simple yet powerful, and flexible ORM solution for Android. JDXA easily supports inheritance, one-to-one, one-to-many, and many-to-many relationships and offers a POJO (Plain Old Java Objects) friendly non-intrusive programming model, which does not require you to change your Java classes in any way:
  • No need to subclass your domain classes from any base class
  • No need to clutter your source code with annotations
  • No need for DAO classes
  • No source code generation or pre-processing of your code
  • Automatic creation of database schema

Get more information including code snippets and a FREE trial download at softwaretree.com
Post Reply Subscribe to Thread

Tags
android database, android database orm library, orm library

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes