📄 initdb.jsp
字号:
<body bgcolor="#DEDEDE">
<jsp:useBean id="DB" scope="page" class="dbcon.mydb" />
<%
String strJob="";
String strCreatetb=null,strInsert=null;
if(request.getParameter("job")!=null){
strJob=(String)request.getParameter("job");
}
if(strJob.equals("initdb")){
strCreatetb ="CREATE TABLE IF NOT EXISTS AREA (";
strCreatetb =strCreatetb+"INT_AREAID int NOT NULL auto_increment,";
strCreatetb =strCreatetb+"STR_AREATYPE varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_AREANAME varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_AREAMASTER varchar(50) default NULL,";
strCreatetb =strCreatetb+"INT_AREASIDE int NOT NULL default '0',";
strCreatetb =strCreatetb+"INT_ARTICLENUMB int NOT NULL default '0',";
strCreatetb =strCreatetb+"STR_AREANOTE varchar(255) default NULL,";
strCreatetb =strCreatetb+"PRIMARY KEY (INT_AREAID) )";
DB.executeUpdate(strCreatetb);
strInsert="INSERT INTO AREA (STR_AREATYPE,STR_AREANAME,STR_AREAMASTER) VALUES('TYPE1','BOARD1','somebody1')";
DB.executeUpdate(strInsert);
strInsert="INSERT INTO AREA (STR_AREATYPE,STR_AREANAME,STR_AREAMASTER) VALUES('TYPE2','BOARD2','somebody2')";
DB.executeUpdate(strInsert);
strInsert="INSERT INTO AREA (STR_AREATYPE,STR_AREANAME,STR_AREAMASTER) VALUES('TYPE3','BOARD3','somebody3')";
DB.executeUpdate(strInsert);
strInsert="INSERT INTO AREA (STR_AREATYPE,STR_AREANAME,STR_AREAMASTER) VALUES('TYPE4','BOARD4','somebody4')";
DB.executeUpdate(strInsert);
strInsert="INSERT INTO AREA (STR_AREATYPE,STR_AREANAME,STR_AREAMASTER) VALUES('TYPE1','BOARD5','somebody')";
DB.executeUpdate(strInsert);
strCreatetb=null;
strCreatetb ="CREATE TABLE IF NOT EXISTS DATA (";
strCreatetb =strCreatetb+"INT_ID int NOT NULL auto_increment,";
strCreatetb =strCreatetb+"STR_IP varchar(20) default NULL,";
strCreatetb =strCreatetb+"STR_TITLE varchar(255) default NULL,";
strCreatetb =strCreatetb+"STR_SIGN varchar(255) default NULL,";
strCreatetb =strCreatetb+"STR_AUTHOR varchar(80) default NULL,";
strCreatetb =strCreatetb+"STR_DATE varchar(50) default NULL,";
strCreatetb =strCreatetb+"TXT_CONTENT mediumtext,";
strCreatetb =strCreatetb+"INT_ROOTID int NOT NULL default '0',";
strCreatetb =strCreatetb+"INT_RPLYNUMB int NOT NULL default '0',";
strCreatetb =strCreatetb+"INT_CLICKNUMB int NOT NULL default '0',";
strCreatetb =strCreatetb+"INT_ICON int NOT NULL default '0',";
//strCreatetb =strCreatetb+"pic varchar(60) default NULL,";
strCreatetb =strCreatetb+"INT_AREAID int NOT NULL default '0',";
strCreatetb =strCreatetb+"INT_COOL int NOT NULL default '0',";
strCreatetb =strCreatetb+"INT_TXTLEN int NOT NULL default '0',";
strCreatetb =strCreatetb+"PRIMARY KEY (INT_ID) )";
DB.executeUpdate(strCreatetb);
strCreatetb=null;
strCreatetb ="CREATE TABLE IF NOT EXISTS INTRAMAIL (";
strCreatetb =strCreatetb+"INT_ID int NOT NULL auto_increment,";
strCreatetb =strCreatetb+"STR_IP varchar(20) default NULL,";
strCreatetb =strCreatetb+"STR_TITLE varchar(255) default NULL,";
strCreatetb =strCreatetb+"STR_SENDER varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_RECEIVER varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_SENDTIME varchar(50) default NULL,";
strCreatetb =strCreatetb+"TXT_MAILTXT mediumtext,";
strCreatetb =strCreatetb+"INT_FLAG tinyint(4) NOT NULL default '0',";
strCreatetb =strCreatetb+"PRIMARY KEY (INT_ID)";
strCreatetb =strCreatetb+")";
DB.executeUpdate(strCreatetb);
strCreatetb=null;
strCreatetb ="CREATE TABLE IF NOT EXISTS LOGIN (";
strCreatetb =strCreatetb+"INT_ID int NOT NULL auto_increment,";
strCreatetb =strCreatetb+"STR_USER varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_PASSWORD varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_SIGN varchar(255) default NULL,";
strCreatetb =strCreatetb+"INT_POSTNUMB int NOT NULL default '0',";
strCreatetb =strCreatetb+"PRIMARY KEY (INT_ID))";
DB.executeUpdate(strCreatetb);
strInsert="INSERT INTO LOGIN (STR_USER,STR_PASSWORD) VALUES('admin','admin')";
DB.executeUpdate(strInsert);
strCreatetb=null;
strCreatetb ="CREATE TABLE IF NOT EXISTS ONLINE (";
strCreatetb =strCreatetb+"INT_ID int NOT NULL auto_increment,";
strCreatetb =strCreatetb+"STR_IP varchar(20) default NULL,";
strCreatetb =strCreatetb+"STR_USER varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_LOGINTIME varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_QUITTIME varchar(50) default NULL,";
strCreatetb =strCreatetb+"STR_BROWSERTYPE varchar(60) default NULL,";
strCreatetb =strCreatetb+"STR_REMOTEUSER varchar(50) default NULL,";
strCreatetb =strCreatetb+"INT_ONLINE tinyint(4) NOT NULL default '0',";
strCreatetb =strCreatetb+"PRIMARY KEY (INT_ID) )";
DB.executeUpdate(strCreatetb);
out.print("<center><h2>Database has been inited!!</h2></center>");
}else{
%>
<center><h2>Do you really want to init the database?</h2>
<form action="initdb.jsp">
<input type="hidden" name="job" value="initdb">
<input TYPE="submit" VALUE="Ok" NAME="B1">
<input TYPE="reset" VALUE="Cancel" NAME="B2">
</form>
</center>
<%} %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -