com.hfg.sql.jdbc.RDBMS Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.sql.jdbc;
import com.hfg.security.LoginCredentials;
import com.hfg.sql.SQLQuery;
import com.hfg.sql.table.DatabaseCol;
import com.hfg.sql.table.DatabaseSequence;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.DateFormat;
import java.time.format.DateTimeFormatter;
//------------------------------------------------------------------------------
/**
* Relational database management system.
* @author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
public abstract class RDBMS
{
private String mName;
private int mDefaultPort;
private int mMaxIdentifierLength;
private int mMaxInClauseArgs;
private String mDriverClassname;
public static final RDBMS PostgreSQL = com.hfg.sql.jdbc.postgresql.PostgreSQL.getInstance();
//###########################################################################
// CONSTRUCTORS
//###########################################################################
//---------------------------------------------------------------------------
protected RDBMS(String inName)
{
mName = inName;
}
//###########################################################################
// PUBLIC METHODS
//###########################################################################
//--------------------------------------------------------------------------
public String name()
{
return mName;
}
//--------------------------------------------------------------------------
@Override
public String toString()
{
return name();
}
//---------------------------------------------------------------------------
public int getMaxIdentifierLength()
{
return mMaxIdentifierLength;
}
//---------------------------------------------------------------------------
public int getMaxInClauseArgs()
{
return mMaxInClauseArgs;
}
//---------------------------------------------------------------------------
public int getDefaultPort()
{
return mDefaultPort;
}
//---------------------------------------------------------------------------
public String getDriverClassName()
{
return mDriverClassname;
}
//---------------------------------------------------------------------------
public abstract String getConnectString(JDBCServer inServer, String inDatabaseName);
//---------------------------------------------------------------------------
public abstract String getConnectString(JDBCServer inServer, String inDatabaseName, JDBCConnectionSettings inSettings);
//---------------------------------------------------------------------------
public abstract JDBCConnectionPool establishConnectionPool(JDBCServer inServer, String inDatabaseName, LoginCredentials inCredentials, JDBCConnectionPoolSettings inPoolSettings);
//---------------------------------------------------------------------------
@Deprecated
public abstract DateFormat getSQLDateFormat(int inSQLType);
//---------------------------------------------------------------------------
public abstract DateTimeFormatter getSQLDateFormatter(int inSQLType);
//---------------------------------------------------------------------------
public abstract DatabaseSequence allocateSequence(String inName);
//---------------------------------------------------------------------------
public abstract Long getLastGeneratedId(Connection inConn, DatabaseCol inIdCol) throws SQLException;
//---------------------------------------------------------------------------
public abstract SQLQuery getConnTestQuery();
//---------------------------------------------------------------------------
public abstract boolean tableExists(Connection inConn, Schema inSchema, String inTablename) throws SQLException;
//###########################################################################
// PROTECTED METHODS
//###########################################################################
//---------------------------------------------------------------------------
protected RDBMS setDriverClassName(String inValue)
{
mDriverClassname = inValue;
return this;
}
//---------------------------------------------------------------------------
protected RDBMS setDefaultPort(int inValue)
{
mDefaultPort = inValue;
return this;
}
//---------------------------------------------------------------------------
protected RDBMS setMaxIdentifierLength(int inValue)
{
mMaxIdentifierLength = inValue;
return this;
}
//---------------------------------------------------------------------------
protected RDBMS setMaxInClauseArgs(int inValue)
{
mMaxInClauseArgs = inValue;
return this;
}
//###########################################################################
// PRIVATE METHODS
//###########################################################################
}