/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.artemis.jdbc.store.drivers.oracle; import org.apache.activemq.artemis.jdbc.store.sql.GenericSQLProvider; import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider; public class Oracle12CSQLProvider extends GenericSQLProvider { private final String createFileTableSQL = "CREATE TABLE " + tableName + " (ID NUMBER(19) GENERATED BY DEFAULT ON NULL AS IDENTITY, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID))"; private final String createJournalTableSQL = "CREATE TABLE " + tableName + " (id NUMBER(19) GENERATED BY DEFAULT ON NULL AS IDENTITY,recordType NUMBER(5),compactCount NUMBER(5),txId NUMBER(19),userRecordType NUMBER(5),variableSize NUMBER(10),record BLOB,txDataSize NUMBER(10),txData BLOB,txCheckNoRecords NUMBER(10),seq NUMBER(19))"; private static final long MAX_BLOB_SIZE = 4294967296L; //4GB protected Oracle12CSQLProvider(String tableName, DatabaseStoreType databaseStoreType) { super(tableName.toUpperCase(), databaseStoreType); if (tableName.length() > 30) { throw new RuntimeException("The maximum name size for the " + databaseStoreType.name().toLowerCase() + " store table, when using Oracle12C is 30 characters."); } } @Override public long getMaxBlobSize() { return MAX_BLOB_SIZE; } @Override public String getCreateFileTableSQL() { return createFileTableSQL; } @Override public String[] getCreateJournalTableSQL() { return new String[] {createJournalTableSQL}; } public static class Factory implements SQLProvider.Factory { @Override public SQLProvider create(String tableName, DatabaseStoreType databaseStoreType) { return new Oracle12CSQLProvider(tableName, databaseStoreType); } } }