com.continuent.tungsten.replicator.database
Class VerticaDatabase

java.lang.Object
  extended by com.continuent.tungsten.replicator.database.AbstractDatabase
      extended by com.continuent.tungsten.replicator.database.PostgreSQLDatabase
          extended by com.continuent.tungsten.replicator.database.VerticaDatabase
All Implemented Interfaces:
Database

public class VerticaDatabase
extends PostgreSQLDatabase

Implements DBMS-specific operations for Vertica.

Author:
Linas Virbalas

Field Summary
 
Fields inherited from class com.continuent.tungsten.replicator.database.AbstractDatabase
autoCommit, connected, dbConn, dbDriver, dbms, dbPassword, dbUri, dbUser, defaultSchema, drivers, privileged
 
Fields inherited from interface com.continuent.tungsten.replicator.database.Database
MYSQL, ORACLE, POSTGRESQL, UNKNOWN
 
Constructor Summary
VerticaDatabase()
           
 
Method Summary
protected  java.lang.String columnToTypeString(Column c, java.lang.String tableType)
          Converts column types according to standard Vertica names.
 void connect(boolean binlog)
          Overload connect method to issue call to ensure default projections are enabled.
 void createTable(Table t, boolean replace)
          Ensure projection is created for new table.
 CsvWriter getCsvWriter(java.io.BufferedWriter writer)
          Returns a properly configured CsvWriter to generate CSV according to the preferred conventions of this DBMS type.
protected  boolean tableExists(Table t)
          Checks whether the given table exists in the currently connected database using Vertica-specific v_catalog.tables view.
 
Methods inherited from class com.continuent.tungsten.replicator.database.PostgreSQLDatabase
connect, createSchema, dropSchema, dropTable, getBlobAsBytes, getColumnsResultSet, getDatabaseObjectName, getNowFunction, getPlaceHolder, getPrimaryKeyResultSet, getSchemas, getSqlNameMatcher, getTablesResultSet, getTimeDiff, getUseSchemaQuery, nullsBoundDifferently, nullsEverBoundDifferently, supportsCreateDropSchema, supportsReplace, supportsSessionVariables, supportsUseDefaultSchema, useDefaultSchema
 
Methods inherited from class com.continuent.tungsten.replicator.database.AbstractDatabase
close, commit, consistencyCheck, consistencyCheck, controlSessionLevelLogging, createStatement, createTable, createTable, createTable, createUser, delete, disconnect, dropTungstenCatalog, dropUser, execute, executeUpdate, findTable, findTable, findTable, getConnection, getControlTimestampQuery, getDatabaseMetaData, getReservedWords, getSessionVariable, getTables, getType, insert, isPrivileged, javaSQLTypeToNativeType, kill, listSessions, nativeTypeToJavaSQLType, prepareOptionSetStatement, prepareStatement, replace, rollback, setAutoCommit, setPassword, setPrivileged, setSessionVariable, setUrl, setUser, supportsControlSessionLevelLogging, supportsControlTimestamp, supportsNativeSlaveSync, supportsUserManagement, syncNativeSlave, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerticaDatabase

public VerticaDatabase()
                throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

connect

public void connect(boolean binlog)
             throws java.sql.SQLException
Overload connect method to issue call to ensure default projections are enabled.

Specified by:
connect in interface Database
Overrides:
connect in class PostgreSQLDatabase
Parameters:
binlog - log connection updates.
Throws:
java.sql.SQLException
See Also:
Database.connect(boolean)

createTable

public void createTable(Table t,
                        boolean replace)
                 throws java.sql.SQLException
Ensure projection is created for new table. (Otherwise metadata operations may fail if we try to select off a new table.)

Specified by:
createTable in interface Database
Overrides:
createTable in class PostgreSQLDatabase
Parameters:
t - Table specification
replace - If true, replace an existing table
Throws:
java.sql.SQLException
See Also:
Database.createTable(com.continuent.tungsten.replicator.database.Table, boolean)

tableExists

protected boolean tableExists(Table t)
                       throws java.sql.SQLException
Checks whether the given table exists in the currently connected database using Vertica-specific v_catalog.tables view.

Overrides:
tableExists in class PostgreSQLDatabase
Returns:
true, if table exists, false, if not.
Throws:
java.sql.SQLException

columnToTypeString

protected java.lang.String columnToTypeString(Column c,
                                              java.lang.String tableType)
Converts column types according to standard Vertica names.

Overrides:
columnToTypeString in class PostgreSQLDatabase
Parameters:
c - Column for which specification is required
Returns:
String containing specification

getCsvWriter

public CsvWriter getCsvWriter(java.io.BufferedWriter writer)
Returns a properly configured CsvWriter to generate CSV according to the preferred conventions of this DBMS type.

Specified by:
getCsvWriter in interface Database
Overrides:
getCsvWriter in class PostgreSQLDatabase
Parameters:
writer - A buffered writer to receive CSV output
Returns:
A property configured CsvWriter instance
See Also:
Database.getCsvWriter(java.io.BufferedWriter)