Package one.microstream.afs.sql.types
Interface SqlProvider
- All Known Subinterfaces:
SqlProviderMariaDb,SqlProviderPostgres,SqlProviderSqlite
- All Known Implementing Classes:
SqlProvider.Abstract,SqlProviderMariaDb.Default,SqlProviderPostgres.Default,SqlProviderSqlite.Default
public interface SqlProvider
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSqlProvider.Abstract -
Field Summary
Fields Modifier and Type Field Description static StringDATA_COLUMN_NAMEstatic intDATA_COLUMN_TYPEstatic StringEND_COLUMN_NAMEstatic intEND_COLUMN_TYPEstatic intIDENTIFIER_COLUMN_LENGTHstatic StringIDENTIFIER_COLUMN_NAMEstatic intIDENTIFIER_COLUMN_TYPEstatic StringSTART_COLUMN_NAMEstatic intSTART_COLUMN_TYPE -
Method Summary
Modifier and Type Method Description Stringcatalog()StringcopyFileQuery(String sourceTableName, String targetTableName)insert into [targetTableName] ('identifier', 'start', 'end', 'data') select ?, 'start', 'end', 'data' from [sourceTableName] where 'identifier' = ?Iterable<String>createDirectoryQueries(String tableName)create table [tableName] ( 'identifier' varchar(IDENTIFIER_COLUMN_LENGTH) not null, 'start' bigint not null, 'end' bigint not null, 'blob' not null, primary key ('identifier', 'start') )StringdeleteFileQuery(String tableName)delete from [tableName] where 'identifier' = ?StringdeleteFileQueryFromEnd(String tableName)delete from [tableName] where 'identifier' = ? and 'end' >= ?StringdeleteFileQueryFromStart(String tableName)delete from [tableName] where 'identifier' = ? and 'start' >= ?<T> Texecute(SqlOperation<T> operation)StringfileExistsQuery(String tableName)select count(*) from [tableName] where 'identifier' = ?StringfileSizeQuery(String tableName)select count(*), max('end') from [tableName] where 'identifier' = ?StringlistFilesQuery(String tableName)select distinct 'identifier' from [tableName]StringmoveFileQuerySameParent(String tableName)update [tableName] set 'identifier' = ? where 'identifier' = ?Set<String>queryDirectories(Connection connection, String prefix)booleanqueryDirectoryExists(Connection connection, String tableName)StringreadDataQuery(String tableName)select * from [tableName] where 'identifier' = ? order by 'end' descStringreadDataQueryWithLength(String tableName)select * from [tableName] where 'identifier' = ? and 'start' < ? order by 'end' descStringreadDataQueryWithOffset(String tableName)select * from [tableName] where 'identifier' = ? and 'end' >= ? order by 'end' descStringreadDataQueryWithRange(String tableName)select * from [tableName] where 'identifier' = ? and 'end' >= ? and 'start' <= ? order by 'end' descStringreadMetadataQuery(String tableName)select 'start', 'end' from [tableName] where 'identifier' = ?StringreadMetadataQuerySingleSegment(String tableName)select 'start', 'end' from [tableName] where 'identifier' = ? and start <= ? and end >= ?Stringschema()voidsetBlob(PreparedStatement statement, int index, InputStream inputStream, long length)StringwriteDataQuery(String tableName)insert into [tableName] ('identifier', 'start', 'end', 'data') values (?, ?, ?, ?)
-
Field Details
-
IDENTIFIER_COLUMN_NAME
- See Also:
- Constant Field Values
-
IDENTIFIER_COLUMN_TYPE
static final int IDENTIFIER_COLUMN_TYPE- See Also:
- Constant Field Values
-
IDENTIFIER_COLUMN_LENGTH
static final int IDENTIFIER_COLUMN_LENGTH- See Also:
- Constant Field Values
-
START_COLUMN_NAME
- See Also:
- Constant Field Values
-
START_COLUMN_TYPE
static final int START_COLUMN_TYPE- See Also:
- Constant Field Values
-
END_COLUMN_NAME
- See Also:
- Constant Field Values
-
END_COLUMN_TYPE
static final int END_COLUMN_TYPE- See Also:
- Constant Field Values
-
DATA_COLUMN_NAME
- See Also:
- Constant Field Values
-
DATA_COLUMN_TYPE
static final int DATA_COLUMN_TYPE- See Also:
- Constant Field Values
-
-
Method Details
-
catalog
String catalog() -
schema
String schema() -
execute
-
setBlob
void setBlob(PreparedStatement statement, int index, InputStream inputStream, long length) throws SQLException- Throws:
SQLException
-
queryDirectoryExists
- Throws:
SQLException
-
queryDirectories
- Throws:
SQLException
-
fileSizeQuery
select count(*), max('end') from [tableName] where 'identifier' = ? -
listFilesQuery
select distinct 'identifier' from [tableName]
-
readMetadataQuery
select 'start', 'end' from [tableName] where 'identifier' = ?
-
readMetadataQuerySingleSegment
select 'start', 'end' from [tableName] where 'identifier' = ? and start <= ? and end >= ?
-
readDataQuery
select * from [tableName] where 'identifier' = ? order by 'end' desc
-
readDataQueryWithLength
select * from [tableName] where 'identifier' = ? and 'start' < ? order by 'end' desc
-
readDataQueryWithOffset
select * from [tableName] where 'identifier' = ? and 'end' >= ? order by 'end' desc
-
readDataQueryWithRange
select * from [tableName] where 'identifier' = ? and 'end' >= ? and 'start' <= ? order by 'end' desc
-
fileExistsQuery
select count(*) from [tableName] where 'identifier' = ?
-
createDirectoryQueries
create table [tableName] ( 'identifier' varchar(IDENTIFIER_COLUMN_LENGTH) not null, 'start' bigint not null, 'end' bigint not null, 'blob' not null, primary key ('identifier', 'start') ) -
deleteFileQuery
delete from [tableName] where 'identifier' = ?
-
deleteFileQueryFromStart
delete from [tableName] where 'identifier' = ? and 'start' >= ?
-
deleteFileQueryFromEnd
delete from [tableName] where 'identifier' = ? and 'end' >= ?
-
writeDataQuery
insert into [tableName] ('identifier', 'start', 'end', 'data') values (?, ?, ?, ?) -
moveFileQuerySameParent
update [tableName] set 'identifier' = ? where 'identifier' = ?
-
copyFileQuery
insert into [targetTableName] ('identifier', 'start', 'end', 'data') select ?, 'start', 'end', 'data' from [sourceTableName] where 'identifier' = ?
-