|
2011年3月30日
beans.xml beans<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="cc.rm" />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<!--DataSource -->
<bean id="sf"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>cc.rm.vo</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sf"></property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sf" />
</bean>
<aop:config>
<aop:pointcut id="bussinessService"
expression="execution(public * cc.rm.*.*(..))" />
<aop:advisor pointcut-ref="bussinessService"
advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
</beans>
jdbc.properties
propertiesjdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/ll
jdbc.username=root
jdbc.password=1244
在web.xml里加入
web.xml<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/:beans.xml,</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
需要先安装ODBC,才可以使用ODBC连接方式连接数据库 下载地址:mysql-connector-odbc-5.1.8-win32.msi 1 2 3 4 5
new SchemaExport(new AnnotationConfiguration().configure()).create(false, true);
<?xml version='1.0' encoding='gb2312'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!--显示执行的SQL语句-->
<property name="show_sql">true</property>
<!--连接字符串-->
<property name="connection.url">jdbc:mysql://localhost:3306/Test</property>
<!--连接数据库的用户名-->
<property name="connection.username">sa</property>
<!--数据库用户密码-->
<property name="connection.password">sa</property>
<!--数据库驱动-->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!--JDBC连接池(使用内置的连接池)-->
<property name="connection.pool_size">1</property>
<!--设置Hibernate自动管理上下文的策略-->
<property name="current_session_context_class">thread</property>
<!--选择使用的方言-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!--在启动时删除并重新创建数据库-->
<property name="hbm2ddl.auto">create</property>
<mapping resource="events/User.hbm.xml"/>
<mapping resource="events/Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>
一、设计过程包含五个主要步骤。
第 1 步:确定实体和关系
第 2 步:确定所需数据
第 3 步:规范化数据
第 4 步:解析关系
第 5 步:验证设计
二、阅读别人的概念模型图:
不管是从左到右读取还是从右到左读取,下面的规则都会使读取这些图示变得容易:读取 (1) 第一个实体的名称,(2) 第一个实体 旁边的角色,(3) 到第二个实体 的连接的基数,(4) 第二个实体的名称。
三、确定所需数据(实体属性的设计)需要注意的:
确定支持数据时,一定要参考前面确定的活动以了解将如何访问这些数据。
例如,在某些情况下可能需要按雇员的名字列出雇员,而在另一些情况下可能需要按姓氏列出。要满足这两种需要,应创建一个 First Name 属性和一个 Last Name 属性,而不应创建一个既包含名字又包含姓氏的属性。将姓氏和名字分开后,以后可以创建两个索引,分别适用于这两项任务。
请选择一致的名称。使用一致的名称可以使数据库便于维护,并且便于阅读报告和输出窗口。
例如,如果一个属性使用了缩略名称,如 Emp_status,则另一个属性不应使用完整名称,如 Employee_ID。应使名称保持一致,如 Emp_status 和 Emp_ID。
在这个阶段,数据是否与正确的实体相关联并不十分重要。您可以根据自己的判断进行设计。在下一节中,将对设计进行测试,检查您的判断是否正确。
四、规范化是指一系列测试,通过这些测试可以消除冗余的数据,并确保数据与正确的实体或关系相关联。共有五项测试。本节介绍其中前三项测试。这三项测试最重要,因此也最常使用。
五、范式:
数据规范化包括几项测试。数据在通过了第一项测试后,我们认为它满足第一范式;通过了第二项测试后,它满足第二范式;通过了第三项测试后,则满足第三范式。
六、标识符是唯一地标识实体中各行的一组属性,至少由一个属性组成。
七、解析关系:
执行完规范化过程后,设计几乎就完成了。唯一还需要做的事情就是生成与概念数据模型相对应的物理数据模型。这个过程也称作解析关系,因为其中涉及的大量工作就是将概念模型中的关系转换为相应的表和外键关系。
八、概念数据模型可以简化设计过程,因为它将大量细节隐藏起来。例如,多对多关系总会生成一个额外的表和两个外键引用。在概念数据模型中,通常可以用一个连接来标识这类结构。
九、域(用户定义的数据类型)
十、数据库对象的定义构成了数据库模式:您可以将模式看做一个空数据库。(是否可以理解成C#的命名空间或java里的包概念)
十一、
这个插件在JQuery1.5.1版下无法使用。 项目地址:http://dev.iceburg.net/jquery/tableEditor/demo.php html文件: html<table id="editableTable" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th name="ID">ID</th>
<th name="first">First Name</th>
<th name="last">Last Name</th>
<th>Phone</th>
<th name="city">City</th>
<th name="email">Email</th>
</tr>
<tr>
<td><key>233</key> <button class="eventLink">edit</button></td>
<td><input type="text" name="XXXX" val="YYYY"></input></td>
<td>XXX</td>
<td><input type="checkbox" checked name="zzTop"></input></td>
<td><input type="checkbox" name="yyy"></input></td>
<td><select name="yyy"><option>XXX</option><option SELECTED>YYY</option></select></td>
</tr>
</thead>
<tbody>
<tr>
<td><key>1</key> <button class="eventLink">edit</button></td>
<td>Brice</td>
<td>Burgess</td>
<td>(800)768-5283</td>
<td>Milwaukee</td>
<td>b@b.com</td>
</tr>
<tr>
<td><key>2</key> <button class="eventLink">edit</button></td>
<td>Christian</td>
<td>Bach</td>
<td>(800)768-6288</td>
<td>Chicago</td>
<td>c@c.com</td>
</tr>
<tr>
<td><key>3</key> <button class="eventLink">edit</button></td>
<td>Abe</td>
<td>Lincoln</td>
<td>(800)223-2331</td>
<td>Washington D.C.</td>
<td>l@l.com</td>
</tr>
<tr>
<td><key>8</key> <button class="eventLink">edit</button></td>
<td>Sam Lightning</td>
<td>Hopkings</td>
<td>(800)728-1221</td>
<td>Houston</td>
<td>s@s.com</td>
</tr>
<tr>
<td><key>15</key> <button class="eventLink">edit</button></td>
<td>Rudyard</td>
<td>Kipling</td>
<td>(512)121-1280</td>
<td>London</td>
<td>r@r.com</td>
</tr>
</tbody>
</table>
js文件
js<script type="text/javascript">
$().ready(function() {
$("#editableTable").tableSorter({
sortClassAsc: 'headerSortUp', // class name for ascending sorting action to header
sortClassDesc: 'headerSortDown', // class name for descending sorting action to header
headerClass: 'header', // class name for headers (th's)
disableHeader: 'ID' // DISABLE Sorting on ID
}).tableEditor({
EDIT_HTML: 'edit',
SAVE_HTML: 'save',
EVENT_LINK_SELECTOR: 'button.eventLink',
FUNC_UPDATE: 'updateTable'
});
document.counter = 0;
});
function updateTable(o) {
document.counter++;
if ((document.counter%2) == 0) {
// restore row
alert('Update failed. Row restore.');
$.tableEditor.lib.restoreRow(o.row,o.original);
}
else
alert('Update Success');
return true;
}
</script>
从DLOG4J读到的Request的工具类: java/*
* RequestUtils.java
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Winter Lau (javayou@gmail.com)
* http://dlog4j.sourceforge.net
*/
package com.liusoft.dlog4j.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.text.MessageFormat;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.liusoft.dlog4j.Globals;
/**
* 用于Request的工具类
* @author Winter Lau
*/
public class RequestUtils extends org.apache.struts.util.RequestUtils{
final static Log log = LogFactory.getLog(RequestUtils.class);
private static Properties header_map;
private static String default_mobile;
static{
InputStream in = RequestUtils.class.getResourceAsStream("/com/liusoft/dlog4j/util/mobile_match.properties");
header_map = new Properties();
try{
header_map.load(in);
default_mobile = header_map.getProperty("empty");
}catch(IOException e){
log.error("加载手机号码匹配策略文件/mobile_match.conf失败",e);
}
}
public static boolean isMultipart(HttpServletRequest req) {
return ((req.getContentType() != null) && (req.getContentType()
.toLowerCase().startsWith("multipart")));
}
/**
* 获取FCKUpload过程中生成的会话ID
* @return
*/
public static String getDlogSessionId(HttpServletRequest req){
//优先从Cookie中获取ssn_id值
String ssn_id = null;
Cookie cok = RequestUtils.getCookie(req, Globals.SESSION_ID_KEY_IN_COOKIE);
if(cok != null){
ssn_id = cok.getValue();
}
if(StringUtils.isEmpty(ssn_id)){
//如果Cookie得不到则从服务器的会话中读取
HttpSession ssn = req.getSession(false);
if (ssn != null)
ssn_id = ssn.getId();
}
return ssn_id;
}
/**
* 清除FCKUpload过程中生成的Cookie
* @param req
* @param res
*/
public static void clearDlogSessionId(HttpServletRequest req, HttpServletResponse res){
Cookie cok = RequestUtils.getCookie(req, Globals.SESSION_ID_KEY_IN_COOKIE);
if(cok != null){
cok.setMaxAge(0);
res.addCookie(cok);
}
}
/**
* 获取COOKIE
*
* @param name
*/
public static Cookie getCookie(HttpServletRequest request, String name) {
Cookie[] cookies = request.getCookies();
if(cookies == null)
return null;
for (int i = 0; i < cookies.length; i++) {
if (name.equals(cookies[i].getName())) {
return cookies[i];
}
}
return null;
}
/**
* 设置COOKIE
*
* @param name
* @param value
* @param maxAge
*/
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String name,
String value, int maxAge) {
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(maxAge);
String serverName = request.getServerName();
String domain = getDomainOfServerName(serverName);
if(domain!=null && domain.indexOf('.')!=-1){
cookie.setDomain('.' + domain);
}
cookie.setPath("/");
response.addCookie(cookie);
}
/**
* 获取用户访问URL中的根域名
* 例如: www.dlog.cn -> dlog.cn
* @param req
* @return
*/
public static String getDomainOfServerName(String host){
if(StringUtils.isIPAddr(host))
return null;
String[] names = StringUtils.split(host, '.');
int len = names.length;
if(len>=2)
return names[len-2]+'.'+names[len-1];
return host;
}
public static void main(String[] args){
String host = "127.0.0.1";
System.out.println("DOMAIN: " + getDomainOfServerName(host));
host = "dlog.cn";
System.out.println("DOMAIN: " + getDomainOfServerName(host));
host = "abc.mail.dlog.cn";
System.out.println("DOMAIN: " + getDomainOfServerName(host));
}
/**
* 从URL地址中解析出URL前缀,例如
* http://wap.mo168.com:8081/index.jsp -> http://wap.mo168.com:8081
* @param req
* @return
*/
public static String getUrlPrefix(HttpServletRequest req){
StringBuffer url = new StringBuffer(req.getScheme());
url.append("://");
url.append(req.getServerName());
int port = req.getServerPort();
if(port!=80){
url.append(":");
url.append(port);
}
return url.toString();
}
/**
* 获取访问的URL全路径
* @param req
* @return
*/
public static String getRequestURL(HttpServletRequest req){
StringBuffer url = new StringBuffer(req.getRequestURI());
String param = req.getQueryString();
if(param!=null){
url.append('?');
url.append(param);
}
String path = url.toString();
return path.substring(req.getContextPath().length());
}
/**
* 打印所有的头信息
* @param out
* @param req
*/
public static void dumpHeaders(PrintStream out, HttpServletRequest req){
Enumeration names = req.getHeaderNames();
while(names.hasMoreElements()){
String name = (String)names.nextElement();
out.println(name+"="+req.getHeader(name));
}
}
/**
* 从请求中解析手机号码
* @param req
* @return
*/
public static String getRequestMobile(HttpServletRequest req){
String mobile = default_mobile;
Iterator keys = header_map.keySet().iterator();
while(keys.hasNext()){
String header = (String)keys.next();
String value = getHeader(req,header);
if(value!=null){
String pattern = (String)header_map.get(header);
MessageFormat mf = new MessageFormat(pattern);
try{
Object[] vs = mf.parse(value);
mobile = (String)vs[0];
if(mobile.startsWith("86"))
mobile = mobile.substring(2);
break;
}catch(Exception e){
log.warn("解析header失败",e);
dumpHeaders(req, System.err);
continue;
}
}
}
return mobile;
}
/**
* 获取header信息,名字大小写无关
* @param req
* @param name
* @return
*/
public static String getHeader(HttpServletRequest req, String name){
String value = req.getHeader(name);
if(value!=null)
return value;
Enumeration names = req.getHeaderNames();
while(names.hasMoreElements()){
String n = (String)names.nextElement();
if(n.equalsIgnoreCase(name)){
return req.getHeader(n);
}
}
return null;
}
/**
* 打印所有头信息
* @param req
* @param out
*/
public static void dumpHeaders(HttpServletRequest req, PrintStream out){
Enumeration hds = req.getHeaderNames();
out.println("=============== HEADERS ===============");
while(hds.hasMoreElements()){
String name = (String)hds.nextElement();
out.println(name+"="+req.getHeader(name));
}
}
/**
* 判断手机是否支持某种类型的格式
* @param req
* @param contentType
* @return
*/
public static boolean support(HttpServletRequest req, String contentType){
String accept = getHeader(req, "accept");
if(accept!=null){
accept = accept.toLowerCase();
return accept.indexOf(contentType.toLowerCase())!=-1;
}
return false;
}
/**
* 判断浏览器是否与Mozilla兼容
* @param req
* @return
*/
public static boolean isMozillaCompatible(HttpServletRequest req){
String user_agent = req.getHeader("user-agent");
return user_agent==null || user_agent.indexOf("Mozilla")!=-1;
}
/**
* 获取浏览器提交的整形参数
* @param param
* @param defaultValue
* @return
*/
public static int getParam(HttpServletRequest req, String param, int defaultValue){
try{
String value = req.getParameter(param);
int idx = value.indexOf('#');
if(idx!=-1)
value = value.substring(0,idx);
return Integer.parseInt(value);
}catch(Exception e){}
return defaultValue;
}
/**
* 获取浏览器提交的字符串参数
* @param param
* @param defaultValue
* @return
*/
public static String getParam(HttpServletRequest req, String param, String defaultValue){
String value = req.getParameter(param);
return (StringUtils.isEmpty(value))?defaultValue:value;
}
}
java/*
* SiteAction.java
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Winter Lau
* http://dlog4j.sourceforge.net
*/
package com.liusoft.dlog4j;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletContext;
import org.apache.commons.lang.StringUtils;
/**
* DLOG在安全方面的一些处理方法
* 敏感词汇表:/WEB-INF/conf/illegal_glossary.dat
*
* @author Winter Lau
*/
public class DLOGSecurityManager {
/**
* 初始化
* @param sc
* @throws IOException
*
* @see com.liusoft.dlog4j.servlet.DLOG_ActionServlet#init()
*/
public static void init(ServletContext sc) throws IOException {
IllegalGlossary.init(sc);
}
public static void destroy(){
IllegalGlossary.destroy();
}
/**
* 敏感字汇
* @author Winter Lau
*/
public static class IllegalGlossary {
private final static String file_glossary = "/WEB-INF/conf/illegal_glossary.dat";
private static List glossary = null;
public static void init(ServletContext sc) throws IOException {
glossary = new ArrayList(1000);
if(sc!=null)
loadIllegalGlossary(sc);
}
public static void destroy(){
if(glossary!=null)
glossary.clear();
}
/**
* 加载敏感词汇表
* @param sc
* @throws IOException
*/
private synchronized static void loadIllegalGlossary(ServletContext sc) throws IOException {
InputStream in = sc.getResourceAsStream(file_glossary);
BufferedReader reader = null;
try{
reader = new BufferedReader(new InputStreamReader(in));
do{
String line = reader.readLine();
if(line==null)
break;
glossary.add(line.trim());
}while(true);
}finally{
in.close();
}
}
/**
* 自动将敏感词汇用XXX替换
*
* @param content
* @return
*/
public static String autoGlossaryFiltrate(String content) {
if(StringUtils.isEmpty(content))
return content;
for (int i = 0; i < glossary.size(); i++) {
String word = (String)glossary.get(i);
content = StringUtils.replace(content, word, StringUtils
.repeat("X", word.length()));
}
return content;
}
/**
* 判断是否存在非法内容
* @param content
* @return
*/
public static boolean existIllegalWord(String content){
if(StringUtils.isEmpty(content))
return false;
for (int i = 0; i < glossary.size(); i++) {
String word = (String) glossary.get(i);
if(content.indexOf(word)>=0)
return true;
}
return false;
}
/**
* 删除内容中存在的关键字
* @param content
* @return
*/
public static String deleteIllegalWord(String content){
if(StringUtils.isEmpty(content))
return content;
for (int i = 0; i < glossary.size(); i++) {
String word = (String) glossary.get(i);
content = StringUtils.remove(content, word);
}
return content;
}
}
public static void main(String[] args) throws IOException{
init(null);
String text = "中华人民共和国国家主席毛泽东,我们叫他毛主席";
System.out.println(IllegalGlossary.autoGlossaryFiltrate(text));
}
}
这个类,是从DLOG4J上学到的。
sqlDROP DATABASE IF EXISTS `local` ;
CREATE DATABASE `local`;
use `local` ;
DROP TABLE IF EXISTS actionmanager;
CREATE TABLE actionmanager(
actionid INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
actionName VARCHAR(255) NOT NULL ,
action VARCHAR(255) NOT NULL,
createDate DATE,
viewmode INT DEFAULT 0
#index inx(`action`)
)type=InnoDB;
DROP TABLE IF EXISTS actioncolumn ;
CREATE TABLE actioncolumn(
actioncolumnid INT AUTO_INCREMENT NOT NULL PRIMARY KEY ,
actioncolumnname VARCHAR(255) NOT NULL
)type=InnoDB;
DROP TABLE IF EXISTS groupmanager;
CREATE TABLE groupmanager(
groupid INT AUTO_INCREMENT NOT NULL PRIMARY KEY ,
groupname VARCHAR(255) NOT NULL,
groupinfo VARCHAR(255) DEFAULT NULL,
masterid INT NOT NULL, #who created this group
mastername VARCHAR(255),
createdate DATE
)type=InnoDB;
DROP TABLE IF EXISTS master;
CREATE TABLE master(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL ,
password VARCHAR(255) NOT NULL ,
sex VARCHAR(255) NOT NULL ,
position VARCHAR(255) NOT NULL,
masterid INT , #whoe created this master
mastername VARCHAR(255),
createdate DATE
)type=InnoDB;
DROP TABLE IF EXISTS actiongroup ;
CREATE TABLE actiongroup(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`action` VARCHAR(255) NOT NULL,
groupid INT NOT NULL ,
masterid int NOT NULL,
mastername VARCHAR(255) NOT NULL ,
createdate DATE,
index inx_ag(`action`)
)type=InnoDB;
DROP TABLE IF EXISTS mastergroup ;
CREATE TABLE mastergroup(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
masterid INT NOT NULL ,
groupid INT NOT NULL ,
masterid2 INT NOT NULL , # who created or modified this mastergroup
creatDate DATE
)type=InnoDB ;
##############action link group ######################
CREATE INDEX idx_actionmanager_action ON actionmanager(`action`);
CREATE INDEX idx_groupmanager_groupid ON groupmanager(`groupid`);
ALTER TABLE actiongroup
ADD CONSTRAINT fk_action
FOREIGN KEY (action) REFERENCES actionmanager(`action`)
ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE actiongroup
ADD CONSTRAINT fk_groupid
FOREIGN KEY (groupid) REFERENCES groupmanager(`groupid`)
ON DELETE CASCADE ON UPDATE CASCADE;
##############action link master######################
CREATE INDEX idx_master_id ON master(`id`);
ALTER TABLE mastergroup
ADD CONSTRAINT fk_masterg_mid
FOREIGN KEY (masterid) REFERENCES master(`id`)
ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE mastergroup
ADD CONSTRAINT fk_masterg_gid
FOREIGN KEY (groupid) REFERENCES groupmanager(`groupid`)
ON DELETE CASCADE ON UPDATE CASCADE;
|