import universal.database.DatabaseMySql;
DatabaseMySql sql = new DatabaseMySql("localhost:3306","dbName","username","password");
DatabaseMySql(String url,String db,String user,String pass)
Methods:
select(String ... columns)
-
You can pass multiple arguments also as columns names which you want to take result, by defaut it select all columns.
-
Return
DatabaseMySql
Object.
Example:
ResultSet rs = sql.select().from("tablename").srun();
ResultSet rs = sql.select("column1").from("tablename").srun();
ResultSet rs = sql.select("column1","column2").from("tablename").srun();
ResultSet rs = sql.select("column1","column2","column3").from("tablename").srun();
ResultSet rs = sql.select("column1","column2","column4").from("tablename").srun();
from(String tablename)
-
Used with select command.
-
ReturnType
DatabaseMySql
Object.
srun()
- ReturnType
ResultSet
pInsert(String tablename,int unknwons,String ... parameters)
-
It return the prepared statement of INSERT command.
-
ReturnType PreparedStatement.
PreparedStatement ptmt = sql.pInsert("tablename",(int )No_Of_Unknown_Parameters);
PreparedStatement ptmt = sql.pInsert("tablename",1,"column1");
PreparedStatement ptmt = sql.pInsert("tablename",2,"column1",column3);
PreparedStatement ptmt = sql.pInsert("tablename",3,"column1","column3","column2");
Above Method Return Query :
Query : INSERT into tablename(column1,column3,column2) values (?,?,?);