Skip to content

Commit

Permalink
update description .markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
juanchinovas committed Dec 27, 2014
1 parent a3dbfda commit badfb4b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 17 deletions.
33 changes: 16 additions & 17 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@ A Simple Data Access Object for Android to control your android app databases.

1. Create a xml file in assets directory named dao.xml.
That file have to have the following structure
~~~~~ xml
<?xml version="1.0" encoding="UTF-8"?>
<db name='db_name' version='1'>
<table name='tbl_name1' class='testdaoa.testingdaoa.Person'>
<field type='INTEGER' nullable='false' key='true' auto='true'>_id</field>
<field type='TEXT'>name</field>
<field type='TEXT' default='test'>dummy_column</field>
<field type='DATE' nullable='false' default='DATE'>entry_date</field>
</table>
<table name='tbl_name2' class='pck.Class'>
<field type='INTEGER' nullable='false'>lincense_plate</field>
<field type='TEXT' nullable='true'>model</field>
<field type='DATE' nullable='false' default='DATE'>entry_date</field>
<field type='INTEGER' nullable='false'>owner</field>
</table>
</db>
~~~~~
######
<?xml version="1.0" encoding="UTF-8"?>
<db name='db_name' version='1'>
<table name='tbl_name1' class='testdaoa.testingdaoa.Person'>
<field type='INTEGER' nullable='false' key='true' auto='true'>_id</field>
<field type='TEXT'>name</field>
<field type='TEXT' default='test'>dummy_column</field>
<field type='DATE' nullable='false' default='DATE'>entry_date</field>
</table>
<table name='tbl_name2' class='pck.Class'>
<field type='INTEGER' nullable='false'>lincense_plate</field>
<field type='TEXT' nullable='true'>model</field>
<field type='DATE' nullable='false' default='DATE'>entry_date</field>
<field type='INTEGER' nullable='false'>owner</field>
</table>
</db>
2. Add the DAOa project as library in your Android project
3. Create a Instance of a singleton class **DBManager**.
And you can access all methods in this class.
Expand Down
45 changes: 45 additions & 0 deletions README.markdown~
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
simpleDAOa
==========

A Simple Data Access Object for Android to control your android app databases.
------------------------------------------------------------------------------
## How to use simpleDAOa?

1. Create a xml file in assets directory named dao.xml.
That file have to have the following structure
~~~~~ xml
<?xml version="1.0" encoding="UTF-8"?>
<db name='db_name' version='1'>
<table name='tbl_name1' class='testdaoa.testingdaoa.Person'>
<field type='INTEGER' nullable='false' key='true' auto='true'>_id</field>
<field type='TEXT'>name</field>
<field type='TEXT' default='test'>dummy_column</field>
<field type='DATE' nullable='false' default='DATE'>entry_date</field>
</table>
<table name='tbl_name2' class='pck.Class'>
<field type='INTEGER' nullable='false'>lincense_plate</field>
<field type='TEXT' nullable='true'>model</field>
<field type='DATE' nullable='false' default='DATE'>entry_date</field>
<field type='INTEGER' nullable='false'>owner</field>
</table>
</db>
~~~~~
2. Add the DAOa project as library in your Android project
3. Create a Instance of a singleton class **DBManager**.
And you can access all methods in this class.

==========

~~~~~ java
# Initializes a DBManager
private DBManager dbManager = DBManager.getInstance(this); //(this) a activity instance

# Read data from database

Object objct = dbManager.selectFrom("tbl_name1",null); // all rows
if (objct instanceof List) {
List<Person> ps = (List<Person>)objct;
} else if (objct != null) {
Person person = (((Person)objct).getName());
}
~~~~~

0 comments on commit badfb4b

Please sign in to comment.