Database Structure Board Table - Forum Plate Table Theme Table - Forum Top Table Message Table - Post Master Table Reply Table - Replies Table
Where the Board table records the table name of MessageTable and ReplyTable (indicating that both tables are variable). The THEME table records msgnumber, replyNumber, that is, the number of posts under this topic, the number of replys, newmsgid latest post ID.THEMEID is the number of the topic, it corresponds to a plate area code (ID), and can find the corresponding plate ID via themeID. Message and reply are the table names that are retrieved from the Board, and the post belongs to the topic and that plate (ID).
Reposting Demand 1 Reposted The main operation is to make changes to the subject number of the Message and Reply tables, other auxiliary operations, such as the sector changes with the change in the main area. 2 The data of the THEME table may also change. This happens when the Message of the front and rear sectors, the reply table does not occur. 3 Board table is only used to do query, and the repost does not change it.
Detact operation has been analyzed. There are three parameters we need to pass: posts Msgid, post the original theme area number srcid, post will turn the theme area code THMID
create or replace package body erictest isprocedure chgmeg (msgid number, srcid number, thmid number) ism_msgid varchar2 (20); myid number; - plate code rplycount number; - Replies messageTable1 varchar2 (40); - the main posts of the original table Replytable1 varchar2 (40); - Replies Original table MessageTable2 varcha2 (40); - Post new table replytable2 varcha2 (40); - Replies new table Mynewmsgid number; - Latest last number mysql varcha2 (1000); intermediate variables for operation sql beginm_msgid: = to_char (msgid); messageTable1: = getMessageTable (srcid); replyTable1: = getReplyTable (srcid); messageTable2: = getMessageTable (thmid); replyTable2: = getReplyTable (thmid); select id into Myid from home_forumtheme where themeid = trmid; - The subject correspondence selection select count (*) Into rplycount from home_forumreply where replyto = msgid; - How many replies are there in the post - [[主et]] IF (MessageTable1 = MessageTable2) THEN - If the original sector is shared with a table, then update mysql: = 'update' || messable1 || 'set themeid =' || to_char (trmid) || ', ID =' || to_char (MyID) || 'where sequenceid =' || m_msgid; EXECUTE IMMEDIDID; ELSE - If the original plate and the display have different tables, insert a new table, delete the original table; also calculate the relevant data in the topic table MySQL: = 'INSERT INTO' || MESSAGETABLE2 || '(Themeid, ID) Value (' || to_CHAR ( THMID) || ',' || to_char (myid) || ') Where sequenceid =' || m_msgid; execute immediate mysql; mysql: = 'delete * from' || messagetable1 || 'where sequenceid =' || m_msgid || ';'; EXECUTE IMMEDIATE mysql; mysql: = 'select * from (select newmsgid from home_forumtheme t where themeid =' || to_char (thmid) || 'order by posttime desc) where rownum = 1'; EXECUTE IMMEDIATE mysql Into mynewmsgid; - The latest post number IF (mynewmsgid = msgid) THEN - If the post is the latest, trial new mysql: = 'select * from (select newmsgid from home_forumtheme t where themeid =' | | to_char (THMID) ||