001package io.ebean.migration.ddl; 002 003/** 004 * Detect non transactional SQL statements that must run after normal 005 * sql statements with connection set to auto commit true. 006 */ 007public interface DdlAutoCommit { 008 009 DdlAutoCommit NONE = new NoAutoCommit(); 010 011 DdlAutoCommit POSTGRES = new PostgresAutoCommit(); 012 013 DdlAutoCommit COCKROACH = new CockroachAutoCommit(); 014 015 /** 016 * Return the implementation for the given platform. 017 */ 018 static DdlAutoCommit forPlatform(String name) { 019 switch (name.toLowerCase()) { 020 case "postgres": 021 return POSTGRES; 022 case "cockroach": 023 return COCKROACH; 024 default: 025 return NONE; 026 } 027 } 028 029 /** 030 * Return false if the SQL is non transactional and should run with auto commit. 031 */ 032 boolean transactional(String sql); 033 034 /** 035 * Return true if auto commit true should be used for all DDL for the database platform. 036 */ 037 boolean isAutoCommit(); 038}