Skip to content

sanheensethi/UniversalDatabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UniversalDatabase Package

Package Use:

import universal.database.DatabaseMySql;

Create Connection :

DatabaseMySql sql = new DatabaseMySql("localhost:3306","dbName","username","password");

Constructor:

DatabaseMySql(String url,String db,String user,String pass)

Methods:

  1. 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();
  1. from(String tablename)
  • Used with select command.

  • ReturnType DatabaseMySql Object.

  1. srun()
  • ReturnType ResultSet
  1. 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 (?,?,?);

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published