标题:
[讨论]
重名问题菜鸟做法,,
[打印本页]
作者:
ZhXand618
时间:
2016-10-16 04:24
标题:
重名问题菜鸟做法,,
最近下载了R大的纯净端~~~
- L, e) w5 D4 i/ m7 z _+ O妖城在线论坛
可惜我的mysql是4.1.22……不支持触发器
7 i8 l: N$ d3 lbbs.mocwww.com
但是作为一个菜鸟没把握升级mysql……怕升了又得各种调试
% V, D8 f% y) K9 I1 S' a: a! H1 K妖城在线论坛
; e2 [2 y6 {& X# U! B1 A+ s魔力私服,最新魔力宝贝私服技术交流
妖城在线论坛" A( I& v2 M0 ^7 Y x3 ]
于是自以为是地尝试
魔力私服,最新魔力私服,魔力宝贝私服,魔力宝贝私服技术,魔力宝贝私服,私服架设技术,妖城,FLASH,电影,黑客,网络,网吧,破解,入侵,注册表8 |1 j& B1 P H1 C: F7 E
alter table `tbl_user` change SequenceNumber SequenceNumber int not null auto_increment UNIQUE;
9 d# T8 U7 }, o1 l$ C, m魔力私服,最新魔力宝贝私服技术交流
魔力私服,最新魔力私服,魔力宝贝私服,魔力宝贝私服技术,魔力宝贝私服,私服架设技术,妖城,FLASH,电影,黑客,网络,网吧,破解,入侵,注册表. Y+ \# Z( W; l) j
结果悲催地发现每次创建角色,tbl_user.SequenceNumber会加1,然后tbl_character.RegistNumber 等于加1后的tbl_user.SequenceNumber
9 N1 n/ C% G' L1 z( g# |/ u
顺道还发现mysql4.1.22不支持自定义自增步长……
- p% {( t! x$ |2 V
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート- X6 q( N/ E/ R5 }% }
在犹豫好久最终还是不敢升级mysql后,,突然有了个能凑合用的办法,,取消SequenceNumber的自增属性,然后写了这条丑的要命、乱的要死的sql……
妖城在线论坛8 p/ C6 a9 G4 {$ d, w( m3 Z
Insert into tbl_user(AccountID,AccountPassword,EnableFlg,TrialFlg,DownFlg,ExpFlg,UseFlg,BadMsg,CdKey,SequenceNumber)
# r: y* K7 T: L, ]; C* u2 k4 T魔力私服,最新魔力私服,魔力宝贝私服,魔力宝贝私服技术,魔力宝贝私服,私服架设技术,妖城,FLASH,电影,黑客,网络,网吧,破解,入侵,注册表
select $id,$pass,EnableFlg,TrialFlg,DownFlg,ExpFlg,UseFlg,BadMsg,$id,((SequenceNumber div 100)+1)*100 as SequenceNumber
+ S7 H8 a1 g& {, x9 Q6 hbbs.mocwww.com
from tbl_user
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート" ^6 `9 n6 Q# P( B# `. l# z4 y# R
where SequenceNumber in
. Z: F7 @0 U/ i7 G8 w魔力私服,最新魔力宝贝私服技术交流
(select max(SequenceNumber) from tbl_user);
' K1 I4 e9 h$ p5 L! F0 ^- v; E
魔力私服,最新魔力宝贝私服技术交流- Z8 I) f( R, p/ \/ k: ?! U2 L U
然后得到了这个效果,其中SN=201是创建了一个角色得到的,我想每个账号约100次重复创建角色的机会,应该够我几个小伙伴霍霍的
。。。
8 R4 c. D8 f- c) Y, ^
+-----------------+----------------+-----------------+-----------------+-----------+--------+--------+----------+---------+--------+
妖城在线论坛$ ~0 \* s3 G- o# A g8 P2 _) I
| CdKey | SequenceNumber | AccountID | AccountPassWord | EnableFlg | UseFlg | BadMsg | TrialFlg | DownFlg | ExpFlg |
( X& L) N# ^- T$ G+ {. h
+-----------------+----------------+-----------------+-----------------+-----------+--------+--------+----------+---------+--------+
1 t9 O& ^; {2 s- U& Q) \
| admin | 3 | admin | 1234 | 1 | 1 | 0 | 8 | 0 | 0 |
, D6 `! T+ J) ^" g2 h1 l# |, k—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
| 1000 | 4 | 1000 | 1000 | 1 | 1 | 0 | 8 | 0 | 0 |
妖城在线论坛6 d6 I" S' [' k: P( @7 ?* y
| 2000 | 6 | 2000 | 2000 | 1 | 1 | 0 | 8 | 0 | 0 |
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート- l" n# h% {# r/ |6 d
| --------- | 15 | --------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
% h/ _( c ]' z# O, F0 a0 m
| --------------- | 18 | --------------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
bbs.mocwww.com8 S3 _6 D8 G8 Z" T, ^
| ---- | 17 | ---- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
bbs.mocwww.com. N. _1 k( o+ C( K
| ------ | 100 | ------ | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート; N8 m6 X& g2 S3 c/ z3 u5 o
| ------------- | 201 | ------------- | --------- | 1 | 1 | 0 | 8 | 0 | 0 |
妖城在线论坛4 S! X H `+ i; p' f7 j: b
| ------------ | 300 | ------------ | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
0 g3 s; C$ F+ Q0 ]魔力私服,最新魔力宝贝私服技术交流
+-----------------+----------------+-----------------+-----------------+-----------+--------+--------+----------+---------+--------+
作者:
ZhXand618
时间:
2016-10-16 04:28
为啥发出来后列表就乱了
. q, v* l) [2 h# q/ D) `—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
编辑时很整齐啊。。。
* L3 ]; o. t3 }: F' x. F1 e" j—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
+-----------------+----------------+-----------------+-----------------+-----------+--------+--------+----------+---------+--------+
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート5 \$ Y, ` [( D8 I
| CdKey | SequenceNumber | AccountID | AccountPassWord | EnableFlg | UseFlg | BadMsg | TrialFlg | DownFlg | ExpFlg |
! V. o! W" H9 A% J: h
+-----------------+----------------+-----------------+-----------------+-----------+--------+--------+----------+---------+--------+
1 y5 @2 _1 X. A8 T魔力私服,最新魔力私服,魔力宝贝私服,魔力宝贝私服技术,魔力宝贝私服,私服架设技术,妖城,FLASH,电影,黑客,网络,网吧,破解,入侵,注册表
| --------------- |--------------- | --------------- | 1234 | 1 | 1 | 0 | 8 | 0 | 0 |
2 ^9 s/ O* M5 I! P3 s0 M! G魔力私服,最新魔力宝贝私服技术交流
| --------------- |--------------- | --------------- | 1000 | 1 | 1 | 0 | 8 | 0 | 0 |
( d1 c c( t9 M3 E
| --------------- |--------------- | --------------- | 2000 | 1 | 1 | 0 | 8 | 0 | 0 |
2 S& z5 j7 w! t) Y; Z3 ?* Y! s
| --------------- |--------------- | --------------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
. n% t2 Q% f+ d) r+ s—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
| --------------- |--------------- | --------------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
, H1 M" ~% ~; E—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
| --------------- |--------------- | --------------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
bbs.mocwww.com% ]" q! G" }; V7 \, x: v
| --------------- |--------------- | --------------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート% N& T8 M" X# R( S% f; R* F2 h
| --------------- |--------------- | --------------- | --------- | 1 | 1 | 0 | 8 | 0 | 0 |
( Q& `- ]! `3 [# f: ]
| --------------- |--------------- | --------------- | ------ | 1 | 1 | 0 | 8 | 0 | 0 |
4 p% R6 _( R Q: B3 W魔力私服,最新魔力宝贝私服技术交流
+-----------------+----------------+-----------------+-----------------+-----------+--------+--------+----------+---------+--------+
作者:
易凡
时间:
2016-10-16 19:57
虽然看不懂,但还是要点个赞!!!
作者:
rolser
时间:
2016-10-16 22:09
我竟然看懂啦,哈哈~~
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート! m$ i5 q9 m4 s
8 N) R8 M% @/ w! W* `0 B- I3 c, D3 O—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
redhat 6 系列和 centos 6 默认mysql 就是5版本了。
6 ]* c; I) v+ [ t魔力私服,最新魔力私服,魔力宝贝私服,魔力宝贝私服技术,魔力宝贝私服,私服架设技术,妖城,FLASH,电影,黑客,网络,网吧,破解,入侵,注册表
7系列mysql版本更高。
作者:
ZhXand618
时间:
2016-10-17 00:05
标题:
回复 地板 的帖子
主要是我特别菜,默认的mysql5,没调通- -
. h3 S2 K r3 _" H% fbbs.mocwww.com
后来下的4.1.22的rpm包……
作者:
ZhXand618
时间:
2016-10-17 03:01
昨天八成脑子混乱了。。今天发现只是解决了重名丢失问题……
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート- }7 z; f) K7 P! x5 q
对防重名的问题了解的太少啊
: i4 Y4 t1 z- ?% B—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
2 Z; X6 a3 ?0 N—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
【翻log拿到的创建账号时的SQL语句,原来是REPLACE……】
/ H: M& a$ A' S1 x u. A; G& C% B
161016 14:05:11 2 Query SELECT CdKey,AccountID,AccountPassWord,EnableFlg,UseFlg,BadMsg from tbl_user Where CdKey='1000' or AccountID='1000'
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート+ g" ^& j4 D* p; J, Z8 U% F
161016 14:05:12 3 Query SELECT * from tbl_lock WHERE CdKey='1000'
& b% m3 I) k7 _2 A3 w& h妖城在线论坛
3 Query SELECT TrialFlg,DownFlg from tbl_user WHERE CdKey='1000'
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート( J3 V6 W l+ f: c4 j' C
3 Query SELECT Name,RegistNumber,DataPlaceNumber,FaceImageNumber,Lv, Vital,Str,Tough,Quick,Magic,Attrib_Earth,Attrib_Water,Attrib_Fire,Attrib_Wind,LoginCount,MainJob,RenewalFlg,BaseBaseImageNumber,titleID,guildID from tbl_character WHERE CdKey='1000'
魔力私服,最新魔力宝贝私服技术交流 z5 |! N/ M9 t3 i j* \0 V
161016 14:05:47 3 Query SELECT DataPlaceNumber,Name from tbl_character WHERE CdKey='1000'
bbs.mocwww.com" K. w% l, z! |$ p0 N- X
3 Query SELECT SequenceNumber FROM tbl_user WHERE CdKey='1000'
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート0 p: I* F7 m2 {: t9 i
3 Query UPDATE tbl_user SET SequenceNumber=5 Where CdKey='1000'
9 I4 x: b& u' G, R5 r! i1 k—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート
3 Query REPLACE tbl_character VALUES(1,106352,106352,0,0,0,0,5,1,2147483647,2147483647,0,0,0,1500,1500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,10,0,0,0,0,0,250,0,0,0,0,0,975,0,0,5,1,0,-1,242500,0,0,50,50,50,60,1000,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,10,100,0,0,0,0,0,0,1476641147,0,0,0,0,0,0,0,0,0,0,'12321','','1000',0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1, -1, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0)
. o! f1 s& Y. B/ O! C' z' p7 y% X魔力私服,最新魔力宝贝私服技术交流
3 Query DELETE FROM tbl_skill WHERE CdKey='1000' and RegistNumber=5
- `' h' I2 m2 T: W
3 Query DELETE FROM tbl_addressbook WHERE CdKey='1000' and RegistNumber=5
bbs.mocwww.com V4 U/ Y( i( l. k
3 Query DELETE FROM tbl_item WHERE CdKey='1000' and RegistNumber=5
妖城在线论坛* A- [* L; @9 O6 @
3 Query INSERT INTO tbl_item VALUES (9200,27509,0,22,0,0,1,2,0,1,1,1,0,1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,140000,179200,100,0,0,0,1,0,1000,0,1476641147,-1,0,0,0,0,0,0,'水晶','水晶','','','','','ITEM_DeleteTimeWatched','','','','','','',0,'1000',5,7,-1)
3 V5 ^4 n( p( {8 a9 _6 u魔力私服,最新魔力宝贝私服技术交流
3 Query DELETE FROM tbl_pet WHERE CdKey='1000' and RegistNumber=5
$ i& A9 i" O1 T3 ]; h4 B. ~) Q魔力私服,最新魔力宝贝私服技术交流
3 Query SELECT * from tbl_lock WHERE CdKey='1000'
& h/ p( R0 v+ b
3 Query SELECT TrialFlg,DownFlg from tbl_user WHERE CdKey='1000'
—魔力私服,魔力宝贝私服技术,DELPHI编程,魔力寶貝, 魔力宝贝, 크로스게이트,クロスゲート; E% ^1 F- b+ |! X' e% ~
3 Query SELECT Name,RegistNumber,DataPlaceNumber,FaceImageNumber,Lv, Vital,Str,Tough,Quick,Magic,Attrib_Earth,Attrib_Water,Attrib_Fire,Attrib_Wind,LoginCount,MainJob,RenewalFlg,BaseBaseImageNumber,titleID,guildID from tbl_character WHERE CdKey='1000'
作者:
rolser
时间:
2016-10-17 08:59
防重名 应该是gmsv处理的问题,交给mysql 来做本来就不对,只是这个bug暂时没有人修复,只能通过其他方法了。。。
欢迎光临 妖城在线论坛 (http://bbs.mocwww.com/)
Powered by Discuz! 6.0.0