Interface SqlStatements
-
- All Known Implementing Classes:
CommonSqlStatements
,H2SqlStatements
,PostgreSQLSqlStatements
public interface SqlStatements
Returns SQL statements used by the JDB artifactStore implementation. There are different implementations of this interface depending on the database being used.- Author:
- eric.wittmann@gmail.com
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
autoUpdateVersionForGlobalId()
A statement used to update the 'version' column of the 'versions' table by globalId.List<String>
databaseInitialization()
A sequence of statements needed to initialize the database.List<String>
databaseUpgrade(int fromVersion, int toVersion)
A sequence of statements needed to upgrade the DB from one version to another.String
dbType()
Gets the database type associated with these statements.String
deleteArtifact()
A statement to delete a single row from the artifacts table by artifactId.String
deleteArtifactRule()
A statement to delete a single artifact rule.String
deleteArtifactRules()
A statement to delete all rules for a single artifact.String
deleteArtifactRulesByGroupId()
A statement to delete all rules for all artifacts in a groupId.String
deleteArtifactsByGroupId()
A statement to delete a all artifacts from the artifacts table by groupId.String
deleteGlobalRule()
A statement used to delete a row from the globalrules table.String
deleteGlobalRules()
A statement used to delete all rows in the globalrules table.String
deleteGroup()
A statement used to delete a row from the groups table.String
deleteLabels()
A statement to delete all labels for all versions for a single artifact.String
deleteLabelsByGlobalId()
A statement to delete all labels for a single artifact version by globalIdString
deleteLabelsByGroupId()
A statement to delete all labels for all versions for all artifacts in a groupId.String
deleteLogConfiguration()
A statement to delete a row in the "logconfiguration" tableString
deleteProperties()
A statement to delete all properties for all versions for a single artifact.String
deletePropertiesByGlobalId()
A statement to delete all properties for a single artifact version by globalIdString
deletePropertiesByGroupId()
A statement to delete all properties for all versions for all artifacts in a groupId.String
deleteVersion()
A statement to delete a single artifact version.String
deleteVersionLabels()
A statement to delete the labels for a single artifact version.String
deleteVersionProperties()
A statement to delete the properties for a single artifact version.String
deleteVersions()
A statement to delete all versions for a single artifact.String
deleteVersionsByGroupId()
A statement to delete all versions for all artifacts in a groupId.String
exportArtifactRules()
String
exportArtifactVersions()
String
exportContent()
String
exportGlobalRules()
String
exportGroups()
String
getDatabaseVersion()
A statement that returns the current DB version (pulled from the "apicurio" attribute table).String
importArtifactRule()
String
importArtifactVersion()
String
importContent()
String
importGlobalRule()
String
importGroup()
String
insertArtifact()
A statement used to insert a row in the artifacts table.String
insertArtifactRule()
A statement to insert a row into the 'rules' table (artifact rule).String
insertGlobalRule()
A statement used to insert a row into the globalrules table.String
insertGroup()
A statement used to insert a row into the groups table.String
insertLabel()
A statement to insert a row in the "labels" table.String
insertProperty()
A statement to insert a row in the "properties" table.String
insertVersion(boolean firstVersion)
A statement used to insert a row in the versions table.String
isDatabaseInitialized()
A statement that returns 'true' if the database has already been initialized.boolean
isForeignKeyViolation(Exception error)
Returns true if the given exception represents a foreign key violation.boolean
isPrimaryKeyViolation(Exception error)
Returns true if the given exception represents a primary key violation.String
resetSequence(String sequence)
String
selectAllArtifactVersions()
A statement used to select all versions for a given artifactId.String
selectAllArtifactVersionsCount()
A statement used to count the total # of versions for an artifact.String
selectAllLogConfigurations()
A statement to select all rows in the "logconfiguration" tableString
selectArtifactCountById()
A statement to select the number of artifacts with a given artifactId (should be 0 or 1).String
selectArtifactIds()
A statement to get all artifacts IDs.String
selectArtifactMetaDataByGlobalId()
A statement to get an artifact's meta-data by version globalId.String
selectArtifactRuleByType()
A statement to get a single artifact rule from the 'rules' table by artifactId and rule type.String
selectArtifactRuleCountByType()
A statement to select the number of artifact rule rows for a given rule type.String
selectArtifactRules()
A statement used to select artifact rules by artifactId.String
selectArtifactVersionContent()
A statement to select the content of an artifact version from the versions table by artifactId + version.String
selectArtifactVersionContentByGlobalId()
A statement to select the content of an artifact version from the versions table by globalId.String
selectArtifactVersionMetaData()
A statement used to select artifact version metadata by artifactId and version.String
selectArtifactVersionMetaDataByCanonicalHash()
A statement used to select a single row in the versions by artifactId and canonical content hash.String
selectArtifactVersionMetaDataByContentHash()
A statement used to select a single row in the versions by artifactId and content hash.String
selectArtifactVersionMetaDataByContentId()
A statement used to select a single row in the versions by artifactId and content id.String
selectArtifactVersionMetaDataByGlobalId()
A statement used to select a single row in the versions table by globalId.String
selectArtifactVersions()
A statement used to select all version #s for a given artifactId.String
selectContentByContentHash()
A statement to select the bytes of a content row by contentHashString
selectContentById()
A statement to select the bytes of a content row by contentId.String
selectContentCountByHash()
A statement to select the number of content rows for a given content hash.String
selectContentExists()
String
selectContentIdByHash()
A statement to select the contentId of a row in the content table by hash value.String
selectGlobalIdExists()
String
selectGlobalRuleByType()
A statement used to select a single global rule by its type/id.String
selectGlobalRuleCountByType()
A statement to select the number of global rule rows for a given rule type.String
selectGlobalRules()
A statement used to select all global rules.String
selectGroupByGroupId()
A statement used to select a single group in groups table by groupId.String
selectGroups()
A statement used to select all rows from groups table.String
selectLatestArtifactContent()
A statement to get a single artifact (latest version) content by artifactId.String
selectLatestArtifactMetaData()
A statement to get a single artifact (latest version) meta-data by artifactId.String
selectLogConfigurationByLogger()
A statement to select the log configuration for a given logger nameString
selectMaxContentId()
String
selectMaxGlobalId()
String
selectNextGlobalId()
As statement used to get the next generated/sequenced globalId.String
updateArtifactLatest()
A statement used to update the 'latest' column of the 'artifacts' table.String
updateArtifactLatestGlobalId()
A statement used to update the 'latest' column of the 'artifacts' table to the globalId of the highest remaining version.String
updateArtifactRule()
A statement to update a single artifact rule.String
updateArtifactVersionMetaData()
A statement to update the meta-data of a specific artifact version.String
updateArtifactVersionState()
A statement to update the state of an artifact version (by globalId);String
updateGlobalRule()
A statement used to update information about a global rule.String
updateGroup()
A statement used to update information about a group.String
upsertContent()
A statement to "upsert" a row in the "content" table.String
upsertLogConfiguration()
A statement to "upsert" a row in the "logconfiguration" table
-
-
-
Method Detail
-
dbType
String dbType()
Gets the database type associated with these statements.
-
isPrimaryKeyViolation
boolean isPrimaryKeyViolation(Exception error)
Returns true if the given exception represents a primary key violation.- Parameters:
error
-
-
isForeignKeyViolation
boolean isForeignKeyViolation(Exception error)
Returns true if the given exception represents a foreign key violation.- Parameters:
error
-
-
isDatabaseInitialized
String isDatabaseInitialized()
A statement that returns 'true' if the database has already been initialized.
-
databaseInitialization
List<String> databaseInitialization()
A sequence of statements needed to initialize the database.
-
databaseUpgrade
List<String> databaseUpgrade(int fromVersion, int toVersion)
A sequence of statements needed to upgrade the DB from one version to another.- Parameters:
fromVersion
-toVersion
-
-
getDatabaseVersion
String getDatabaseVersion()
A statement that returns the current DB version (pulled from the "apicurio" attribute table).
-
insertGlobalRule
String insertGlobalRule()
A statement used to insert a row into the globalrules table.
-
selectGlobalRules
String selectGlobalRules()
A statement used to select all global rules.
-
selectGlobalRuleByType
String selectGlobalRuleByType()
A statement used to select a single global rule by its type/id.
-
deleteGlobalRule
String deleteGlobalRule()
A statement used to delete a row from the globalrules table.
-
deleteGlobalRules
String deleteGlobalRules()
A statement used to delete all rows in the globalrules table.
-
updateGlobalRule
String updateGlobalRule()
A statement used to update information about a global rule.
-
insertArtifact
String insertArtifact()
A statement used to insert a row in the artifacts table.
-
updateArtifactLatest
String updateArtifactLatest()
A statement used to update the 'latest' column of the 'artifacts' table.
-
updateArtifactLatestGlobalId
String updateArtifactLatestGlobalId()
A statement used to update the 'latest' column of the 'artifacts' table to the globalId of the highest remaining version.
-
autoUpdateVersionForGlobalId
String autoUpdateVersionForGlobalId()
A statement used to update the 'version' column of the 'versions' table by globalId. The value of the "versionId" column is copied into the "version" column.
-
insertVersion
String insertVersion(boolean firstVersion)
A statement used to insert a row in the versions table.
-
selectArtifactVersionMetaDataByGlobalId
String selectArtifactVersionMetaDataByGlobalId()
A statement used to select a single row in the versions table by globalId.
-
selectArtifactVersionMetaDataByContentHash
String selectArtifactVersionMetaDataByContentHash()
A statement used to select a single row in the versions by artifactId and content hash.
-
selectArtifactVersionMetaDataByContentId
String selectArtifactVersionMetaDataByContentId()
A statement used to select a single row in the versions by artifactId and content id.
-
selectArtifactVersionMetaDataByCanonicalHash
String selectArtifactVersionMetaDataByCanonicalHash()
A statement used to select a single row in the versions by artifactId and canonical content hash.
-
selectArtifactVersionContentByGlobalId
String selectArtifactVersionContentByGlobalId()
A statement to select the content of an artifact version from the versions table by globalId.
-
selectArtifactVersions
String selectArtifactVersions()
A statement used to select all version #s for a given artifactId.
-
selectAllArtifactVersions
String selectAllArtifactVersions()
A statement used to select all versions for a given artifactId.
-
selectAllArtifactVersionsCount
String selectAllArtifactVersionsCount()
A statement used to count the total # of versions for an artifact.
-
selectArtifactVersionMetaData
String selectArtifactVersionMetaData()
A statement used to select artifact version metadata by artifactId and version.
-
selectArtifactVersionContent
String selectArtifactVersionContent()
A statement to select the content of an artifact version from the versions table by artifactId + version.
-
upsertContent
String upsertContent()
A statement to "upsert" a row in the "content" table.
-
selectLatestArtifactContent
String selectLatestArtifactContent()
A statement to get a single artifact (latest version) content by artifactId.
-
selectLatestArtifactMetaData
String selectLatestArtifactMetaData()
A statement to get a single artifact (latest version) meta-data by artifactId.
-
selectContentIdByHash
String selectContentIdByHash()
A statement to select the contentId of a row in the content table by hash value.
-
selectArtifactRules
String selectArtifactRules()
A statement used to select artifact rules by artifactId.
-
insertArtifactRule
String insertArtifactRule()
A statement to insert a row into the 'rules' table (artifact rule).
-
selectArtifactRuleByType
String selectArtifactRuleByType()
A statement to get a single artifact rule from the 'rules' table by artifactId and rule type.
-
updateArtifactRule
String updateArtifactRule()
A statement to update a single artifact rule.
-
deleteArtifactRule
String deleteArtifactRule()
A statement to delete a single artifact rule.
-
deleteArtifactRules
String deleteArtifactRules()
A statement to delete all rules for a single artifact.
-
deleteArtifactRulesByGroupId
String deleteArtifactRulesByGroupId()
A statement to delete all rules for all artifacts in a groupId.
-
updateArtifactVersionMetaData
String updateArtifactVersionMetaData()
A statement to update the meta-data of a specific artifact version.
-
deleteLabels
String deleteLabels()
A statement to delete all labels for all versions for a single artifact.
-
deleteLabelsByGlobalId
String deleteLabelsByGlobalId()
A statement to delete all labels for a single artifact version by globalId
-
deleteLabelsByGroupId
String deleteLabelsByGroupId()
A statement to delete all labels for all versions for all artifacts in a groupId.
-
deleteProperties
String deleteProperties()
A statement to delete all properties for all versions for a single artifact.
-
deletePropertiesByGlobalId
String deletePropertiesByGlobalId()
A statement to delete all properties for a single artifact version by globalId
-
deletePropertiesByGroupId
String deletePropertiesByGroupId()
A statement to delete all properties for all versions for all artifacts in a groupId.
-
deleteVersions
String deleteVersions()
A statement to delete all versions for a single artifact.
-
deleteVersionsByGroupId
String deleteVersionsByGroupId()
A statement to delete all versions for all artifacts in a groupId.
-
deleteArtifact
String deleteArtifact()
A statement to delete a single row from the artifacts table by artifactId.
-
deleteArtifactsByGroupId
String deleteArtifactsByGroupId()
A statement to delete a all artifacts from the artifacts table by groupId.
-
selectArtifactIds
String selectArtifactIds()
A statement to get all artifacts IDs.
-
selectArtifactMetaDataByGlobalId
String selectArtifactMetaDataByGlobalId()
A statement to get an artifact's meta-data by version globalId.
-
updateArtifactVersionState
String updateArtifactVersionState()
A statement to update the state of an artifact version (by globalId);
-
deleteVersionLabels
String deleteVersionLabels()
A statement to delete the labels for a single artifact version.
-
deleteVersionProperties
String deleteVersionProperties()
A statement to delete the properties for a single artifact version.
-
deleteVersion
String deleteVersion()
A statement to delete a single artifact version.
-
insertLabel
String insertLabel()
A statement to insert a row in the "labels" table.
-
insertProperty
String insertProperty()
A statement to insert a row in the "properties" table.
-
selectArtifactCountById
String selectArtifactCountById()
A statement to select the number of artifacts with a given artifactId (should be 0 or 1).
-
selectContentCountByHash
String selectContentCountByHash()
A statement to select the number of content rows for a given content hash.
-
selectArtifactRuleCountByType
String selectArtifactRuleCountByType()
A statement to select the number of artifact rule rows for a given rule type.
-
selectGlobalRuleCountByType
String selectGlobalRuleCountByType()
A statement to select the number of global rule rows for a given rule type.
-
selectContentById
String selectContentById()
A statement to select the bytes of a content row by contentId.
-
selectContentByContentHash
String selectContentByContentHash()
A statement to select the bytes of a content row by contentHash
-
selectLogConfigurationByLogger
String selectLogConfigurationByLogger()
A statement to select the log configuration for a given logger name
-
upsertLogConfiguration
String upsertLogConfiguration()
A statement to "upsert" a row in the "logconfiguration" table
-
deleteLogConfiguration
String deleteLogConfiguration()
A statement to delete a row in the "logconfiguration" table
-
selectAllLogConfigurations
String selectAllLogConfigurations()
A statement to select all rows in the "logconfiguration" table
-
insertGroup
String insertGroup()
A statement used to insert a row into the groups table.
-
updateGroup
String updateGroup()
A statement used to update information about a group.
-
deleteGroup
String deleteGroup()
A statement used to delete a row from the groups table.
-
selectGroups
String selectGroups()
A statement used to select all rows from groups table.
-
selectGroupByGroupId
String selectGroupByGroupId()
A statement used to select a single group in groups table by groupId.
-
selectNextGlobalId
String selectNextGlobalId()
As statement used to get the next generated/sequenced globalId.
-
exportContent
String exportContent()
-
exportGlobalRules
String exportGlobalRules()
-
exportGroups
String exportGroups()
-
exportArtifactRules
String exportArtifactRules()
-
exportArtifactVersions
String exportArtifactVersions()
-
importContent
String importContent()
-
importGlobalRule
String importGlobalRule()
-
importGroup
String importGroup()
-
importArtifactRule
String importArtifactRule()
-
importArtifactVersion
String importArtifactVersion()
-
selectMaxContentId
String selectMaxContentId()
-
selectMaxGlobalId
String selectMaxGlobalId()
-
selectContentExists
String selectContentExists()
-
selectGlobalIdExists
String selectGlobalIdExists()
-
-