|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.sahits.phpclassgenerator.DBConnection
ch.sahits.phpclassgenerator.MySQLConnection
public class MySQLConnection
This class handles the connection to a MySQL DB. It queries the DB for the structure of a table. Supported DBs are
| Field Summary |
|---|
| Fields inherited from class ch.sahits.phpclassgenerator.DBConnection |
|---|
conn, db, host, password, product, table, user |
| Constructor Summary | |
|---|---|
MySQLConnection(java.lang.String product,
java.lang.String hostname,
java.lang.String uname,
java.lang.String pwd,
java.lang.String database,
java.lang.String tablename)
Constructor initializes the connection data |
|
| Method Summary | |
|---|---|
protected DBStructure |
getStructure()
Query the INFORMATION_SCHEMA to retrive the metadata |
protected void |
loadDriver()
check if the driver is available |
private java.lang.String[] |
retriveMySQLForeignKey(java.lang.String fkName)
Retrive the foreign key of the table |
private java.lang.String[] |
retriveMySQLPrimaryKey(java.lang.String pkName)
Retrive the primiry key of the table |
| Methods inherited from class ch.sahits.phpclassgenerator.DBConnection |
|---|
setHost, setPassword, setProduct, setTable, setUser |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MySQLConnection(java.lang.String product,
java.lang.String hostname,
java.lang.String uname,
java.lang.String pwd,
java.lang.String database,
java.lang.String tablename)
throws java.sql.SQLException
product - what kind of DB (MySQL, PostgeSQL, Oracle, Derby, MS SQL Server, ...)hostname - of the db eg. localhostuname - user name to connect to the DBpwd - password of the userdatabase - or schema of the tabletablename - table name
java.sql.SQLException - Connecting failed probably due to incorrect input| Method Detail |
|---|
protected DBStructure getStructure()
throws java.sql.SQLException
getStructure in class DBConnectionjava.sql.SQLException
private java.lang.String[] retriveMySQLPrimaryKey(java.lang.String pkName)
throws java.sql.SQLException
pkName - Primary key name
java.sql.SQLException
private java.lang.String[] retriveMySQLForeignKey(java.lang.String fkName)
throws java.sql.SQLException
fkName - Foreign key name
java.sql.SQLException
java.sql.SQLExceptionprotected void loadDriver()
loadDriver in class DBConnection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||