|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.gora.store.impl.DataStoreBase<K,T>
org.apache.gora.sql.store.SqlStore<K,T>
public class SqlStore<K,T extends org.apache.gora.persistency.impl.PersistentBase>
A DataStore implementation for RDBMS with a SQL interface. SqlStore uses the JOOQ API and various JDBC drivers to communicate with the DB. Through use of the JOOQ API this SqlStore aims to support numerous SQL database stores namely; DB2 9.7 Derby 10.8 H2 1.3.161 HSQLDB 2.2.5 Ingres 10.1.0 MySQL 5.1.41 and 5.5.8 Oracle XE 10.2.0.1.0 and 11g PostgreSQL 9.0 SQLite with inofficial JDBC driver v056 SQL Server 2008 R8 Sybase Adaptive Server Enterprise 15.5 Sybase SQL Anywhere 12 This DataStore is currently in development, and requires a complete re-write as per GORA-86 Please see https://issues.apache.org/jira/browse/GORA-86
| Nested Class Summary | |
|---|---|
static class |
SqlStore.DBVendor
The vendor of the DB |
| Field Summary | |
|---|---|
protected static String |
DEFAULT_MAPPING_FILE
|
protected static String |
DRIVER_CLASS_PROPERTY
The JDBC Driver class name |
protected static String |
PASSWORD_PROPERTY
Password to access the database |
protected static String |
URL_PROPERTY
JDBC Database access URL |
protected static String |
USERNAME_PROPERTY
User name to access the database |
| Fields inherited from class org.apache.gora.store.impl.DataStoreBase |
|---|
autoCreateSchema, beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, LOG, persistentClass, properties, schema |
| Constructor Summary | |
|---|---|
SqlStore()
|
|
| Method Summary | ||
|---|---|---|
void |
close()
|
|
void |
createSchema()
|
|
protected void |
createSqlTable()
|
|
boolean |
delete(K key)
|
|
long |
deleteByQuery(org.apache.gora.query.Query<K,T> query)
|
|
void |
deleteSchema()
|
|
org.apache.gora.query.Result<K,T> |
execute(org.apache.gora.query.Query<K,T> query)
|
|
void |
flush()
|
|
T |
get(K key,
String[] requestFields)
|
|
protected byte[] |
getBytes()
|
|
protected Connection |
getConnection()
|
|
protected String |
getIdentifier()
|
|
List<org.apache.gora.query.PartitionQuery<K,T>> |
getPartitions(org.apache.gora.query.Query<K,T> query)
|
|
String |
getSchemaName()
|
|
protected void |
initDbMetadata()
|
|
void |
initialize()
|
|
org.apache.gora.query.Query<K,T> |
newQuery()
|
|
void |
put(K key,
T persistent)
|
|
protected Object |
readField()
|
|
protected SqlMapping |
readMapping()
|
|
T |
readObject(ResultSet rs,
T persistent,
String[] requestFields)
|
|
K |
readPrimaryKey(ResultSet resultSet)
|
|
boolean |
schemaExists()
|
|
protected void |
setBytes()
|
|
protected void |
setField()
Serializes the field using Avro to a BLOB field |
|
void |
setObject(PreparedStatement statement,
int index,
Object object,
org.apache.avro.Schema schema,
Column column)
Sets the object to the preparedStatement by it's schema |
|
protected
|
setObject(PreparedStatement statement,
int index,
V object,
int objectType,
Column column)
|
|
| Methods inherited from class org.apache.gora.store.impl.DataStoreBase |
|---|
equals, get, getBeanFactory, getConf, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, initialize, newKey, newPersistent, readFields, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema, write |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String DRIVER_CLASS_PROPERTY
protected static final String URL_PROPERTY
protected static final String USERNAME_PROPERTY
protected static final String PASSWORD_PROPERTY
protected static final String DEFAULT_MAPPING_FILE
| Constructor Detail |
|---|
public SqlStore()
| Method Detail |
|---|
public void initialize()
throws IOException
IOExceptionpublic String getSchemaName()
public void close()
public void createSchema()
public void deleteSchema()
public boolean schemaExists()
public boolean delete(K key)
public long deleteByQuery(org.apache.gora.query.Query<K,T> query)
public void flush()
public T get(K key,
String[] requestFields)
public org.apache.gora.query.Result<K,T> execute(org.apache.gora.query.Query<K,T> query)
public K readPrimaryKey(ResultSet resultSet)
throws SQLException
SQLException
public T readObject(ResultSet rs,
T persistent,
String[] requestFields)
throws SQLException,
IOException
SQLException
IOException
protected byte[] getBytes()
throws SQLException,
IOException
SQLException
IOException
protected Object readField()
throws SQLException,
IOException
SQLException
IOException
public List<org.apache.gora.query.PartitionQuery<K,T>> getPartitions(org.apache.gora.query.Query<K,T> query)
throws IOException
IOExceptionpublic org.apache.gora.query.Query<K,T> newQuery()
public void put(K key,
T persistent)
public void setObject(PreparedStatement statement,
int index,
Object object,
org.apache.avro.Schema schema,
Column column)
throws SQLException,
IOException
SQLException
IOException
protected <V> void setObject(PreparedStatement statement,
int index,
V object,
int objectType,
Column column)
throws SQLException,
IOException
SQLException
IOException
protected void setBytes()
throws SQLException
SQLException
protected void setField()
throws IOException,
SQLException
IOException
SQLException
protected Connection getConnection()
throws IOException
IOException
protected void initDbMetadata()
throws IOException
IOExceptionprotected String getIdentifier()
protected void createSqlTable()
protected SqlMapping readMapping()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||