<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TQ 试用 WP &#187; compare</title>
	<atom:link href="http://tq.freehostia.com.freehostia.com/tag/compare/feed" rel="self" type="application/rss+xml" />
	<link>http://tq.freehostia.com.freehostia.com</link>
	<description>TQ 试用中... ...</description>
	<lastBuildDate>Fri, 19 Mar 2010 06:07:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>compare</title>
		<link>http://tq.freehostia.com.freehostia.com/2009/08/compare.html</link>
		<comments>http://tq.freehostia.com.freehostia.com/2009/08/compare.html#comments</comments>
		<pubDate>Sun, 23 Aug 2009 08:46:00 +0000</pubDate>
		<dc:creator>TQ</dc:creator>
				<category><![CDATA[MY 默认分类]]></category>
		<category><![CDATA[compare]]></category>

		<guid isPermaLink="false">http://tq.freehostia.com.freehostia.com/2009/08/compare.html</guid>
		<description><![CDATA[
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
CREATE OR REP... ]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
</pre></td><td class="code"><pre class="plsql" style="font-family:monospace;"><span style="color: #00F;">CREATE</span> <span style="color: #00F;">OR</span> <span style="color: #000;">REPLACE</span> <span style="color: #00F;">PROCEDURE</span> del_UserContent<span style="color: #00F;">&#40;</span>phoneNum <span style="color: #00F;">VARCHAR2</span><span style="color: #00F;">,</span>
                                            oresultcode   <span style="color: #00F;">OUT</span> INT<span style="color: #00F;">&#41;</span> <span style="color: #00F;">IS</span>
&nbsp;
  memberId <span style="color: #00F;">NUMBER</span><span style="color: #00F;">;</span> <span style="color: #080; font-style: italic;">--用户id</span>
  cnt <span style="color: #00F;">INTEGER</span><span style="color: #00F;">;</span>
&nbsp;
<span style="color: #00F;">BEGIN</span>
  oresultcode <span style="color: #00F;">:=</span> <span style="color: #800;">0</span><span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #080; font-style: italic;">--删除临时注册表中的信息</span>
  <span style="color: #00F;">SELECT</span> <span style="color: #000;">COUNT</span><span style="color: #00F;">&#40;</span><span style="color: #00F;">*</span><span style="color: #00F;">&#41;</span> <span style="color: #00F;">INTO</span> cnt <span style="color: #00F;">FROM</span> member_reg t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>phone<span style="color: #00F;">=</span>phoneNum<span style="color: #00F;">;</span>
  <span style="color: #00F;">IF</span> cnt<span style="color: #00F;">&gt;</span><span style="color: #800;">0</span> <span style="color: #00F;">THEN</span>
    <span style="color: #00F;">BEGIN</span>
      <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_reg t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>phone<span style="color: #00F;">=</span>phoneNum<span style="color: #00F;">;</span>
   <span style="color: #00F;">END</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">END</span> <span style="color: #00F;">IF</span><span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #00F;">SELECT</span> member_id
    <span style="color: #00F;">INTO</span> memberId
    <span style="color: #00F;">FROM</span> member
   <span style="color: #00F;">WHERE</span> phone <span style="color: #00F;">=</span> phoneNum<span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #080; font-style: italic;">--删除所有好友和群组的映射关系</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> grp_friend_rel t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>MEMBER_ID<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除所有群组信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> friend_grp t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除所有好友信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> friend t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id <span style="color: #00F;">=</span> memberId<span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #080; font-style: italic;">--删除定制信息中包含的彩像信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> winks_pkg t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id <span style="color: #00F;">=</span> memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除定制信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> winks_script t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id <span style="color: #00F;">=</span> memberId<span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #080; font-style: italic;">--删除我的彩像库中的信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_winks t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #080; font-style: italic;">--删除彩像库中本用户diy上传的彩像文件</span>
  <span style="color: #080; font-style: italic;">--delete from winks_file t where t.winks_id in (select w.winks_id from winks w where w.owner_id=memberId);</span>
  <span style="color: #080; font-style: italic;">--删除彩像库中本用户diy上传的彩像信息</span>
  <span style="color: #080; font-style: italic;">--delete from winks t where t.owner_id=memberId;</span>
  <span style="color: #00F;">UPDATE</span> winks t <span style="color: #00F;">SET</span> t<span style="color: #00F;">.</span>owner_type<span style="color: #00F;">=</span><span style="color: #800;">2</span> <span style="color: #00F;">,</span> t<span style="color: #00F;">.</span>owner_id<span style="color: #00F;">=</span><span style="color: #800;">10001</span> <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>owner_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除订单明细信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> line_item t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>contract_id <span style="color: #00F;">IN</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> a<span style="color: #00F;">.</span>contract_id <span style="color: #00F;">FROM</span> contract a <span style="color: #00F;">WHERE</span> a<span style="color: #00F;">.</span>buy_account_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> line_item t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>contract_id <span style="color: #00F;">IN</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> a<span style="color: #00F;">.</span>contract_id <span style="color: #00F;">FROM</span> contract a <span style="color: #00F;">WHERE</span> a<span style="color: #00F;">.</span>sell_account_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除订单信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> contract t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>buy_account_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> contract t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>sell_account_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除注册激活日志信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_scr_log t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除用户客户端配置信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_client t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除推荐用户信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_invited t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除社区元素明细信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_action t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>invited_member_action_id <span style="color: #00F;">IN</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> a<span style="color: #00F;">.</span>member_action_id <span style="color: #00F;">FROM</span> member_action a <span style="color: #00F;">WHERE</span> a<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_action t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--更新member表中推荐人信息</span>
  <span style="color: #00F;">UPDATE</span> member t <span style="color: #00F;">SET</span> t<span style="color: #00F;">.</span>invited_by <span style="color: #00F;">=</span> <span style="color: #00F;">NULL</span>
                  <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>invited_by <span style="color: #00F;">=</span> memberId<span style="color: #00F;">;</span>
  <span style="color: #00F;">COMMIT</span><span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除修改密码的信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member_at_site t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除用户信息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> member t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>member_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除此用户相关消息</span>
  <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> message t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>party_id<span style="color: #00F;">=</span>memberId <span style="color: #00F;">OR</span> t<span style="color: #00F;">.</span>send_from<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
  <span style="color: #080; font-style: italic;">--删除参与者信息</span>
   <span style="color: #00F;">DELETE</span> <span style="color: #00F;">FROM</span> party t <span style="color: #00F;">WHERE</span> t<span style="color: #00F;">.</span>party_id<span style="color: #00F;">=</span>memberId<span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #00F;">IF</span> SQL<span style="color: #00F;">%</span>NOTFOUND <span style="color: #00F;">THEN</span>
    <span style="color: #00F;">ROLLBACK</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put_line<span style="color: #00F;">&#40;</span><span style="color: #F00;">'NO SUCH USER'</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    oresultcode <span style="color: #00F;">:=</span> <span style="color: #00F;">-</span><span style="color: #800;">21000</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">RETURN</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">END</span> <span style="color: #00F;">IF</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">COMMIT</span><span style="color: #00F;">;</span>
<span style="color: #00F;">EXCEPTION</span>
  <span style="color: #00F;">WHEN</span> <span style="color: #00F;">OTHERS</span> <span style="color: #00F;">THEN</span>
    <span style="color: #00F;">ROLLBACK</span><span style="color: #00F;">;</span>
    oresultcode <span style="color: #00F;">:=</span> <span style="color: #00F;">SQLCODE</span><span style="color: #00F;">;</span>
<span style="color: #00F;">END</span><span style="color: #00F;">;</span>
<span style="color: #00F;">/</span></pre></td></tr></table></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<pre class="sql" name="code">
CREATE OR REPLACE PROCEDURE del_UserContent(phoneNum VARCHAR2,
                                            oresultcode   OUT INT) IS

  memberId NUMBER; --用户id
  cnt INTEGER;

BEGIN
  oresultcode := 0;

  --删除临时注册表中的信息
  select count(*) into cnt from member_reg t where t.phone=phoneNum;
  IF cnt>0 THEN
    BEGIN
      delete from member_reg t where t.phone=phoneNum;
   END;
  END IF;

  select member_id
    into memberId
    from member
   WHERE phone = phoneNum;

  --删除所有好友和群组的映射关系
  delete from grp_friend_rel t where t.MEMBER_ID=memberId;
  --删除所有群组信息
  delete from friend_grp t where t.member_id=memberId;
  --删除所有好友信息
  delete from friend t where t.member_id = memberId;

  --删除定制信息中包含的彩像信息
  delete from winks_pkg t where t.member_id = memberId;
  --删除定制信息
  delete from winks_script t where t.member_id = memberId;

  --删除我的彩像库中的信息
  delete from member_winks t where t.member_id=memberId;

  --删除彩像库中本用户diy上传的彩像文件
  --delete from winks_file t where t.winks_id in (select w.winks_id from winks w where w.owner_id=memberId);
  --删除彩像库中本用户diy上传的彩像信息
  --delete from winks t where t.owner_id=memberId;
  update winks t set t.owner_type=2 , t.owner_id=10001 where t.owner_id=memberId;
  --删除订单明细信息
  delete from line_item t where t.contract_id in (select a.contract_id from contract a where a.buy_account_id=memberId);
  delete from line_item t where t.contract_id in (select a.contract_id from contract a where a.sell_account_id=memberId);
  --删除订单信息
  delete from contract t where t.buy_account_id=memberId;
  delete from contract t where t.sell_account_id=memberId;
  --删除注册激活日志信息
  delete from member_scr_log t where t.member_id=memberId;
  --删除用户客户端配置信息
  delete from member_client t where t.member_id=memberId;
  --删除推荐用户信息
  delete from member_invited t where t.member_id=memberId;
  --删除社区元素明细信息
  delete from member_action t where t.invited_member_action_id in (select a.member_action_id from member_action a where a.member_id=memberId);
  delete from member_action t where t.member_id=memberId;
  --更新member表中推荐人信息
  update member t set t.invited_by = null
                  where t.invited_by = memberId;
  commit;
  --删除修改密码的信息
  delete from member_at_site t where t.member_id=memberId;
  --删除用户信息
  delete from member t where t.member_id=memberId;
  --删除此用户相关消息
  delete from message t where t.party_id=memberId or t.send_from=memberId;
  --删除参与者信息
   delete from party t where t.party_id=memberId;

  IF SQL%NOTFOUND THEN
    ROLLBACK;
    dbms_output.put_line('NO SUCH USER');
    oresultcode := -21000;
    RETURN;
  END IF;
  COMMIT;
EXCEPTION
  WHEN OTHERS THEN
    ROLLBACK;
    oresultcode := sqlcode;
END;
/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tq.freehostia.com.freehostia.com/2009/08/compare.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
