![JAR search and dependency download from the Maven repository](/logo.png)
com.xdev.jadoth.sqlengine.internal.tables.SqlTrigger Maven / Gradle / Ivy
/*
* XDEV Application Framework - XDEV Application Framework
* Copyright © 2003 XDEV Software (https://xdev.software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
package com.xdev.jadoth.sqlengine.internal.tables;
import static com.xdev.jadoth.Jadoth.appendArray;
import static com.xdev.jadoth.Jadoth.appendArraySeperated;
import static com.xdev.jadoth.sqlengine.SQL.LANG.BEGIN_ATOMIC;
import static com.xdev.jadoth.sqlengine.SQL.LANG.CREATE_TRIGGER;
import static com.xdev.jadoth.sqlengine.SQL.LANG.END;
import static com.xdev.jadoth.sqlengine.SQL.LANG.NEW;
import static com.xdev.jadoth.sqlengine.SQL.LANG.OLD;
import static com.xdev.jadoth.sqlengine.SQL.LANG.ON;
import static com.xdev.jadoth.sqlengine.SQL.LANG.REFERENCING;
import static com.xdev.jadoth.sqlengine.SQL.LANG.WHEN;
import static com.xdev.jadoth.sqlengine.SQL.Punctuation.NEW_LINE;
import static com.xdev.jadoth.sqlengine.SQL.Punctuation._;
import static com.xdev.jadoth.sqlengine.SQL.Punctuation.par;
import static com.xdev.jadoth.sqlengine.SQL.Punctuation.rap;
import static com.xdev.jadoth.sqlengine.SQL.Punctuation.scol;
import static com.xdev.jadoth.sqlengine.internal.QueryPart.assembleObject;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import com.xdev.jadoth.Jadoth;
import com.xdev.jadoth.sqlengine.SQL;
import com.xdev.jadoth.sqlengine.dbms.standard.StandardDMLAssembler;
import com.xdev.jadoth.sqlengine.internal.SqlCondition;
import com.xdev.jadoth.util.strings.StringBuilderAssemblable;
/**
* The Class SqlTrigger.
*/
public class SqlTrigger implements StringBuilderAssemblable
{
///////////////////////////////////////////////////////////////////////////
// static fields //
/////////////////////
/** The Constant eINSERT. */
public static final Event eINSERT = new Event(SQL.LANG.INSERT);
/** The Constant eDELETE. */
public static final Event eDELETE = new Event(SQL.LANG.DELETE);
/** The Constant eUPDATE. */
public static final Event eUPDATE = new Event(SQL.LANG.UPDATE);
/** The Constant actionStatmentSeperator. */
protected static final String actionStatmentSeperator = scol+NEW_LINE;
///////////////////////////////////////////////////////////////////////////
// static methods //
/////////////////////
/**
* UPDAT e_ of.
*
* @param columnNames the column names
* @return the event
*/
public static final Event UPDATE_OF(final String[] columnNames){
return new Event("UPDATE OF", columnNames);
}
/**
* Creates the.
*
* @param name the name
* @param time the time
* @param event the event
* @param table the table
* @param action the action
* @param oldRowAlias the old row alias
* @param newRowAlias the new row alias
* @param when the when
* @return the sql trigger
*/
public static final SqlTrigger create(
final String name,
final Time time,
final Event event,
final SqlTableIdentity table,
final Object action,
final String oldRowAlias,
final String newRowAlias,
final SqlCondition when
)
{
return new SqlTrigger(name, time, event, table, action)
.OLD_ROW_AS(oldRowAlias)
.NEW_ROW_AS(newRowAlias)
.WHEN(when)
;
}
///////////////////////////////////////////////////////////////////////////
// instance fields //
/////////////////////
/** The name. */
protected String name;
/** The time. */
protected final Time time;
/** The event. */
protected final Event event;
/** The table. */
protected SqlTableIdentity table;
/** The actions. */
protected final ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy