Added Windows v1.0

This commit is contained in:
BuildTools 2020-07-13 02:44:26 -04:00
commit 5f5d39a273
526 changed files with 320711 additions and 0 deletions

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# Singleplayer-Edition
The official singleplayer version of 2009scape.
# Getting Started: Windows
We do not currently have support for windows in the singleplayer edition, stay tuned, as we will soon!
# Getting Started: Linux
* 1: Download or clone this repository.
* 2: After you unpack the .zip (if you just downloaded it) or it finishes cloning (if you cloned it), open up the folder that it created.
* 3: In this folder there will be a **run-linux.sh**, execute this to start everything up.
* 4: What you need to do *first* before you can run the game is initialize the database. You only have to do this once.
* 5: Once that's finished, you can safely run the game with option 1.

1
_config.yml Normal file
View file

@ -0,0 +1 @@
theme: jekyll-theme-slate

BIN
client.jar Normal file

Binary file not shown.

14
data/ObjectParser.xml Normal file
View file

@ -0,0 +1,14 @@
<parsing>
<ObjectAction mode="add" id="1814" x="3090" y="3475" z="0" type="4" direction="nw"/>
<ObjectAction mode="add" id="2646" x="2445" y="3413" z="0" direction="nw"/>
<ObjectAction mode="add" id="2646" x="2447" y="3414" z="0" direction="e"/>
<ObjectAction mode="add" id="2646" x="2447" y="3421" z="0" direction="nw"/>
<ObjectAction mode="remove" id="37670" x="3292" y="3299" z="0"/>
<ObjectAction mode="add" id="37304" x="3292" y="3299" z="0"/>
<ObjectAction mode="add" id="20987" x="3821" y="2996" z="0"/>
<ObjectAction mode="remove" id="356" x="2804" y="3428" z="0"/>
<ObjectAction mode="add" id="356" x="2804" y="3428" z="0"/>
</parsing>

26
data/RDT.xml Normal file
View file

@ -0,0 +1,26 @@
<RDT>
<item id="995" minAmt="3000" maxAmt="3000" weight="12"/>
<item id="2363" minAmt="1" maxAmt="1" weight="7"/>
<item id="1615" minAmt="1" maxAmt="1" weight="7"/>
<item id="443" minAmt="100" maxAmt="100" weight="7"/>
<item id="561" minAmt="1" maxAmt="67" weight="7"/>
<item id="892" minAmt="1" maxAmt="20" weight="7"/>
<item id="886" minAmt="150" maxAmt="150" weight="7"/>
<item id="1319" minAmt="1" maxAmt="1" weight="7"/>
<item id="1373" minAmt="1" maxAmt="1" weight="7"/>
<item id="1185" minAmt="1" maxAmt="1" weight="7"/>
<item id="1623" minAmt="1" maxAmt="1" weight="12"/>
<item id="1621" minAmt="1" maxAmt="1" weight="12"/>
<item id="1619" minAmt="1" maxAmt="1" weight="12"/>
<item id="1452" minAmt="1" maxAmt="1" weight="7"/>
<item id="1462" minAmt="1" maxAmt="1" weight="7"/>
<item id="1601" minAmt="1" maxAmt="1" weight="7"/>
<item id="830" minAmt="5" maxAmt="5" weight="3"/>
<item id="987" minAmt="1" maxAmt="1" weight="3"/>
<item id="985" minAmt="1" maxAmt="1" weight="3"/>
<item id="1149" minAmt="1" maxAmt="1" weight="3"/>
<item id="1201" minAmt="1" maxAmt="1" weight="3"/>
<item id="1247" minAmt="1" maxAmt="1" weight="1"/>
<item id="2366" minAmt="1" maxAmt="1" weight="1"/>
<item id="1249" minAmt="1" maxAmt="1" weight="1"/>
</RDT>

8446
data/botdata/botnames.txt Normal file

File diff suppressed because it is too large Load diff

4
data/botdata/getnames.sh Normal file
View file

@ -0,0 +1,4 @@
for i in {6000..6500}
do
wget -O- "https://secure.runescape.com/m=hiscore_oldschool/overall.ws?table=0&page=$i" | grep user1= | sed 's/^.*user1=//'| sed 's/".*$//' | grep -v "Binary" >> botnames.txt
done

View file

@ -0,0 +1,334 @@
XMR BTC ETH:7:0:0:0:841:0:0:0:0:0:0:1061:0:
SpinnerYOU:8:0:0:0:1277:0:1171:0:0:0:0:0:0:
im-rahha:58:0:0:0:0:0:0:0:0:0:0:0:0:
newvicn:20:0:0:0:0:0:0:0:0:0:0:0:0:
KnocktdafOut:101:0:0:0:0:0:0:0:0:0:0:0:0:
Powndrake196:3:0:0:0:0:0:0:0:0:0:0:0:0:
muppemxx:3:1038:0:0:0:0:0:0:0:0:0:0:0:
GGraft:32:1949:4335:1725:1329:546:20166:0:548:0:2922:1061:0:
OdymX:3:0:0:0:1293:1101:1175:0:1067:0:1063:0:0:
jesusj17:48:0:4391:0:843:0:0:0:0:0:2932:1061:0:
Raningblast3:3:0:0:0:1351:0:0:0:0:0:0:0:0:
65fatknife:3:0:0:0:0:0:0:0:0:0:0:0:0:
NeobilkDark:23:0:0:0:1203:0:1173:0:0:0:0:0:0:
TROXZ144POXZ:56:1161:0:1009:1301:1123:1197:0:1073:0:0:0:0:
xXMakiaXx:80:0:0:0:1381:0:0:0:1033:0:0:0:0:
Molebats1209:3:0:0:0:0:0:0:0:0:0:0:0:0:
64 Wise 1978:3:0:0:0:0:0:0:0:0:0:0:0:0:
Clue Mimic:3:0:3781:0:0:0:0:0:0:0:2922:2914:0:
claymus14:30:1157:0:0:1329:1115:1193:0:1069:0:0:0:0:
xAlexGGotYaX:10:1949:0:0:1277:0:1171:0:0:0:0:0:0:
Morerule1367:3:0:0:0:0:0:0:0:0:0:0:0:0:
77shiny1198:3:0:0:0:0:0:0:0:0:0:0:0:0:
YaelColins:40:0:0:552:9703:0:9704:0:0:0:0:0:0:
casacoima10:12:0:0:0:1277:0:1171:0:0:0:0:0:0:
MenMaster:20:0:0:0:1205:0:0:0:0:0:0:0:0:
M0L1NTR0N3:44:1949:0:1725:1357:1005:9704:0:1095:0:0:1061:0:
fdsfwrfW2E:40:0:0:0:1277:0:1171:0:0:0:0:0:0:
Lewt Bags:58:1155:4351:21149:1387:1117:1189:0:1075:0:1065:4119:0:
bierfietsss:72:1163:1019:1731:1333:1127:1201:0:1079:0:1059:9005:0:
TaDeDeBeShPa:3:0:0:0:0:0:0:0:0:0:0:0:0:
Soonride2043:3:0:0:0:0:0:0:0:0:0:0:0:0:
KolSinRa6944:3:0:0:0:0:0:0:0:0:0:0:0:0:
BoCaRefVaCyI:3:0:0:0:0:0:0:0:0:0:0:0:0:
Gerloc55:43:0:0:0:1387:0:13660:0:0:0:0:9006:0:
ChMaIvCrJanL:3:0:0:0:0:0:0:0:0:0:0:0:0:
Happier Dog:44:7136:20214:10366:1387:1844:0:0:1845:0:11858:1846:0:
emachorrr:3:0:0:0:1277:0:0:0:0:0:0:0:0:
MIDNIGHTHOUR:63:1042:0:1710:10156:6322:4156:0:1099:0:11120:0:0:
LilOmni:6:0:0:0:0:0:0:0:0:0:0:1061:0:
wef6qwe4r561:3:0:0:0:0:0:0:0:0:0:0:0:0:
Sister 13:3:12600:9793:0:20590:6186:24325:0:13288:0:0:23285:0:
IsidraJr:58:0:0:0:0:0:0:0:0:0:0:0:0:
BeDeMaSa0891:3:0:0:0:0:0:0:0:0:0:0:0:0:
JustSkillezZ:50:1017:0:0:1387:426:0:0:428:0:0:0:0:
Elcangri11:39:1017:1007:1727:1381:1035:1199:0:1033:0:1059:1061:0:
haroldas 99r:13:1017:1019:1731:843:0:0:0:1015:0:1059:1061:0:
Day Dreamer2:47:1145:0:1727:1355:1123:7352:0:1091:0:0:0:0:
venepower:67:1017:0:1731:1381:577:0:0:1033:0:1059:0:0:
GOOL19207:59:1163:0:0:1333:1123:1201:0:1079:0:0:0:0:
T A L 3 N T:67:10452:12197:6585:11785:544:12610:0:2497:0:11133:12598:0:
xz Team:30:579:4371:0:1387:577:0:0:1033:0:21816:626:0:
lWontEverDie:96:0:0:0:853:7370:0:0:1099:0:0:0:0:
WooJ:122:2986:9808:1704:3053:13106:0:0:0:0:11140:13131:0:
Zaliukas19:7:1153:1031:1478:1323:1115:1175:0:1067:0:0:0:0:
Marian Nasir:3:0:0:0:0:0:0:0:0:0:0:0:0:
laitukas29:3:0:0:0:0:0:0:0:0:0:0:0:0:
AFRODITA-23:38:0:0:0:0:0:0:0:0:0:0:0:0:
Monrojas:50:0:1029:1725:1381:0:0:0:1099:0:1065:1061:0:
stejler:114:21266:6570:19553:4151:21301:12954:0:21304:0:7462:11840:0:
Loamjytuner:3:0:0:0:0:0:0:0:0:0:0:0:0:
u smoke mid:92:12293:10499:10364:1387:1121:1197:0:1071:0:1065:11840:0:
MIMIYEEET:64:0:10499:0:861:0:0:0:0:0:0:0:0:
hamnndoza:3:1153:0:0:11709:1115:1191:0:1067:0:1063:1061:0:
4virgin:112:0:0:0:1275:0:0:0:0:0:0:0:0:
LSASORI-666:60:579:0:1731:1387:577:0:0:1011:0:0:1061:0:
12evil2175:4:0:0:0:0:0:0:0:0:0:0:0:0:
Rushkaril208:71:1153:0:1478:1331:1119:1191:0:1067:0:7595:0:0:
sneksk13:49:0:0:0:0:0:0:0:0:0:0:0:0:
M i m e s:53:0:0:0:1387:3058:0:0:3059:0:0:3061:0:
llego crispy:54:9925:0:22692:853:1123:0:0:1073:0:9922:24313:0:
dami420:71:3486:20214:1731:12389:3481:3488:0:3483:0:23261:1061:0:
Vjx:59:12455:1019:10366:1387:12451:13660:0:12447:0:2912:1061:0:
jonko_08:39:1161:0:1731:1387:1123:1197:0:1073:0:1063:1061:0:
Oliverg1995:36:6188:4351:0:837:6654:0:0:0:0:2922:0:0:
TErko SKs:20:1017:0:0:1383:0:1173:0:0:0:0:0:0:
e t h x n:67:0:0:0:1387:6654:0:0:6181:0:7595:9005:0:
Beretsand522:85:5554:0:1710:21646:5553:0:0:5555:0:5556:5557:0:
ApS Squirrel:55:1163:4325:1731:1333:1113:1201:0:1079:0:2942:1061:0:
Acazandra:60:579:4407:1727:1387:577:0:0:1011:0:24311:1061:0:
BybisTasei:112:1169:1027:1731:1387:1135:24325:0:1099:0:1065:1061:0:
WelshPro2:47:1053:0:1725:1333:544:0:0:542:0:0:1061:0:
ElwinLeong:46:1044:0:1654:851:7364:0:0:1099:0:1065:7596:0:
Squaawk:99:0:6568:0:0:0:0:0:0:0:11126:0:0:
Bread1991:4:1155:0:0:1293:1117:1171:0:1075:0:0:0:0:
Tzaska:112:1949:9781:0:6562:11854:22322:0:11856:0:11858:11860:0:
honkah0nka:120:0:0:0:1359:0:0:0:0:0:0:0:0:
VitsEco:64:7394:23300:1731:1387:7390:13660:0:7378:0:1065:23291:0:
Emer Jhon 19:62:0:0:0:1381:1035:0:0:1033:0:0:0:0:
Roberthx:55:1163:0:1725:1333:1113:1201:0:1079:0:0:0:0:
Nikitakitz:33:12283:4371:1478:1285:12277:12281:0:12285:0:11079:3061:0:
DNoancy76:3:0:0:0:0:0:0:0:0:0:0:0:0:
black chinin:34:0:0:0:0:0:0:0:0:0:0:0:0:
NO0MEERCYY:106:0:0:0:0:0:0:0:0:0:0:0:0:
Kekava:89:11862:1019:7803:1327:1125:1195:0:1077:0:0:3061:0:
Finis34:76:24305:23410:10364:1387:24307:24325:0:24309:0:24311:24313:0:
SSSniperWolf:53:23101:23099:0:11709:23369:2589:0:23095:0:23091:23093:0:
HazeyJ:49:0:0:21314:11707:0:0:0:0:0:0:4121:0:
dontbrkrules:45:0:0:0:1387:0:0:0:0:0:0:0:0:
s46gs4g6s5dg:3:0:0:0:0:0:0:0:0:0:0:0:0:
PuRe_ReVs97:39:1169:0:1704:8880:1129:0:0:1099:0:2487:0:0:
DrakenHamer:108:0:0:0:1381:1035:0:0:1033:0:0:0:0:
VoHoTi816863:3:0:0:0:0:0:0:0:0:0:0:0:0:
H 2 P:63:1053:13679:21314:1387:22695:24325:0:13288:0:0:13286:0:
Leviathan Sr:3:0:1007:0:13328:6654:0:0:6655:0:0:0:0:
Chuka Ryori:102:0:0:0:1387:0:0:0:0:0:0:0:0:
5g4sg4sg4sg:3:0:0:0:0:0:0:0:0:0:0:0:0:
Elroyfct19:8:1949:0:0:0:0:1173:0:0:0:0:0:0:
PureEffectQ:37:1161:1019:1725:1331:1123:1540:0:1073:0:1059:1061:0:
rowcharger2:58:2613:0:0:1387:2607:2611:0:3475:0:1065:0:0:
Redrani1:33:1038:0:0:0:0:0:0:0:0:0:0:0:
ottn ook eem:76:12639:9757:0:4934:13104:0:0:6185:0:0:6666:0:
UzairScape:52:0:0:0:1387:0:0:0:0:0:0:0:0:
Ultiwarriors:65:1169:4379:1731:853:1135:0:0:1099:0:1065:9006:0:
kilaSTR:21:579:4345:1725:1329:577:0:0:1081:0:0:1061:0:
homeboijones:22:0:0:0:0:0:0:0:0:0:0:0:0:
Jcc1992:9:1157:0:0:1353:1119:1193:0:1069:0:2922:0:0:
Rsk venom:69:24288:0:12002:12000:24291:6889:0:24294:0:6922:6920:0:
Paptor986:68:1949:1027:1731:1333:1113:0:0:1079:0:2902:1061:0:
BigDuncan69:42:1161:1031:1478:1333:1123:1199:0:1073:0:2922:9006:0:
Gril:34:579:0:1727:1381:581:0:0:542:0:0:0:0:
54 27:69:1163:4351:1725:1385:1113:1201:0:1079:0:1065:1061:0:
treghar:3:0:0:0:0:0:0:0:0:0:0:0:0:
TreeWise Ben:59:1017:0:1727:1387:546:0:0:548:0:0:0:0:
ladiabla6666:59:0:0:0:0:0:0:0:0:0:0:0:0:
Joekeltje05:42:1055:4399:1727:1381:1035:0:0:1033:0:0:1061:0:
Cykelpump94:68:0:0:0:1381:1035:0:0:1033:0:0:0:0:
ToP WinG:61:0:0:11113:9185:0:0:0:0:0:0:0:0:
Smigol89:75:12504:10499:1704:9185:2503:1540:0:2497:0:2491:6328:0:
6d54fd4d5:3:0:0:0:0:0:0:0:0:0:0:0:0:
JaDeLashKriT:3:0:0:0:0:0:0:0:0:0:0:0:0:
Devskii:64:1169:9783:1731:853:1129:0:0:1099:0:1065:1061:0:
AliArcher22:107:1163:4371:1725:1333:1127:1201:0:1079:0:1065:1061:0:
Y0URN0TREADY:21:11847:0:10364:667:23097:13660:0:9923:0:23091:9921:0:
Kepler16b:15:1153:0:552:1267:1115:1191:0:6181:0:1059:0:0:
JamitusDeath:63:1163:1019:0:1333:1127:1201:0:1079:0:2902:1061:0:
blib vbob:3:0:0:0:0:0:0:0:0:0:0:0:0:
FighterMan3D:3:0:0:0:1265:0:1173:0:0:0:0:0:0:
dustyturnip:54:1163:0:1478:1333:2599:1201:0:1079:0:0:9006:0:
Cucilo:63:0:0:0:0:0:0:0:0:0:0:0:0:
BrrrrCold:53:2657:1007:1731:1333:2653:2659:0:3478:0:2912:9006:0:
Nv-BlackMind:88:24315:24207:0:1271:24317:0:0:24319:0:24321:24323:0:
kjuse:71:1038:0:1731:0:9924:0:0:9923:0:9922:1837:0:
Archie b:73:12453:6568:10364:1381:7390:2621:0:7386:0:2912:11840:0:
lamarcelazaz:112:0:0:0:0:0:0:0:0:0:0:0:0:
Soni Evil:3:0:0:0:1351:0:0:0:0:0:0:0:0:
Ubertas:91:0:4323:1727:1387:0:0:0:0:0:0:3061:0:
bholehairz:24:579:4365:1727:1381:577:0:0:1011:0:2932:1061:0:
I P0p ZanZ:41:579:0:1727:1387:0:0:0:0:0:0:0:0:
mr 7ranks:94:0:0:0:0:0:0:0:0:0:0:0:0:
weedmam44:89:0:0:0:0:0:0:0:0:0:0:0:0:
Bort Goth:54:1042:4387:1478:23330:23215:7348:0:2617:0:1059:9005:0:
godkin94:43:12231:4407:1662:1387:12225:12233:0:12227:0:2922:1061:0:
zznjujkuiy:3:0:0:0:0:0:0:0:0:0:0:0:0:
Snakenaldo:30:1155:0:1731:1359:1117:1173:0:1075:0:1059:1061:0:
Osmar-Rvn:75:12455:23297:10364:1387:12451:24325:0:12447:0:0:9921:0:
J U Q:3:11850:11852:1708:10010:11854:0:0:11856:0:10075:11860:0:
batrinhos:45:6182:4349:1478:1387:6654:0:0:7380:0:1065:9005:0:
d5fd45fdfd43:3:0:0:0:0:0:0:0:0:0:0:0:0:
mhxomklo:64:12013:0:0:1275:12014:0:0:12015:0:21345:12016:0:
Jaxaloth:42:1153:0:10364:1331:1115:1191:0:1081:0:0:0:0:
DuctileMarro:5:0:0:552:1277:0:1171:0:0:0:0:0:0:
FirmGrandma:124:22326:6570:19553:22978:22327:22322:0:22328:0:22981:7159:0:
Andr3ws:51:0:0:0:0:0:0:0:0:0:2902:7596:0:
Motel IlIIlI:54:0:0:0:0:0:0:0:0:0:0:0:0:
Its yeboii:98:12434:19697:19720:1387:19958:3842:0:19964:0:4105:23285:0:
TheOverdraft:118:0:0:0:0:0:0:0:0:0:0:0:0:
jbl092191:85:2665:4357:0:0:2661:2667:0:2663:0:6720:6328:0:
NewSummerVI:79:12600:23300:10366:23279:20199:13660:0:2593:0:23091:12891:0:
hambargaman:80:1040:0:0:1387:9924:0:0:9923:0:0:9921:0:
Ivyone42:35:0:13679:0:0:0:13660:0:0:0:0:0:0:
grumpy troll:116:0:0:0:0:0:0:0:0:0:0:0:0:
xRektify:93:0:0:11107:6739:0:0:0:0:0:0:0:0:
bramboom:5:0:4407:0:1351:0:0:0:0:0:0:0:0:
wrap a joint:94:2627:9795:1725:1333:1113:0:0:1079:0:2491:11840:0:
leegon1:85:0:0:0:0:0:0:0:0:0:0:0:0:
koekeroekoe1:94:21298:6568:11128:0:21301:12954:0:21304:0:11122:11840:0:
maryamgee123:10:1153:1019:0:1381:0:1191:0:0:0:0:0:0:
zazuke2019:53:22689:13679:22692:853:22695:0:0:1099:0:0:22701:0:
Mrmeanbow:97:1163:23297:1725:1333:1127:1201:0:1079:0:0:0:0:
MagicBunny01:47:1949:0:0:0:1757:0:0:0:0:0:0:0:
el frinchy:49:0:0:0:0:0:0:0:0:0:0:0:0:
Ninja1901:50:6188:13679:0:1387:0:0:0:0:0:0:0:0:
Dilk Mud:81:12241:6570:1725:1333:12235:1191:0:1067:0:0:0:0:
zELGLw:5:0:0:0:1277:0:1171:0:0:0:0:0:0:
DeMeLo139067:3:0:0:0:0:0:0:0:0:0:0:0:0:
Sun Rocks:49:2613:0:0:1381:1035:1201:0:1033:0:0:0:0:
Black Arkan:42:2605:0:0:1331:2599:2603:0:12279:0:1063:1061:0:
xxrreexxrex:3:0:4365:0:0:0:0:0:0:0:0:0:0:
Kingdavid370:16:0:0:0:1349:0:0:0:0:0:0:0:0:
OTEguQ:5:0:0:0:1205:0:1171:0:0:0:0:1061:0:
OnlYMrSmItH:3:12845:0:22692:1419:6184:0:0:6185:0:13287:13286:0:
DinkelBrot:14:1048:13679:0:0:20184:13660:0:20187:0:3060:1837:0:
Voidsux:98:0:0:0:1359:544:0:0:542:0:0:0:0:
worchafts:3:0:0:1654:0:0:0:0:0:0:0:0:0:
1k sand crab:79:1038:23297:0:10010:1035:12335:0:1033:0:0:11840:0:
Gopherslane:101:0:0:0:0:0:0:0:0:0:0:0:0:
Firehit2:28:1165:1019:0:1329:1125:1195:0:0:0:0:1061:0:
BeanSw3de:71:2595:4335:0:1387:2591:2597:0:2593:0:24311:3061:0:
rarebreed28:42:579:0:0:1387:577:0:0:1033:0:0:0:0:
Mullac255:50:0:1019:1731:1381:6184:1540:0:6185:0:1059:1061:0:
680m:110:0:0:0:0:0:0:0:0:0:0:0:0:
Niffou:7:1153:0:0:1323:1115:1191:0:1067:0:0:0:0:
AlessandlawD:4:0:0:0:0:0:0:0:0:0:0:0:0:
chandelaaaa:52:0:0:0:1275:0:0:0:0:0:1580:0:0:
kevkeassel:8:1153:1007:1478:1323:1115:1191:0:1067:0:1059:1061:0:
RockMauler:57:0:0:0:0:0:0:0:0:0:0:0:0:
Apothus14:43:0:0:0:1387:0:0:0:0:0:0:0:0:
lilibthx3:3:0:0:0:0:0:0:0:0:0:0:0:0:
Choc Luvr:48:1949:0:0:1333:0:0:0:13288:0:1059:1061:0:
ALXNDR B:60:0:0:0:0:0:0:0:0:0:0:0:0:
crisalida1:29:0:0:0:1351:0:0:0:0:0:0:0:0:
doynana:25:1157:0:1718:2402:1129:1177:0:1095:0:1063:1061:0:
homer_1993:64:1163:4365:1731:853:1113:0:0:1099:0:1065:1061:0:
Kos Emak lol:80:1163:4367:1725:853:1135:0:0:1079:0:1065:24313:0:
chinowaggon:42:1153:0:1725:853:1101:0:0:1099:0:1065:0:0:
Raised Wood:40:1159:0:0:1333:1121:1197:0:1071:0:0:0:0:
PalavaMaa:3:21859:13679:22692:22684:0:13660:0:0:0:13287:13286:0:
adroit4559:3:0:0:0:0:0:0:0:0:0:0:0:0:
SensaiKush:85:10828:6568:6585:0:0:0:0:0:0:0:11840:0:
Neba Brat:70:0:0:0:0:0:0:0:0:0:0:0:0:
Zartharias:55:1165:0:0:1333:1125:1195:0:1077:0:0:0:0:
lioooooooooo:38:0:0:0:0:0:0:0:0:0:0:0:0:
Julle2900:54:0:0:0:0:0:0:0:0:0:0:0:0:
ItsSpectrum:92:0:0:0:0:0:0:0:0:0:0:0:0:
Pinkjoe_369:68:6182:0:0:1275:6180:0:0:6181:0:0:0:0:
iD3CAP1TATE:86:1050:0:1731:0:0:0:0:0:0:1065:23285:0:
0wnbyme0:80:2665:4355:0:1387:2661:2667:0:2663:0:1065:9005:0:
whodis1:11:1153:4351:1725:1325:1115:1191:0:1067:0:0:1061:0:
V-Caracas:75:0:0:0:1211:0:0:0:0:0:0:0:0:
Jackawoo:24:1153:1019:1009:1323:1101:1191:0:1081:0:1059:0:0:
yorwys:76:0:0:0:1357:0:0:0:2617:0:0:0:0:
ashwoog:8:0:0:0:0:0:0:0:0:0:0:0:0:
Belly111:57:1169:0:1725:1373:1129:0:0:1099:0:1065:1061:0:
rolexeshh:54:0:0:0:1381:0:0:0:0:0:0:0:0:
Flamingasz:39:1040:23297:1660:1273:0:0:0:0:0:0:0:0:
TooFreeBoy:38:1159:0:1725:1329:1121:1197:0:1071:0:7595:1061:0:
el capibara:64:0:1019:0:0:0:0:0:0:0:0:0:0:
maName1999:43:1169:0:1725:853:1115:0:0:1099:0:1065:0:0:
noobmager69:13:579:4397:1727:1381:577:0:0:1011:0:1063:1061:0:
Greg lad:53:1153:4315:1725:1373:1115:1191:0:1081:0:0:1061:0:
420 McWaffle:42:1169:4339:0:853:1129:0:0:1099:0:1065:0:0:
SwappingSpit:56:1053:4351:1725:853:1101:0:0:1099:0:1065:1061:0:
og Swervinn:74:0:0:0:0:0:0:0:0:0:0:0:0:
yurmari:41:0:0:0:1351:0:13660:0:0:0:0:0:0:
mrintensely8:120:0:0:0:0:0:0:0:0:0:0:0:0:
65s4gs6g:3:0:0:0:0:0:0:0:0:0:0:0:0:
Yippi kaye:32:5533:0:0:0:0:13660:0:0:0:0:0:0:
E D U A R DO:58:5533:0:552:1381:23404:0:0:1099:0:0:0:0:
RichBichLily:57:0:0:1710:20590:0:0:0:0:0:0:0:0:
ee PILLERI:94:0:0:0:0:0:0:0:0:0:0:0:0:
el tor001:84:0:0:1712:1381:0:0:0:0:0:0:0:0:
Ill have tht:49:6188:4325:1725:20155:1129:0:0:1099:0:1065:1061:0:
Li-Fan Wei:61:2665:1023:1731:853:2661:0:0:3479:0:1065:0:0:
CrsipDaddy69:62:1163:0:1731:1333:1127:1201:0:1079:0:1065:0:0:
50 Crow 2195:4:0:0:0:1351:0:0:0:0:0:0:0:0:
Nonce No:42:24315:13679:1725:853:24317:0:0:1099:0:1065:24323:0:
c6z0urhtkxou:3:0:0:0:0:0:0:0:0:0:0:0:0:
capulina 12:71:0:0:0:1359:0:0:0:0:0:0:0:0:
atti zuen:27:579:1019:1727:1387:577:0:0:0:0:0:0:0:
Wildmake:25:1153:1019:1725:1331:1101:1191:0:1067:0:0:1061:0:
iGod Butcher:69:2627:1027:1731:1333:1127:2629:0:2625:0:0:22701:0:
imma warlock:25:1153:0:0:1381:1115:1191:0:1067:0:1063:1061:0:
Kingviking11:50:1169:1021:1725:853:1115:0:0:1099:0:1065:1061:0:
Hookhda1995:51:1153:4365:1725:1333:1115:0:0:1067:0:0:1061:0:
OptusWIFI:27:0:4409:1727:1381:1035:0:0:1033:0:0:1061:0:
No Chance G:58:0:0:1725:853:1101:0:0:1099:0:1065:1061:0:
19F10V7XUA3L:3:0:0:0:0:0:0:0:0:0:0:0:0:
Karamjanda23:50:1169:4393:1731:853:1109:0:0:1099:0:1065:1061:0:
Duskthrow39:34:1017:4405:1478:853:1035:0:0:1099:0:0:1061:0:
skitzatics:36:0:0:1725:1331:0:0:0:1099:0:1065:0:0:
Vi Vinner:59:1153:1027:1725:853:1115:0:0:1099:0:1065:1061:0:
666 sauce:56:0:3789:10364:1333:0:0:0:0:0:1065:6666:0:
Purple Sclm:54:1169:24207:1725:853:1101:0:0:1099:0:1065:1061:0:
69leo:55:1163:1027:1478:1303:23392:1201:0:1079:0:0:0:0:
125i:77:1163:4345:1725:1333:1127:1201:0:1079:0:1065:1061:0:
Shady_4720:29:1017:4345:1727:1381:544:0:0:542:0:0:1061:0:
gotitondeck:30:1169:1019:1725:853:1129:0:0:1097:0:2912:1061:0:
Crispy chips:78:1163:1027:1731:853:1113:0:0:1099:0:1065:24313:0:
PlzRisk More:45:12518:4389:1725:853:1101:0:0:7378:0:1065:1837:0:
P K Bash Man:56:1169:0:1725:853:1129:0:0:1099:0:1065:1061:0:
Kieran2809:18:0:0:0:1355:0:0:0:0:0:0:1061:0:
Yes I m New:79:2665:1019:1731:1333:2661:2667:0:2663:0:1065:9006:0:
HMAY4QQ37YGB:3:0:0:0:0:0:0:0:0:0:0:0:0:
Soul Dig 934:50:1153:0:0:1323:1115:1191:0:1067:0:1059:1061:0:
Mr Medicated:63:1157:1027:1725:853:1119:0:0:1099:0:1065:1061:0:
Troll2k:4:1153:0:0:1277:1129:1171:0:0:0:0:1061:0:
Protect Hope:62:2665:1027:10364:853:2669:0:0:2655:0:2489:11840:0:
ITS ME KDP:14:0:0:1731:0:0:0:0:0:0:1063:1061:0:
anastasiaemp:28:1153:0:0:1277:1103:1173:0:1087:0:0:0:0:
Aka Flying:45:5527:4367:1725:853:0:0:0:0:0:1065:6666:0:
llSlayerlI:47:1169:4385:1725:853:1129:0:0:1099:0:1065:1061:0:
jO9hurley:61:1163:1021:1725:1333:1113:1201:0:1079:0:2912:1061:0:
lilaf:43:1169:0:1725:1319:1129:0:0:1099:0:1065:0:0:
Logamconner:3:0:0:0:0:0:0:0:0:0:0:0:0:
dunnbros1:64:1169:4383:1725:853:1129:0:0:1099:0:1065:1061:0:
345458472110:101:1169:4407:1725:853:1133:0:0:1099:0:1065:1061:0:
Blonkalex23:61:1163:0:1725:1333:1127:1201:0:1079:0:0:1061:0:
0hide0cry:67:0:0:1731:853:1129:0:0:1097:0:1063:0:0:
Magemac99:27:579:4365:0:1387:577:1177:0:1011:0:0:0:0:
Alcap0ny:54:1153:0:0:0:1105:0:0:1067:0:2932:1061:0:
WISDJGJJ5CK4:3:0:0:0:0:0:0:0:0:0:0:0:0:
Confiteor:81:0:0:0:853:0:0:0:0:0:0:0:0:
x Obey the:68:579:0:1727:1333:577:0:0:542:0:0:0:0:
sicriona:103:1163:1023:1725:1333:1127:1201:0:1079:0:2922:1061:0:
Deleo Hostem:74:2619:9753:1731:23334:2661:2659:0:2663:0:1065:2914:0:
K E N N O:89:10294:0:1731:1333:7372:0:0:1093:0:1065:1061:0:
T3CHe:47:579:0:1731:1333:577:0:0:1099:0:1063:0:0:
Kaiju_X:72:1169:0:1731:853:544:0:0:1099:0:1065:0:0:
Junior_steez:68:0:0:1725:1333:544:0:0:542:0:2912:1061:0:
BllI1C:52:1169:0:1725:853:1129:0:0:1099:0:1065:1061:0:
Husky Fellow:53:6335:20217:1725:853:1129:0:0:7380:0:1065:23288:0:
w33d pk u:73:1169:4373:1725:853:1135:0:0:1099:0:1065:1061:0:
Gl Im Ninat:55:1169:4333:1725:853:0:0:0:1099:0:1065:1061:0:
12iownu:56:579:0:1725:1333:577:0:0:1099:0:1065:0:0:
TernoWildust:87:0:0:1731:1381:577:0:0:542:0:1065:0:0:
xongbax:57:1169:4347:1725:853:1129:0:0:1099:0:1065:1061:0:
G0DS Of Edge:76:2673:1027:1731:1333:2669:2675:0:2671:0:1065:1061:0:
Slashz:46:1169:4351:0:853:1129:0:0:1099:0:1065:0:0:
MicKy242:66:579:1021:0:1333:1121:1197:0:1085:0:1059:1061:0:
God trust:70:0:0:1725:1333:544:0:0:1099:0:1065:0:0:
Nodak Josh:69:12283:13679:1731:853:7362:0:0:7378:0:1065:1061:0:
ryuga attak:66:1163:0:1725:1333:1113:1201:0:1079:0:0:1061:0:
OldeEnglish:74:1163:0:1731:1333:1127:0:0:1079:0:0:0:0:
Vettige Sam:28:6656:0:1654:0:6654:0:0:6655:0:2902:0:0:
sitdown:61:1169:0:1704:868:1129:0:0:2497:0:2491:1837:0:
Zamppaliin:57:0:0:0:0:0:0:0:0:0:0:0:0:
kuchar23:94:1163:1019:1725:853:1135:0:0:1079:0:1065:1061:0:
Tyuio594:69:0:0:0:0:0:0:0:0:0:0:0:0:
oZeZo:90:0:0:0:1359:0:0:0:0:0:0:0:0:
Mrmagicmatt:50:1153:4377:1725:1333:1115:0:0:1067:0:1059:1061:0:
iism0ke:51:1169:4325:1725:853:1129:0:0:1099:0:1065:626:0:
Dzestiz:3:5533:0:21314:20779:0:24325:0:3059:0:3060:3061:0:
Justiniksass:3:0:0:0:0:0:0:0:0:0:0:0:0:
rag 1:66:2619:23410:1731:853:2661:0:0:2663:0:1065:23285:0:

View file

@ -0,0 +1,78 @@
/*
This script is run with OSBot. Created by Red Bracket.
namesandarmor.txt has the following format:
name:cblevel:helmet:cape:neck:weapon:chest:shield:unknown:legs:unknown:gloves:boots:
*/
import org.osbot.rs07.api.def.ItemDefinition;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.io.*;
import java.util.ArrayList;
@ScriptManifest(name = "Fetch data10", author = "b4", version = 2, logo = "", info = "info")
public class Reader extends Script {
private ArrayList<String> names = new ArrayList<>();
@Override
public int onLoop() {
Player p = getPlayers().closest(o -> !names.contains(o.getName()));
if (p != null)
{
names.add(p.getName());
String equipment = getOthersEquipment(p);
//Format:
//name:cblevel:helmet:cape:neck:weapon:chest:shield:unknown:legs:unknown:gloves:boots:
log2(p.getName()
+ ":" + p.getCombatLevel()
+ ":" + equipment);
}
return 50;
}
private void log2(String msg)
{
try {
log(msg);
FileReader fr = new FileReader(getDirectoryData() + "Data.txt");
BufferedReader br = new BufferedReader(fr);
for (String line; (line = br.readLine()) != null; ) {
if (line.split(":")[0].equals(msg.split(":")[0]))
{
log("Not adding that one, since we already have it");
return;
}
}
FileWriter fw = new FileWriter(getDirectoryData() + "Data.txt", true);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter out = new PrintWriter(bw);
out.println(msg);
out.close();
} catch (Exception e) {
log(e);
}
}
private String getOthersEquipment(Player p) {
String equipmentList = "";
if(p != null) {
int[] equipment = p.getDefinition().getAppearance();
for (int value : equipment) {
if (value - 512 > 0)
equipmentList += ItemDefinition.forId(value - 512).getId() + ":";
else
equipmentList += 0 + ":";
}
}
return equipmentList;
}
}

View file

@ -0,0 +1,11 @@
#Format:
#name:cblevel:helmet:cape:neck:weapon:chest:shield:unknown:legs:unknown:gloves:boots:
sicriona:103:1163:1023:1725:1333:1127:1201:0:1079:0:2922:1061:0:
czar:110:1149:6568:1704:4587:10564:6524:0:4585:0:1059:1061:
loving puppy:95:11665:6568:1704:4587:8839:14767:0:8840:0:8842:1061:
rattle63:83:14096:10499:1704:4151:14094:14767:0:14095:0:8842:1061:
baluga:110:10828:6568:10354:4151:3140:6524:0:4087:0:8842:11732:
crabcake:115:10828:10446:10354:4151:10564:6524:0:4087:0:8842:11732:
Red:94:1163:6568:10354:7158:10564:0:0:4087:0:1059:11732:
puglet:120:10828:6568:6585:11696:4757:0:0:8840:0:1059:3105:
linux:10000:10828:10069:1725:4151:3140:14767:0:4087:0:1059:3105:

BIN
data/cache/main_file_cache.dat2 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx0 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx1 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx10 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx11 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx12 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx13 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx14 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx15 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx16 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx17 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx18 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx19 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx2 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx20 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx21 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx22 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx23 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx24 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx25 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx255 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx26 vendored Normal file

Binary file not shown.

1
data/cache/main_file_cache.idx27 vendored Normal file
View file

@ -0,0 +1 @@
<EFBFBD>

BIN
data/cache/main_file_cache.idx28 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx3 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx4 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx5 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx6 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx7 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx8 vendored Normal file

Binary file not shown.

BIN
data/cache/main_file_cache.idx9 vendored Normal file

Binary file not shown.

1
data/eco/ge_resource.emp Normal file
View file

@ -0,0 +1 @@
<EFBFBD><EFBFBD>

102434
data/eco/gedb.xml Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

16
data/eco/itemstostock.xml Normal file
View file

@ -0,0 +1,16 @@
<stocklist>
<player>2009scape</player>
<AutoStock itemId="453" amount="1000" modifier="2"/> <!--coal-->
<AutoStock itemId="227" amount="10000" modifier="2"/> <!--vial-->
<AutoStock itemId="229" amount="10000" modifier="2"/> <!--vial of water-->
<AutoStock itemId="379" amount="10000" modifier="2"/> <!--Cooked Lobster-->
<AutoStock itemId="592" amount="1000" modifier="2"/> <!--Ashes-->
<AutoStock itemId="2970" amount="1000" modifier="2"/> <!--Mort Myre Fungi-->
<AutoStock itemId="6018" amount="1000" modifier="2"/> <!--Poison Ivy Berries-->
<AutoStock itemId="3138" amount="1000" modifier="2"/> <!--Potato cactus-->
<AutoStock itemId="237" amount="1000" modifier="2"/> <!--Unicorn Horn-->
<AutoStock itemId="223" amount="1000" modifier="2"/> <!--Red Spider's Eggs-->
<AutoStock itemId="6693" amount="1000" modifier="2"/> <!--Bird nest-->
<AutoStock itemId="1975" amount="1000" modifier="2"/> <!--Chocolate Dust-->
<AutoStock itemId="225" amount="1000" modifier="2"/> <!--Limpwurt Root-->
</stocklist>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<database>
<offer>
<uid>1</uid>
<itemId>453</itemId>
<sale>false</sale>
<amount>1</amount>
<completedAmount>0</completedAmount>
<offeredValue>90</offeredValue>
<timeStamp>1594270540275</timeStamp>
<offerState>6</offerState>
<totalCoinExchange>0</totalCoinExchange>
<playerUID>3556498</playerUID>
</offer>
<offsetUID>2</offsetUID>
</database>

Binary file not shown.

467
data/global.sql Normal file
View file

@ -0,0 +1,467 @@
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 06, 2019 at 01:33 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `global`
--
-- --------------------------------------------------------
--
-- Table structure for table `dev_log`
--
CREATE TABLE `dev_log` (
`id` int(11) UNSIGNED NOT NULL,
`username` varchar(15) DEFAULT NULL,
`content` longtext NOT NULL,
`date` timestamp NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `highscores`
--
CREATE TABLE `highscores` (
`id` int(11) UNSIGNED NOT NULL,
`username` varchar(20) DEFAULT NULL,
`overall_xp` int(11) NOT NULL DEFAULT 0,
`total_level` int(11) NOT NULL DEFAULT 0,
`ironManMode` varchar(15) NOT NULL DEFAULT 'NONE',
`xp_0` int(11) NOT NULL DEFAULT 0,
`xp_1` int(11) NOT NULL DEFAULT 0,
`xp_2` int(11) NOT NULL DEFAULT 0,
`xp_3` int(11) NOT NULL DEFAULT 0,
`xp_4` int(11) NOT NULL DEFAULT 0,
`xp_5` int(11) NOT NULL DEFAULT 0,
`xp_6` int(11) NOT NULL DEFAULT 0,
`xp_7` int(11) NOT NULL DEFAULT 0,
`xp_8` int(11) NOT NULL DEFAULT 0,
`xp_9` int(11) NOT NULL DEFAULT 0,
`xp_10` int(11) NOT NULL DEFAULT 0,
`xp_11` int(11) NOT NULL DEFAULT 0,
`xp_12` int(11) NOT NULL DEFAULT 0,
`xp_13` int(11) NOT NULL DEFAULT 0,
`xp_14` int(11) NOT NULL DEFAULT 0,
`xp_15` int(11) NOT NULL DEFAULT 0,
`xp_16` int(11) NOT NULL DEFAULT 0,
`xp_17` int(11) NOT NULL DEFAULT 0,
`xp_18` int(11) NOT NULL DEFAULT 0,
`xp_19` int(11) NOT NULL DEFAULT 0,
`xp_20` int(11) NOT NULL DEFAULT 0,
`xp_21` int(11) NOT NULL DEFAULT 0,
`xp_22` int(11) NOT NULL DEFAULT 0,
`xp_23` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `members`
--
CREATE TABLE `members` (
`UID` int(11) UNSIGNED NOT NULL,
`email` varchar(50) NOT NULL DEFAULT '',
`username` varchar(15) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`salt` varchar(35) DEFAULT NULL,
`rights` int(1) NOT NULL DEFAULT 0,
`email_activated` int(1) NOT NULL DEFAULT 0,
`lastActive` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`donatorType` int(2) NOT NULL DEFAULT -1,
`donationTotal` double(10,2) NOT NULL DEFAULT 0.00,
`credits` int(5) NOT NULL DEFAULT 0,
`icon` int(2) NOT NULL DEFAULT 0,
`perks` varchar(500) NOT NULL DEFAULT '',
`ip` longtext DEFAULT NULL,
`mac` longtext DEFAULT NULL,
`serial` longtext DEFAULT NULL,
`computerName` varchar(2000) NOT NULL DEFAULT '',
`monthlyVotes` int(11) NOT NULL DEFAULT 0,
`netWorth` bigint(200) NOT NULL DEFAULT 0,
`forumUID` int(11) NOT NULL DEFAULT -1,
`ironManMode` varchar(15) NOT NULL DEFAULT 'NONE',
`bank` longtext DEFAULT NULL,
`inventory` longtext DEFAULT NULL,
`equipment` longtext DEFAULT NULL,
`ge` longtext DEFAULT NULL,
`muteTime` bigint(20) NOT NULL DEFAULT -1,
`banTime` bigint(20) NOT NULL DEFAULT -1,
`profileImage` varchar(300) DEFAULT NULL,
`contacts` longtext DEFAULT NULL,
`blocked` longtext DEFAULT NULL,
`clanName` varchar(15) NOT NULL DEFAULT '',
`currentClan` varchar(15) DEFAULT NULL,
`clanReqs` varchar(10) NOT NULL DEFAULT '1,0,8,9',
`disconnectTime` bigint(20) NOT NULL DEFAULT 0,
`lastWorld` int(3) NOT NULL DEFAULT -1,
`chatSettings` varchar(10) NOT NULL DEFAULT '0,0,0',
`timePlayed` bigint(20) DEFAULT 0,
`lastLogin` bigint(20) NOT NULL DEFAULT 0,
`lastGameIp` varchar(15) DEFAULT '',
`countryCode` int(11) NOT NULL DEFAULT 0,
`birthday` date DEFAULT NULL,
`online` tinyint(1) NOT NULL DEFAULT 0,
`signature` longtext DEFAULT NULL,
`joined_date` timestamp NULL DEFAULT NULL,
`posts` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `members`
--
INSERT INTO `members` (`UID`, `email`, `username`, `password`, `salt`, `rights`, `email_activated`, `lastActive`, `donatorType`, `donationTotal`, `credits`, `icon`, `perks`, `ip`, `mac`, `serial`, `computerName`, `monthlyVotes`, `netWorth`, `forumUID`, `ironManMode`, `bank`, `inventory`, `equipment`, `ge`, `muteTime`, `banTime`, `profileImage`, `contacts`, `blocked`, `clanName`, `currentClan`, `clanReqs`, `disconnectTime`, `lastWorld`, `chatSettings`, `timePlayed`, `lastLogin`, `lastGameIp`, `countryCode`, `birthday`, `online`, `signature`, `joined_date`, `posts`) VALUES
(0, '', '2009Scape', '$2a$12$P0OU2A5S.lEYdkTq5kq3/u1UlfVkMYIS7WWbxsjjeyfxqTDbygpEe', '$2a$12$P0OU2A5S.lEYdkTq5kq3/u', 2, 0, '2019-11-06 00:29:03', 0, 0.00, 0, 0, '', '127.0.0.1', NULL, NULL, 'SERVER', 0, 0, -1, 'STANDARD', NULL, NULL, NULL, NULL, -1, -1, '', '', '', '2009Scape', '2009Scape', '0,0,8,9', 1572999889084, 1, '0,0,0', NULL, 1572999890885, '127.0.0.1', 0, NULL, 0, NULL, NULL, 0);
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE `messages` (
`id` int(11) UNSIGNED NOT NULL,
`sender` varchar(15) NOT NULL DEFAULT '',
`recipient` varchar(15) NOT NULL DEFAULT '',
`subject` varchar(40) NOT NULL DEFAULT '',
`content` longtext NOT NULL,
`date` timestamp NOT NULL DEFAULT current_timestamp(),
`is_read` tinyint(1) NOT NULL,
`s_delete` tinyint(11) NOT NULL,
`r_delete` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `perks`
--
CREATE TABLE `perks` (
`product_id` int(10) UNSIGNED NOT NULL,
`name` varchar(100) NOT NULL DEFAULT 'No Name',
`description` varchar(500) DEFAULT NULL,
`price` int(10) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `perks`
--
INSERT INTO `perks` (`product_id`, `name`, `description`, `price`) VALUES
(2, 'Stamina Boost', 'Increase your stamina and run regeneration by a total of 40%.', 60),
(4, 'Green Thumb', 'With a 35% lifetime increase in your crops growing up healthy, they will be saved and you will also receive a better crop yield!', 100),
(5, 'Bird Man', 'Increase your rate of receiving a bird nest drop by 35%!', 50),
(6, 'Stoner', 'Increase your rate of receiving a gem stone drop by 35%!', 50),
(11, 'Unbreakable Forge', 'Ring of forging never breaks.', 30),
(12, 'Out of Grave Danger', 'Your gravestone will last up to twice as long with this perk.', 50),
(13, 'Sleight of Hand', 'With sleight of hand you will increase your success rates in all aspects of thieving. This includes pickpocketing and cracking wall safes for gems.', 50),
(14, 'Master Chef', 'As a soon to be Master Chef, you will receive a 20% increase in successfully cooking your food!', 50),
(16, 'Divine Intervention', 'The gods above intervene with your burying of bones. You have a 10% chance while burying a bone to keep it instead.', 70),
(17, 'Familiar Whisperer', 'Get to know your familiar better by increasing their lifespan by 50%.', 70),
(18, 'Barrows Befriender', 'Befriend the barrows brothers & never experience the wretched degrading of their armour again', 300),
(19, 'Abyss Befriender', 'Use the power of the abyss to make your Runecrafting pouches undegradable.', 150),
(21, 'Charge Befriender', 'The God\'s of the Hero\'s guild have blessed you with the power to use your jewerly free of charge.', 250),
(22, 'Golden Needle', 'Gain an extra 10% experience whilst spinning something on a spinning wheel, including flax. Creating an item made out of dragonhide rewards an extra 5% experience. Your crafting needle also never breaks and thread is consumed less often.\n', 50),
(24, 'Slayer Betrayer', 'Obtain the ability through the Slayer Masters to change your slayer task at will. Type ::cleartask to use.', 100),
(26, 'Thirst Quencher', 'The gods have blessed you with the knowledge of the deserts to gain the skills required to tap into an unlimited water supply.', 30),
(27, 'Double Trouble', 'Experience a chance of receiving double the resources through skills such as, mining, woodcutting, fishing, and many more.', 250),
(29, 'Godwars Befriender', 'Now blessed by the gods you have the ability to enter the chambers with a killcount of 30. You will also be granted half the time it takes to recharge at an altar.', 100),
(30, 'Prayer Betrayer', 'Experience half the prayer drain rate when this perk is enabled.', 150),
(31, 'Spell Swap', 'The ability to swap spell books without any charge of runes. Cannot be used in combat or in the wilderness.', 80),
(32, 'Dwarf Befriender', 'Befriended by the dwarfs you now have the ability to use double the cannon balls and experience no decay on your cannon.', 150),
(33, 'Powerpoint', 'This perk grants you double the points in all minigames.', 300),
(35, 'Charm Collector', 'Through the power of summoning you will automatically pick up any charms dropped in battle.', 100),
(36, 'Detective', 'You now have a solid 10% chance of a clue scroll drop from any monster that drops clues as well as a 50% better chance of <strong>super rare</strong> rewards such as 3rd age. You\'ll also experience a 50% increased chance to obtain more loot.', 250),
(40, 'Overcharge', 'The power from the overcharge lords is given to you. Your Dragonfire Shield will recharge fully every 10 minutes. The time between casts is also reduced by 50%.', 170),
(41, 'Unbreakable Crystal', 'This perk allows for your crystal bow to never degrade.', 350),
(42, 'Crusader', 'With this perk you will have a 25% chance to double loot the barrows chest.', 100),
(43, 'Pet Befriender', 'This perk gives you the ability to double your chances on getting boss/skilling pets!', 100),
(60, 'Bone Crusher', 'Automatically crushes your bones as they\'re dropped for prayer experience. Toggle this perk using ::bonecrusher', 100),
(70, 'Runestone Knowledge', 'You are given extended knowledge of the runecrafting skill and can now craft double death, law, cosmic, blood and nature runes.', 200),
(71, 'Coin machine', 'Automatically bank all coins dropped from NPC\'s and gives you 25% extra gold. Toggle this perk using ::coinmachine', 150),
(72, 'Fight Cave Fanatic', 'Eliminates the first 25 waves from the tzhaar fight caves.', 50),
(73, 'Decanter', 'Zahur will decant your noted potions if you have this perk.', 50);
-- --------------------------------------------------------
--
-- Table structure for table `player_logs`
--
CREATE TABLE `player_logs` (
`username` varchar(22) NOT NULL DEFAULT '',
`public_chat` longtext DEFAULT NULL,
`private_chat` longtext DEFAULT NULL,
`clan_chat` longtext DEFAULT NULL,
`address_log` longtext DEFAULT NULL,
`command_log` longtext DEFAULT NULL,
`trade_log` longtext DEFAULT NULL,
`ge_log` longtext DEFAULT NULL,
`duplication_log` longtext DEFAULT NULL,
`duel_log` longtext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `punishments`
--
CREATE TABLE `punishments` (
`address` varchar(100) NOT NULL DEFAULT '',
`type` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `security`
--
CREATE TABLE `security` (
`id` int(11) UNSIGNED NOT NULL,
`ip` longtext NOT NULL,
`type` int(11) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `sys_logs`
--
CREATE TABLE `sys_logs` (
`id` int(11) UNSIGNED NOT NULL,
`message` longtext NOT NULL,
`log_type` int(2) DEFAULT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`IP_ADDRESS` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `validations`
--
CREATE TABLE `validations` (
`id` int(11) UNSIGNED NOT NULL,
`username` varchar(20) DEFAULT NULL,
`code` varchar(30) DEFAULT NULL,
`type` int(2) NOT NULL DEFAULT 0,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`value` longtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `votes`
--
CREATE TABLE `votes` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL DEFAULT '',
`site` varchar(50) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `voting_sites`
--
CREATE TABLE `voting_sites` (
`name` varchar(20) NOT NULL DEFAULT 'Null',
`wait` int(5) NOT NULL DEFAULT 12,
`credits` int(2) NOT NULL DEFAULT 1,
`link` varchar(500) NOT NULL DEFAULT 'http://ariosrsps.com',
`get_command` varchar(20) NOT NULL DEFAULT '',
`host_name` varchar(500) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `worlds`
--
CREATE TABLE `worlds` (
`world` int(2) UNSIGNED NOT NULL,
`ip` varchar(20) NOT NULL DEFAULT '127.0.0.1',
`players` int(5) NOT NULL DEFAULT 0,
`country` int(1) NOT NULL DEFAULT 0,
`member` int(11) NOT NULL,
`revision` int(3) NOT NULL DEFAULT 530,
`lastResponse` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `worlds`
--
INSERT INTO `worlds` (`world`, `ip`, `players`, `country`, `member`, `revision`, `lastResponse`) VALUES
(1, '127.0.0.1', 0, 22, 1, 530, '2019-11-06 00:24:54');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `dev_log`
--
ALTER TABLE `dev_log`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `highscores`
--
ALTER TABLE `highscores`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `members`
--
ALTER TABLE `members`
ADD PRIMARY KEY (`UID`);
--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `perks`
--
ALTER TABLE `perks`
ADD PRIMARY KEY (`product_id`);
--
-- Indexes for table `player_logs`
--
ALTER TABLE `player_logs`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `security`
--
ALTER TABLE `security`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sys_logs`
--
ALTER TABLE `sys_logs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `validations`
--
ALTER TABLE `validations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `votes`
--
ALTER TABLE `votes`
ADD KEY `id` (`id`);
--
-- Indexes for table `voting_sites`
--
ALTER TABLE `voting_sites`
ADD PRIMARY KEY (`name`);
--
-- Indexes for table `worlds`
--
ALTER TABLE `worlds`
ADD PRIMARY KEY (`world`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `dev_log`
--
ALTER TABLE `dev_log`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `highscores`
--
ALTER TABLE `highscores`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `members`
--
ALTER TABLE `members`
MODIFY `UID` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `perks`
--
ALTER TABLE `perks`
MODIFY `product_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;
--
-- AUTO_INCREMENT for table `security`
--
ALTER TABLE `security`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sys_logs`
--
ALTER TABLE `sys_logs`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `validations`
--
ALTER TABLE `validations`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `votes`
--
ALTER TABLE `votes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
<EFBFBD>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/libs/libncurses.so.5 Normal file

Binary file not shown.

BIN
data/libs/libtinfo.so.5 Normal file

Binary file not shown.

View file

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<attributes/>

BIN
data/players/test.save Normal file

Binary file not shown.

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rewards>
<Reward amount="500" itemId="995" weight="100"/>
</rewards>

24014
data/server.sql Normal file

File diff suppressed because one or more lines are too long

339
database/COPYING Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

136
database/EXCEPTIONS-CLIENT Normal file
View file

@ -0,0 +1,136 @@
FOSS License Exception
http://www.mysql.com/about/legal/licensing/foss-exception/
Updated February 23, 2012
What is the FOSS License Exception?
Oracle's Free and Open Source Software ("FOSS") License Exception
(formerly known as the FLOSS License Exception) allows developers of FOSS
applications to include Oracle's MySQL Client Libraries (also referred to
as "MySQL Drivers" or "MySQL Connectors") with their FOSS applications.
MySQL Client Libraries are typically licensed pursuant to version 2 of the
General Public License ("GPL"), but this exception permits distribution of
certain MySQL Client Libraries with a developer's FOSS applications
licensed under the terms of another FOSS license listed below, even though
such other FOSS license may be incompatible with the GPL.
The following terms and conditions describe the circumstances under which
Oracle's FOSS License Exception applies.
Oracle's FOSS License Exception Terms and Conditions
1. Definitions. "Derivative Work" means a derivative work, as defined
under applicable copyright law, formed entirely from the Program and
one or more FOSS Applications.
"FOSS Application" means a free and open source software application
distributed subject to a license listed in the section below titled
"FOSS License List."
"FOSS Notice" means a notice placed by Oracle or MySQL in a copy of
the MySQL Client Libraries stating that such copy of the MySQL Client
Libraries may be distributed under Oracle's or MySQL's FOSS (or FLOSS)
License Exception.
"Independent Work" means portions of the Derivative Work that are not
derived from the Program and can reasonably be considered independent
and separate works.
"Program" means a copy of Oracle's MySQL Client Libraries that
contains a FOSS Notice.
2. A FOSS application developer ("you" or "your") may distribute a
Derivative Work provided that you and the Derivative Work meet all of
the following conditions:
a. You obey the GPL in all respects for the Program and all portions
(including modifications) of the Program included in the
Derivative Work (provided that this condition does not apply to
Independent Works);
b. The Derivative Work does not include any work licensed under the
GPL other than the Program;
c. You distribute Independent Works subject to a license listed in
the section below titled "FOSS License List";
d. You distribute Independent Works in object code or executable
form with the complete corresponding machine-readable source code
on the same medium and under the same FOSS license applying to
the object code or executable forms;
e. All works that are aggregated with the Program or the Derivative
Work on a medium or volume of storage are not derivative works of
the Program, Derivative Work or FOSS Application, and must
reasonably be considered independent and separate works.
3. Oracle reserves all rights not expressly granted in these terms and
conditions. If all of the above conditions are not met, then this FOSS
License Exception does not apply to you or your Derivative Work.
FOSS License List
+------------------------------------------------------------------------+
|License Name |Version(s)/Copyright Date|
|----------------------------------------------+-------------------------|
|Academic Free License |2.0 |
|----------------------------------------------+-------------------------|
|Apache Software License |1.0/1.1/2.0 |
|----------------------------------------------+-------------------------|
|Apple Public Source License |2.0 |
|----------------------------------------------+-------------------------|
|Artistic license |From Perl 5.8.0 |
|----------------------------------------------+-------------------------|
|BSD license |"July 22 1999" |
|----------------------------------------------+-------------------------|
|Common Development and Distribution License |1.0 |
|(CDDL) | |
|----------------------------------------------+-------------------------|
|Common Public License |1.0 |
|----------------------------------------------+-------------------------|
|Eclipse Public License |1.0 |
|----------------------------------------------+-------------------------|
|European Union Public License (EUPL)¹ |1.1 |
|----------------------------------------------+-------------------------|
|GNU Affero General Public License (AGPL) |3.0 |
|----------------------------------------------+-------------------------|
|GNU Library or "Lesser" General Public License|2.0/2.1/3.0 |
|(LGPL) | |
|----------------------------------------------+-------------------------|
|GNU General Public License (GPL) |3.0 |
|----------------------------------------------+-------------------------|
|IBM Public License |1.0 |
|----------------------------------------------+-------------------------|
|Jabber Open Source License |1.0 |
|----------------------------------------------+-------------------------|
|MIT License (As listed in file |- |
|MIT-License.txt) | |
|----------------------------------------------+-------------------------|
|Mozilla Public License (MPL) |1.0/1.1 |
|----------------------------------------------+-------------------------|
|Open Software License |2.0 |
|----------------------------------------------+-------------------------|
|OpenSSL license (with original SSLeay license)|"2003" ("1998") |
|----------------------------------------------+-------------------------|
|PHP License |3.0/3.01 |
|----------------------------------------------+-------------------------|
|Python license (CNRI Python License) |- |
|----------------------------------------------+-------------------------|
|Python Software Foundation License |2.1.1 |
|----------------------------------------------+-------------------------|
|Sleepycat License |"1999" |
|----------------------------------------------+-------------------------|
|University of Illinois/NCSA Open Source |- |
|License | |
|----------------------------------------------+-------------------------|
|W3C License |"2001" |
|----------------------------------------------+-------------------------|
|X11 License |"2001" |
|----------------------------------------------+-------------------------|
|Zlib/libpng License |- |
|----------------------------------------------+-------------------------|
|Zope Public License |2.0 |
+------------------------------------------------------------------------+
¹) When an Independent Work is licensed under a "Compatible License"
pursuant to the EUPL, the Compatible License rather than the EUPL is the
applicable license for purposes of these FOSS License Exception Terms and
Conditions.

2194
database/README Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,284 @@
#!/usr/bin/perl
# -*- cperl -*-
#
# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
##############################################################################
#
# This script reports various configuration settings that may be needed
# when using the MySQL client library.
#
# This script try to match the shell script version as close as possible,
# but in addition being compatible with ActiveState Perl on Windows.
#
# All unrecognized arguments to this script are passed to mysqld.
#
# NOTE: This script will only be used on Windows until solved how to
# handle and other strings inserted that might contain
# several arguments, possibly with spaces in them.
#
# NOTE: This script was deliberately written to be as close to the shell
# script as possible, to make the maintenance of both in parallel
# easier.
#
##############################################################################
use File::Basename;
use Getopt::Long;
use Cwd;
use strict;
my @exclude_cflags =
qw/DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
DEXTRA_DEBUG DHAVE_valgrind O O[0-9] xO[0-9] W[-A-Za-z]*
Xa xstrconst xc99=none
unroll2 ip mp restrict/;
my @exclude_libs = qw/lmtmalloc static-libcxa i-static static-intel/;
my $cwd = cwd();
my $basedir;
my $socket = '/tmp/mysql.sock';
my $version = '5.5.68';
sub which
{
my $file = shift;
my $IFS = $^O eq "MSWin32" ? ";" : ":";
foreach my $dir ( split($IFS, $ENV{PATH}) )
{
if ( -f "$dir/$file" or -f "$dir/$file.exe" )
{
return "$dir/$file";
}
}
print STDERR "which: no $file in ($ENV{PATH})\n";
exit 1;
}
# ----------------------------------------------------------------------
# If we can find the given directory relatively to where mysql_config is
# we should use this instead of the incompiled one.
# This is to ensure that this script also works with the binary MySQL
# version
# ----------------------------------------------------------------------
sub fix_path
{
my $default = shift;
my @dirs = @_;
foreach my $dirname ( @dirs )
{
my $path = "$basedir/$dirname";
if ( -d $path )
{
return $path;
}
}
return $default;
}
sub get_full_path
{
my $file = shift;
# if the file is a symlink, try to resolve it
if ( $^O ne "MSWin32" and -l $file )
{
$file = readlink($file);
}
if ( $file =~ m,^/, )
{
# Do nothing, absolute path
}
elsif ( $file =~ m,/, )
{
# Make absolute, and remove "/./" in path
$file = "$cwd/$file";
$file =~ s,/\./,/,g;
}
else
{
# Find in PATH
$file = which($file);
}
return $file;
}
##############################################################################
#
# Form a command line that can handle spaces in paths and arguments
#
##############################################################################
sub quote_options {
my @cmd;
foreach my $opt ( @_ )
{
next unless $opt; # If undefined or empty, just skip
push(@cmd, "\"$opt\""); # Quote argument
}
return join(" ", @cmd);
}
##############################################################################
#
# Main program
#
##############################################################################
my $me = get_full_path($0);
$basedir = dirname(dirname($me)); # Remove "/bin/mysql_config" part
my $ldata = 'C:/MariaDB5.5/data';
my $execdir = 'C:/Program Files (x86)/MySQL/bin';
my $bindir = 'C:/Program Files (x86)/MySQL/bin';
# ----------------------------------------------------------------------
# If installed, search for the compiled in directory first (might be "lib64")
# ----------------------------------------------------------------------
my $pkglibdir = fix_path('C:/Program Files (x86)/MySQL/lib',"libmysql/relwithdebinfo",
"libmysql/release","libmysql/debug","lib/mysql","lib");
my $pkgincludedir = fix_path('C:/Program Files (x86)/MySQL/include/mysql', "include/mysql", "include");
# Assume no argument with space in it
my @ldflags = split(" ",'');
my $port;
if ( '0' == 0 ) {
$port = 0;
} else {
$port = '3306';
}
# ----------------------------------------------------------------------
# Create options
# We intentionally add a space to the beginning and end of lib strings, simplifies replace later
# ----------------------------------------------------------------------
my (@lib_opts,@lib_r_opts,@lib_e_opts);
if ( $^O eq "MSWin32" )
{
my $linkpath = "$pkglibdir";
# user32 is only needed for debug or embedded
my @winlibs = ("wsock32.lib","advapi32.lib","user32.lib");
@lib_opts = ("$linkpath/mysqlclient.lib",@winlibs);
@lib_r_opts = @lib_opts;
@lib_e_opts = ("$linkpath/mysqlserver.lib",@winlibs);
}
else
{
my $linkpath = "-L$pkglibdir ";
@lib_opts = ($linkpath,"-lmysqlclient");
@lib_r_opts = ($linkpath,"-lmysqlclient_r");
@lib_e_opts = ($linkpath,"-lmysqld");
}
my $flags;
$flags->{libs} =
[@ldflags,@lib_opts,'','IPHLPAPI ','',''];
$flags->{libs_r} =
[@ldflags,@lib_r_opts,'','',''];
$flags->{embedded_libs} =
[@ldflags,@lib_e_opts,'','','','',''];
$flags->{include} = ["-I$pkgincludedir"];
$flags->{cflags} = [@{$flags->{include}},split(" ",'')];
# ----------------------------------------------------------------------
# Remove some options that a client doesn't have to care about
# FIXME until we have a --cxxflags, we need to remove -Xa
# and -xstrconst to make --cflags usable for Sun Forte C++
# ----------------------------------------------------------------------
my $filter = join("|", @exclude_cflags);
my @tmp = @{$flags->{cflags}}; # Copy the flag list
$flags->{cflags} = []; # Clear it
foreach my $cflag ( @tmp )
{
push(@{$flags->{cflags}}, $cflag) unless $cflag =~ m/^($filter)$/o;
}
# Same for --libs(_r)
$filter = join("|", @exclude_libs);
foreach my $lib_type ( "libs","libs_r","embedded_libs" )
{
my @tmp = @{$flags->{$lib_type}}; # Copy the flag list
$flags->{$lib_type} = []; # Clear it
foreach my $lib ( @tmp )
{
push(@{$flags->{$lib_type}}, $lib) unless $lib =~ m/^($filter)$/o;
}
}
my $include = quote_options(@{$flags->{include}});
my $cflags = quote_options(@{$flags->{cflags}});
my $libs = quote_options(@{$flags->{libs}});
my $libs_r = quote_options(@{$flags->{libs_r}});
my $embedded_libs = quote_options(@{$flags->{embedded_libs}});
##############################################################################
#
# Usage information, output if no option is given
#
##############################################################################
sub usage
{
print <<EOF;
Usage: $0 [OPTIONS]
Options:
--cflags [$cflags]
--include [$include]
--libs [$libs]
--libs_r [$libs_r]
--socket [$socket]
--port [$port]
--version [$version]
--libmysqld-libs [$embedded_libs]
EOF
exit 0;
}
@ARGV or usage();
##############################################################################
#
# Get options and output the values
#
##############################################################################
GetOptions(
"cflags" => sub { print "$cflags\n" },
"include" => sub { print "$include\n" },
"libs" => sub { print "$libs\n" },
"libs_r" => sub { print "$libs_r\n" },
"socket" => sub { print "$socket\n" },
"port" => sub { print "$port\n" },
"version" => sub { print "$version\n" },
"embedded-libs|embedded|libmysqld-libs" =>
sub { print "$embedded_libs\n" },
) or usage();
exit 0

View file

@ -0,0 +1,167 @@
#!/usr/bin/perl
# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
# Convert given tables in a database to MYISAM
use DBI;
use Getopt::Long;
$opt_help=$opt_version=$opt_verbose=$opt_force=0;
$opt_user=$opt_database=$opt_password=undef;
$opt_host="localhost";
$opt_socket="";
$opt_engine="MYISAM";
$opt_port=0;
$exit_status=0;
GetOptions(
"e|engine|type=s" => \$opt_engine,
"f|force" => \$opt_force,
"help|?" => \$opt_help,
"h|host=s" => \$opt_host,
"p|password=s" => \$opt_password,
"u|user=s" => \$opt_user,
"v|verbose" => \$opt_verbose,
"V|version" => \$opt_version,
"S|socket=s" => \$opt_socket,
"P|port=i" => \$opt_port
) || usage(0);
usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
$opt_database=shift(@ARGV);
if (grep { /^$opt_engine$/i } qw(HEAP MEMORY BLACKHOLE))
{
print "Converting to '$opt_engine' would delete your data; aborting\n";
exit(1);
}
$connect_opt="";
if ($opt_port)
{
$connect_opt.= ";port=$opt_port";
}
if (length($opt_socket))
{
$connect_opt.=";mysql_socket=$opt_socket";
}
$dbh = DBI->connect("DBI:mysql:$opt_database:${opt_host}$connect_opt",
$opt_user,
$opt_password,
{ PrintError => 0})
|| die "Can't connect to database $opt_database: $DBI::errstr\n";
my @tables;
push(@ARGV, "%") if(!@ARGV);
foreach $pattern (@ARGV)
{
my ($sth,$row);
$sth=$dbh->prepare("SHOW TABLES LIKE ?");
$rv= $sth->execute($pattern);
if(!int($rv))
{
warn "Can't get tables matching '$pattern' from $opt_database; $DBI::errstr\n";
exit(1) unless $opt_force;
}
while (($row = $sth->fetchrow_arrayref))
{
push(@tables, $row->[0]);
}
$sth->finish;
}
print "Converting tables:\n" if ($opt_verbose);
foreach $table (@tables)
{
my ($sth,$row);
# Check if table is already converted
$sth=$dbh->prepare("show table status like '$table'");
if ($sth->execute && ($row = $sth->fetchrow_arrayref))
{
if (uc($row->[1]) eq uc($opt_engine))
{
print "$table already uses the '$opt_engine' engine; Ignored\n";
next;
}
}
print "converting $table\n" if ($opt_verbose);
$table=~ s/`/``/g;
if (!$dbh->do("ALTER TABLE `$table` ENGINE=$opt_engine"))
{
print STDERR "Can't convert $table: Error $DBI::errstr\n";
exit(1) if (!$opt_force);
$exit_status=1;
}
}
$dbh->disconnect;
exit($exit_status);
sub usage
{
my($version)=shift;
print "$0 version 1.1\n";
exit(0) if ($version);
print <<EOF;
Conversion of a MySQL tables to other storage engines
Usage: $0 database [table[ table ...]]
If no tables has been specifed, all tables in the database will be converted.
You can also use wildcards, ie "my%"
The following options are available:
-f, --force
Continue even if there is some error.
-?, --help
Shows this help
-e, --engine=ENGINE
Converts tables to the given storage engine (Default: $opt_engine)
-h, --host=HOST
Host name where the database server is located. (Default: $opt_host)
-p, --password=PASSWORD
Password for the current user.
-P, --port=PORT
TCP/IP port to connect to if host is not "localhost".
-S, --socket=SOCKET
Socket to connect with.
-u, --user=USER
User name to log into the SQL server.
-v, --verbose
This is a test specific option that is only used when debugging a test.
Print more information about what is going on.
-V, --version
Shows the version of this program.
EOF
exit(1);
}

View file

@ -0,0 +1,390 @@
#!/usr/bin/perl
# -*- cperl -*-
#
# Copyright (c) 2007, 2017, Oracle and/or its affiliates.
#
# 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; version 2 of the License.
#
# 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
use Fcntl;
use File::Spec;
use if $^O eq 'MSWin32', 'Term::ReadKey' => qw/ReadMode/;
use strict;
my $config = ".my.cnf.$$";
my $command = ".mysql.$$";
my $hadpass = 0;
my $mysql; # How to call the mysql client
my $rootpass = "";
$SIG{QUIT} = $SIG{INT} = $SIG{TERM} = $SIG{ABRT} = $SIG{HUP} = sub {
print "\nAborting!\n\n";
echo_on();
cleanup();
exit 1;
};
END {
# Remove temporary files, even if exiting via die(), etc.
cleanup();
}
sub read_without_echo {
my ($prompt) = @_;
print $prompt;
echo_off();
my $answer = <STDIN>;
echo_on();
print "\n";
chomp($answer);
return $answer;
}
sub echo_on {
if ($^O eq 'MSWin32') {
ReadMode('normal');
} else {
system("stty echo");
}
}
sub echo_off {
if ($^O eq 'MSWin32') {
ReadMode('noecho');
} else {
system("stty -echo");
}
}
sub write_file {
my $file = shift;
-f $file or die "ERROR: file is missing \"$file\": $!";
open(FILE, ">$file") or die "ERROR: can't write to file \"$file\": $!";
foreach my $line ( @_ ) {
print FILE $line, "\n"; # Add EOL char
}
close FILE;
}
sub prepare {
# Locate the mysql client; look in current directory first, then
# in path
our $SAVEERR; # Suppress Perl warning message
open SAVEERR, ">& STDERR";
close STDERR;
for my $m (File::Spec->catfile('bin', 'mysql'), 'mysql') {
# mysql --version should always work
qx($m --no-defaults --version);
next unless $? == 0;
$mysql = $m;
last;
}
open STDERR, ">& SAVEERR";
die "Can't find a 'mysql' client in PATH or ./bin\n"
unless $mysql;
# Create safe files to avoid leaking info to other users
foreach my $file ( $config, $command ) {
next if -f $file; # Already exists
local *FILE;
sysopen(FILE, $file, O_CREAT, 0600)
or die "ERROR: can't create $file: $!";
close FILE;
}
}
# Simple escape mechanism (\-escape any ' and \), suitable for two contexts:
# - single-quoted SQL strings
# - single-quoted option values on the right hand side of = in my.cnf
#
# These two contexts don't handle escapes identically. SQL strings allow
# quoting any character (\C => C, for any C), but my.cnf parsing allows
# quoting only \, ' or ". For example, password='a\b' quotes a 3-character
# string in my.cnf, but a 2-character string in SQL.
#
# This simple escape works correctly in both places.
sub basic_single_escape {
my ($str) = @_;
# Inside a character class, \ is not special; this escapes both \ and '
$str =~ s/([\'])/\\$1/g;
return $str;
}
sub do_query {
my $query = shift;
write_file($command, $query);
my $rv = system("$mysql --defaults-file=$config < $command");
# system() returns -1 if exec fails (e.g., command not found, etc.); die
# in this case because nothing is going to work
die "Failed to execute mysql client '$mysql'\n" if $rv == -1;
# Return true if query executed OK, or false if there was some problem
# (for example, SQL error or wrong password)
return ($rv == 0 ? 1 : undef);
}
sub make_config {
my $password = shift;
my $esc_pass = basic_single_escape($rootpass);
write_file($config,
"# mysql_secure_installation config file",
"[mysql]",
"user=root",
"password='$esc_pass'");
}
sub get_root_password {
my $attempts = 3;
for (;;) {
my $password = read_without_echo("Enter current password for root (enter for none): ");
if ( $password ) {
$hadpass = 1;
} else {
$hadpass = 0;
}
$rootpass = $password;
make_config($rootpass);
last if do_query("");
die "Unable to connect to the server as root user, giving up.\n"
if --$attempts == 0;
}
print "OK, successfully used password, moving on...\n\n";
}
sub set_root_password {
my $password1;
for (;;) {
$password1 = read_without_echo("New password: ");
if ( !$password1 ) {
print "Sorry, you can't use an empty password here.\n\n";
next;
}
my $password2 = read_without_echo("Re-enter new password: ");
if ( $password1 ne $password2 ) {
print "Sorry, passwords do not match.\n\n";
next;
}
last;
}
my $esc_pass = basic_single_escape($password1);
do_query("UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root';")
or die "Password update failed!\n";
print "Password updated successfully!\n";
print "Reloading privilege tables..\n";
reload_privilege_tables()
or die "Can not continue.\n";
print "\n";
$rootpass = $password1;
make_config($rootpass);
}
sub remove_anonymous_users {
do_query("DELETE FROM mysql.user WHERE User='';")
or die print " ... Failed!\n";
print " ... Success!\n";
}
sub remove_remote_root {
if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');")) {
print " ... Success!\n";
} else {
print " ... Failed!\n";
}
}
sub remove_test_database {
print " - Dropping test database...\n";
if (do_query("DROP DATABASE IF EXISTS test;")) {
print " ... Success!\n";
} else {
print " ... Failed! Not critical, keep moving...\n";
}
print " - Removing privileges on test database...\n";
if (do_query("DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'")) {
print " ... Success!\n";
} else {
print " ... Failed! Not critical, keep moving...\n";
}
}
sub reload_privilege_tables {
if (do_query("FLUSH PRIVILEGES;")) {
print " ... Success!\n";
return 1;
} else {
print " ... Failed!\n";
return undef;
}
}
sub cleanup {
print "Cleaning up...\n";
foreach my $file ($config, $command) {
unlink $file or warn "Warning: Could not unlink $file: $!\n";
}
}
# The actual script starts here
prepare();
print <<HERE;
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
HERE
get_root_password();
#
# Set the root password
#
print "Setting the root password ensures that nobody can log into the MySQL\n";
print "root user without the proper authorisation.\n\n";
if ( $hadpass == 0 ) {
print "Set root password? [Y/n] ";
} else {
print "You already have a root password set, so you can safely answer 'n'.\n\n";
print "Change the root password? [Y/n] ";
}
my $reply = <STDIN>;
if ( $reply =~ /n/i ) {
print " ... skipping.\n";
} else {
set_root_password();
}
print "\n";
#
# Remove anonymous users
#
print <<HERE;
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
HERE
print "Remove anonymous users? [Y/n] ";
$reply = <STDIN>;
if ( $reply =~ /n/i ) {
print " ... skipping.\n";
} else {
remove_anonymous_users();
}
print "\n";
#
# Disallow remote root login
#
print <<HERE;
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
HERE
print "Disallow root login remotely? [Y/n] ";
$reply = <STDIN>;
if ( $reply =~ /n/i ) {
print " ... skipping.\n";
} else {
remove_remote_root();
}
print "\n";
#
# Remove test database
#
print <<HERE;
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
HERE
print "Remove test database and access to it? [Y/n] ";
$reply = <STDIN>;
if ( $reply =~ /n/i ) {
print " ... skipping.\n";
} else {
remove_test_database();
}
print "\n";
#
# Reload privilege tables
#
print <<HERE;
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
HERE
print "Reload privilege tables now? [Y/n] ";
$reply = <STDIN>;
if ( $reply =~ /n/i ) {
print " ... skipping.\n";
} else {
reload_privilege_tables();
}
print "\n";
print <<HERE;
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
HERE

View file

@ -0,0 +1,837 @@
#!/usr/bin/perl
# Copyright (c) 2000, 2017, Oracle and/or its affiliates.
# Copyright (c) 2010, 2017, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# 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 Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1335 USA
use Getopt::Long;
use POSIX qw(strftime getcwd);
$|=1;
$VER="2.16";
my @defaults_options; # Leading --no-defaults, --defaults-file, etc.
$opt_example = 0;
$opt_help = 0;
$opt_log = undef();
$opt_mysqladmin = "C:/Program Files (x86)/MySQL/bin/mysqladmin";
$opt_mysqld = "./bin/mysqld";
$opt_no_log = 0;
$opt_password = undef();
$opt_tcp_ip = 0;
$opt_user = "root";
$opt_version = 0;
$opt_silent = 0;
$opt_verbose = 0;
my $my_print_defaults_exists= 1;
my $logdir= undef();
my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname);
$homedir = $ENV{HOME};
$my_progname = $0;
$my_progname =~ s/.*[\/]//;
if (defined($ENV{UMASK})) {
my $UMASK = $ENV{UMASK};
my $m;
my $fmode = "0640";
if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) {
printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n");
printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); }
else {
$fmode= substr $UMASK, 2, 2;
$fmode= "06${fmode}"; }
if($fmode != $UMASK) {
printf("UMASK corrected from $UMASK to $fmode ...\n"); }
$fmode= oct($fmode);
umask($fmode);
}
main();
####
#### main sub routine
####
sub main
{
my $flag_exit= 0;
if (!defined(my_which(my_print_defaults)))
{
# We can't throw out yet, since --version, --help, or --example may
# have been given
print "WARNING: my_print_defaults command not found.\n";
print "Please make sure you have this command available and\n";
print "in your path. The command is available from the latest\n";
print "MySQL distribution.\n";
$my_print_defaults_exists= 0;
}
# Remove leading defaults options from @ARGV
while (@ARGV > 0)
{
last unless $ARGV[0] =~
/^--(?:no-defaults$|(?:defaults-file|defaults-extra-file)=)/;
push @defaults_options, (shift @ARGV);
}
foreach (@defaults_options)
{
$_ = quote_shell_word($_);
}
# Add [mysqld_multi] options to front of @ARGV, ready for GetOptions()
unshift @ARGV, defaults_for_group('mysqld_multi');
# We've already handled --no-defaults, --defaults-file, etc.
if (!GetOptions("help", "example", "version", "mysqld=s", "mysqladmin=s",
"user=s", "password=s", "log=s", "no-log",
"tcp-ip", "silent", "verbose"))
{
$flag_exit= 1;
}
usage() if ($opt_help);
if ($opt_verbose && $opt_silent)
{
print "Both --verbose and --silent have been given. Some of the warnings ";
print "will be disabled\nand some will be enabled.\n\n";
}
$groupids = $ARGV[1];
if ($opt_version)
{
print "$my_progname version $VER by Jani Tolonen\n";
exit(0);
}
example() if ($opt_example);
if ($flag_exit)
{
print "Error with an option, see $my_progname --help for more info.\n";
exit(1);
}
if (!defined(my_which(my_print_defaults)))
{
print "ABORT: Can't find command 'my_print_defaults'.\n";
print "This command is available from the latest MySQL\n";
print "distribution. Please make sure you have the command\n";
print "in your PATH.\n";
exit(1);
}
usage() if (!defined($ARGV[0]) ||
(!($ARGV[0] =~ m/^start$/i) &&
!($ARGV[0] =~ m/^stop$/i) &&
!($ARGV[0] =~ m/^report$/i)));
init_log() if (!defined($opt_log));
if (!$opt_no_log)
{
w2log("$my_progname log file version $VER; run: ",
"$opt_log", 1, 0);
}
else
{
print "$my_progname log file version $VER; run: ";
print strftime "%a %b %e %H:%M:%S %Y", localtime;
print "\n";
}
if ($ARGV[0] =~ m/^start$/i)
{
if (!defined(($mysqld= my_which($opt_mysqld))) && $opt_verbose)
{
print "WARNING: Couldn't find the default mysqld binary.\n";
print "Tried: $opt_mysqld\n";
print "This is OK, if you are using option \"mysqld=...\" in ";
print "groups [mysqldN] separately for each.\n\n";
}
start_mysqlds();
}
else
{
if (!defined(($mysqladmin= my_which($opt_mysqladmin))) && $opt_verbose)
{
print "WARNING: Couldn't find the default mysqladmin binary.\n";
print "Tried: $opt_mysqladmin\n";
print "This is OK, if you are using option \"mysqladmin=...\" in ";
print "groups [mysqldN] separately for each.\n\n";
}
if ($ARGV[0] =~ m/^report$/i)
{
report_mysqlds();
}
else
{
stop_mysqlds();
}
}
}
#
# Quote word for shell
#
sub quote_shell_word
{
my ($option)= @_;
$option =~ s!([^\w=./-])!\\$1!g;
return $option;
}
sub defaults_for_group
{
my ($group) = @_;
return () unless $my_print_defaults_exists;
my $com= join ' ', 'my_print_defaults', @defaults_options, $group;
my @defaults = `$com`;
chomp @defaults;
return @defaults;
}
####
#### Init log file. Check for appropriate place for log file, in the following
#### order: my_print_defaults mysqld datadir, C:/Program Files (x86)/MySQL/share
####
sub init_log
{
foreach my $opt (defaults_for_group('--mysqld'))
{
if ($opt =~ m/^--datadir=(.*)/ && -d "$1" && -w "$1")
{
$logdir= $1;
}
}
if (!defined($logdir))
{
$logdir= "C:/Program Files (x86)/MySQL/share" if (-d "C:/Program Files (x86)/MySQL/share" && -w "C:/Program Files (x86)/MySQL/share");
}
if (!defined($logdir))
{
# Log file was not specified and we could not log to a standard place,
# so log file be disabled for now.
if (!$opt_silent)
{
print "WARNING: Log file disabled. Maybe directory or file isn't writable?\n";
}
$opt_no_log= 1;
}
else
{
$opt_log= "$logdir/mysqld_multi.log";
}
}
####
#### Report living and not running MySQL servers
####
sub report_mysqlds
{
my (@groups, $com, $i, @options, $pec);
print "Reporting MySQL servers\n";
if (!$opt_no_log)
{
w2log("\nReporting MySQL servers","$opt_log",0,0);
}
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
$com= get_mysqladmin_options($i, @groups);
$com.= " ping >> /dev/null 2>&1";
system($com);
$pec = $? >> 8;
if ($pec)
{
print "MySQL server from group: $groups[$i] is not running\n";
if (!$opt_no_log)
{
w2log("MySQL server from group: $groups[$i] is not running",
"$opt_log", 0, 0);
}
}
else
{
print "MySQL server from group: $groups[$i] is running\n";
if (!$opt_no_log)
{
w2log("MySQL server from group: $groups[$i] is running",
"$opt_log", 0, 0);
}
}
}
if (!$i)
{
print "No groups to be reported (check your GNRs)\n";
if (!$opt_no_log)
{
w2log("No groups to be reported (check your GNRs)", "$opt_log", 0, 0);
}
}
}
####
#### start multiple servers
####
sub start_mysqlds()
{
my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
if (!$opt_no_log)
{
w2log("\nStarting MySQL servers\n","$opt_log",0,0);
}
else
{
print "\nStarting MySQL servers\n";
}
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
@options = defaults_for_group($groups[$i]);
$basedir_found= 0; # The default
$mysqld_found= 1; # The default
$mysqld_found= 0 if (!length($mysqld));
$com= "$mysqld";
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
{
# catch this and ignore
}
elsif ("--mysqld=" eq substr($options[$j], 0, 9))
{
$options[$j]=~ s/\-\-mysqld\=//;
$com= $options[$j];
$mysqld_found= 1;
}
elsif ("--basedir=" eq substr($options[$j], 0, 10))
{
$basedir= $options[$j];
$basedir =~ s/^--basedir=//;
$basedir_found= 1;
$options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]";
}
else
{
$options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]";
}
}
if ($opt_verbose && $com =~ m/\/(safe_mysqld|mysqld_safe)$/ && !$info_sent)
{
print "WARNING: $1 is being used to start mysqld. In this case you ";
print "may need to pass\n\"ledir=...\" under groups [mysqldN] to ";
print "$1 in order to find the actual mysqld binary.\n";
print "ledir (library executable directory) should be the path to the ";
print "wanted mysqld binary.\n\n";
$info_sent= 1;
}
$com.= $tmp;
$com.= " >> $opt_log 2>&1" if (!$opt_no_log);
$com.= " &";
if (!$mysqld_found)
{
print "\n";
print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]], ";
print "but no mysqld binary was found.\n";
print "Please add \"mysqld=...\" in group [mysqld_multi], or add it to ";
print "group [$groups[$i]] separately.\n";
exit(1);
}
if ($basedir_found)
{
$curdir=getcwd();
chdir($basedir) or die "Can't change to datadir $basedir";
}
system($com);
if ($basedir_found)
{
chdir($curdir) or die "Can't change back to original dir $curdir";
}
}
if (!$i && !$opt_no_log)
{
w2log("No MySQL servers to be started (check your GNRs)",
"$opt_log", 0, 0);
}
}
####
#### stop multiple servers
####
sub stop_mysqlds()
{
my (@groups, $com, $i, @options);
if (!$opt_no_log)
{
w2log("\nStopping MySQL servers\n","$opt_log",0,0);
}
else
{
print "\nStopping MySQL servers\n";
}
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
$com= get_mysqladmin_options($i, @groups);
$com.= " shutdown";
$com.= " >> $opt_log 2>&1" if (!$opt_no_log);
$com.= " &";
system($com);
}
if (!$i && !$opt_no_log)
{
w2log("No MySQL servers to be stopped (check your GNRs)",
"$opt_log", 0, 0);
}
}
####
#### Sub function for mysqladmin option parsing
####
sub get_mysqladmin_options
{
my ($i, @groups)= @_;
my ($mysqladmin_found, $com, $tmp, $j);
@options = defaults_for_group($groups[$i]);
$mysqladmin_found= 1; # The default
$mysqladmin_found= 0 if (!length($mysqladmin));
$com = "$mysqladmin";
$tmp = " -u $opt_user";
if (defined($opt_password)) {
my $pw= $opt_password;
# Protect single quotes in password
$pw =~ s/'/'"'"'/g;
$tmp.= " -p'$pw'";
}
$tmp.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
for ($j = 0; defined($options[$j]); $j++)
{
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
{
$options[$j]=~ s/\-\-mysqladmin\=//;
$com= $options[$j];
$mysqladmin_found= 1;
}
elsif ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
($options[$j] =~ m/^(\-\-port\=)(.*)$/))
{
$tmp.= " $options[$j]";
}
}
if (!$mysqladmin_found)
{
print "\n";
print "FATAL ERROR: Tried to use mysqladmin in group [$groups[$i]], ";
print "but no mysqladmin binary was found.\n";
print "Please add \"mysqladmin=...\" in group [mysqld_multi], or ";
print "in group [$groups[$i]].\n";
exit(1);
}
$com.= $tmp;
return $com;
}
# Return a list of option files which can be opened. Similar, but not
# identical, to behavior of my_search_option_files()
# TODO implement and use my_print_defaults --list-groups instead
sub list_defaults_files
{
my %opt;
foreach (@defaults_options)
{
return () if /^--no-defaults$/;
$opt{$1} = $2 if /^--defaults-(extra-file|file)=(.*)$/;
}
return ($opt{file}) if exists $opt{file};
return ('/etc/my.cnf',
'/etc/mysql/my.cnf',
'C:/Program Files (x86)/MySQL/my.cnf',
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
$opt{'extra-file'},
($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
}
# Takes a specification of GNRs (see --help), and returns a list of matching
# groups which actually are mentioned in a relevant config file
sub find_groups
{
my ($raw_gids) = @_;
my %gids;
my @groups;
if (defined($raw_gids))
{
# Make a hash of the wanted group ids
foreach my $raw_gid (split ',', $raw_gids)
{
# Match 123 or 123-456
my ($start, $end) = ($raw_gid =~ /^\s*(\d+)(?:\s*-\s*(\d+))?\s*$/);
$end = $start if not defined $end;
if (not defined $start or $end < $start or $start < 0)
{
print "ABORT: Bad GNR: $raw_gid; see $my_progname --help\n";
exit(1);
}
foreach my $i ($start .. $end)
{
# Use $i + 0 to normalize numbers (002 + 0 -> 2)
$gids{$i + 0}= 1;
}
}
}
my %seen;
my @defaults_files = list_defaults_files();
while (@defaults_files)
{
my $file = shift @defaults_files;
next unless defined $file and not $seen{$file}++ and open CONF, '<', $file;
while (<CONF>)
{
if (/^\s*\[\s*(mysqld)(\d+)\s*\]\s*$/)
{
#warn "Found a group: $1$2\n";
# Use $2 + 0 to normalize numbers (002 + 0 -> 2)
if (not defined($raw_gids) or $gids{$2 + 0})
{
push @groups, "$1$2";
}
}
elsif (/^\s*!include\s+(\S.*?)\s*$/)
{
push @defaults_files, $1;
}
elsif (/^\s*!includedir\s+(\S.*?)\s*$/)
{
push @defaults_files, <$1/*.cnf>;
}
}
close CONF;
}
return @groups;
}
####
#### w2log: Write to a logfile.
#### 1.arg: append to the log file (given string, or from a file. if a file,
#### file will be read from $opt_logdir)
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
#### 3.arg. 0 | 1, if true, print current date to the logfile. 3. arg will
#### be ignored, if 1. arg is a file.
#### 4.arg. 0 | 1, if true, first argument is a file, else a string
####
sub w2log
{
my ($msg, $file, $date_flag, $is_file)= @_;
my (@data);
open (LOGFILE, ">>$opt_log")
or die "FATAL: w2log: Couldn't open log file: $opt_log\n";
if ($is_file)
{
open (FROMFILE, "<$msg") && (@data=<FROMFILE>) &&
close(FROMFILE)
or die "FATAL: w2log: Couldn't open file: $msg\n";
foreach my $line (@data)
{
print LOGFILE "$line";
}
}
else
{
print LOGFILE "$msg";
print LOGFILE strftime "%a %b %e %H:%M:%S %Y", localtime if ($date_flag);
print LOGFILE "\n";
}
close (LOGFILE);
return;
}
####
#### my_which is used, because we can't assume that every system has the
#### which -command. my_which can take only one argument at a time.
#### Return values: requested system command with the first found path,
#### or undefined, if not found.
####
sub my_which
{
my ($command) = @_;
my (@paths, $path);
# If the argument is not 'my_print_defaults' then it would be of the format
# <absolute_path>/<program>
return $command if ($command ne 'my_print_defaults' && -f $command &&
-x $command);
@paths = split(':', $ENV{'PATH'});
foreach $path (@paths)
{
$path .= "/$command";
return $path if (-f $path && -x $path);
}
return undef();
}
####
#### example
####
sub example
{
print <<EOF;
# This is an example of a my.cnf file for $my_progname.
# Usually this file is located in home dir ~/.my.cnf or /etc/my.cnf
#
# SOME IMPORTANT NOTES FOLLOW:
#
# 1.COMMON USER
#
# Make sure that the MySQL user, who is stopping the mysqld services, has
# the same password to all MySQL servers being accessed by $my_progname.
# This user needs to have the 'Shutdown_priv' -privilege, but for security
# reasons should have no other privileges. It is advised that you create a
# common 'multi_admin' user for all MySQL servers being controlled by
# $my_progname. Here is an example how to do it:
#
# GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'password'
#
# You will need to apply the above to all MySQL servers that are being
# controlled by $my_progname. 'multi_admin' will shutdown the servers
# using 'mysqladmin' -binary, when '$my_progname stop' is being called.
#
# 2.PID-FILE
#
# If you are using mysqld_safe to start mysqld, make sure that every
# MySQL server has a separate pid-file. In order to use mysqld_safe
# via $my_progname, you need to use two options:
#
# mysqld=/path/to/mysqld_safe
# ledir=/path/to/mysqld-binary/
#
# ledir (library executable directory), is an option that only mysqld_safe
# accepts, so you will get an error if you try to pass it to mysqld directly.
# For this reason you might want to use the above options within [mysqld#]
# group directly.
#
# 3.DATA DIRECTORY
#
# It is NOT advised to run many MySQL servers within the same data directory.
# You can do so, but please make sure to understand and deal with the
# underlying caveats. In short they are:
# - Speed penalty
# - Risk of table/data corruption
# - Data synchronising problems between the running servers
# - Heavily media (disk) bound
# - Relies on the system (external) file locking
# - Is not applicable with all table types. (Such as InnoDB)
# Trying so will end up with undesirable results.
#
# 4.TCP/IP Port
#
# Every server requires one and it must be unique.
#
# 5.[mysqld#] Groups
#
# In the example below the first and the fifth mysqld group was
# intentionally left out. You may have 'gaps' in the config file. This
# gives you more flexibility.
#
# 6.MySQL Server User
#
# You can pass the user=... option inside [mysqld#] groups. This
# can be very handy in some cases, but then you need to run $my_progname
# as UNIX root.
#
# 7.A Start-up Manage Script for $my_progname
#
# In the recent MySQL distributions you can find a file called
# mysqld_multi.server.sh. It is a wrapper for $my_progname. This can
# be used to start and stop multiple servers during boot and shutdown.
#
# You can place the file in /etc/init.d/mysqld_multi.server.sh and
# make the needed symbolic links to it from various run levels
# (as per Linux/Unix standard). You may even replace the
# /etc/init.d/mysql.server script with it.
#
# Before using, you must create a my.cnf file either in C:/Program Files (x86)/MySQL/my.cnf
# or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups.
#
# The script can be found from support-files/mysqld_multi.server.sh
# in MySQL distribution. (Verify the script before using)
#
[mysqld_multi]
mysqld = C:/Program Files (x86)/MySQL/bin/mysqld_safe
mysqladmin = C:/Program Files (x86)/MySQL/bin/mysqladmin
user = multi_admin
password = my_password
[mysqld2]
socket = /tmp/mysql.sock2
port = 3307
pid-file = C:/MariaDB5.5/data2/hostname.pid2
datadir = C:/MariaDB5.5/data2
language = C:/Program Files (x86)/MySQL/share/mysql/english
user = unix_user1
[mysqld3]
mysqld = /path/to/mysqld_safe
ledir = /path/to/mysqld-binary/
mysqladmin = /path/to/mysqladmin
socket = /tmp/mysql.sock3
port = 3308
pid-file = C:/MariaDB5.5/data3/hostname.pid3
datadir = C:/MariaDB5.5/data3
language = C:/Program Files (x86)/MySQL/share/mysql/swedish
user = unix_user2
[mysqld4]
socket = /tmp/mysql.sock4
port = 3309
pid-file = C:/MariaDB5.5/data4/hostname.pid4
datadir = C:/MariaDB5.5/data4
language = C:/Program Files (x86)/MySQL/share/mysql/estonia
user = unix_user3
[mysqld6]
socket = /tmp/mysql.sock6
port = 3311
pid-file = C:/MariaDB5.5/data6/hostname.pid6
datadir = C:/MariaDB5.5/data6
language = C:/Program Files (x86)/MySQL/share/mysql/japanese
user = unix_user4
EOF
exit(0);
}
####
#### usage
####
sub usage
{
print <<EOF;
$my_progname version $VER by Jani Tolonen
Description:
$my_progname can be used to start, or stop any number of separate
mysqld processes running in different TCP/IP ports and UNIX sockets.
$my_progname can read group [mysqld_multi] from my.cnf file. You may
want to put options mysqld=... and mysqladmin=... there. Since
version 2.10 these options can also be given under groups [mysqld#],
which gives more control over different versions. One can have the
default mysqld and mysqladmin under group [mysqld_multi], but this is
not mandatory. Please note that if mysqld or mysqladmin is missing
from both [mysqld_multi] and [mysqld#], a group that is tried to be
used, $my_progname will abort with an error.
$my_progname will search for groups named [mysqld#] from my.cnf (or
the given --defaults-extra-file=...), where '#' can be any positive
integer starting from 1. These groups should be the same as the regular
[mysqld] group, but with those port, socket and any other options
that are to be used with each separate mysqld process. The number
in the group name has another function; it can be used for starting,
stopping, or reporting any specific mysqld server.
Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
or $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
The GNR means the group number. You can start, stop or report any GNR,
or several of them at the same time. (See --example) The GNRs list can
be comma separated or a dash combined. The latter means that all the
GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
groups found will either be started, stopped, or reported. Note that
syntax for specifying GNRs must appear without spaces.
Options:
These options must be given before any others:
--no-defaults Do not read any defaults file
--defaults-file=... Read only this configuration file, do not read the
standard system-wide and user-specific files
--defaults-extra-file=... Read this configuration file in addition to the
standard system-wide and user-specific files
Using: @{[join ' ', @defaults_options]}
--example Give an example of a config file with extra information.
--help Print this help and exit.
--log=... Log file. Full path to and the name for the log file. NOTE:
If the file exists, everything will be appended.
Using: $opt_log
--mysqladmin=... mysqladmin binary to be used for a server shutdown.
Since version 2.10 this can be given within groups [mysqld#]
Using: $mysqladmin
--mysqld=... mysqld binary to be used. Note that you can give mysqld_safe
to this option also. The options are passed to mysqld. Just
make sure you have mysqld in your PATH or fix mysqld_safe.
Using: $mysqld
Please note: Since mysqld_multi version 2.3 you can also
give this option inside groups [mysqld#] in ~/.my.cnf,
where '#' stands for an integer (number) of the group in
question. This will be recognised as a special option and
will not be passed to the mysqld. This will allow one to
start different mysqld versions with mysqld_multi.
--no-log Print to stdout instead of the log file. By default the log
file is turned on.
--password=... Password for mysqladmin user.
--silent Disable warnings.
--tcp-ip Connect to the MySQL server(s) via the TCP/IP port instead
of the UNIX socket. This affects stopping and reporting.
If a socket file is missing, the server may still be
running, but can be accessed only via the TCP/IP port.
By default connecting is done via the UNIX socket.
--user=... mysqladmin user. Using: $opt_user
--verbose Be more verbose.
--version Print the version number and exit.
EOF
exit(0);
}

View file

@ -0,0 +1,228 @@
#!/usr/bin/perl
# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# 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 Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1335 USA
# mysqldumpslow - parse and summarize the MySQL slow query log
# Original version by Tim Bunce, sometime in 2000.
# Further changes by Tim Bunce, 8th March 2001.
# Handling of strings with \ and double '' by Monty 11 Aug 2001.
use strict;
use Getopt::Long;
# t=time, l=lock time, r=rows
# at, al, and ar are the corresponding averages
my %opt = (
s => 'at',
h => '*',
);
GetOptions(\%opt,
'v|verbose+',# verbose
'help+', # write usage info
'd|debug+', # debug
's=s', # what to sort by (al, at, ar, ae, c, t, l, r, e)
'r!', # reverse the sort order (largest last instead of first)
't=i', # just show the top n queries
'a!', # don't abstract all numbers to N and strings to 'S'
'n=i', # abstract numbers with at least n digits within names
'g=s', # grep: only consider stmts that include this string
'h=s', # hostname/basename of db server for *-slow.log filename (can be wildcard)
'i=s', # name of server instance (if using mysql.server startup script)
'l!', # don't subtract lock time from total time
) or usage("bad option");
$opt{'help'} and usage();
unless (@ARGV) {
my $defaults = `my_print_defaults --mysqld`;
my $datadir = ($defaults =~ m/--datadir=(.*)/g)[-1];
if (!$datadir or $opt{i}) {
# determine the datadir from the instances section of /etc/my.cnf, if any
my $instances = `my_print_defaults instances`;
die "Can't determine datadir from 'my_print_defaults instances' output: $defaults"
unless $instances;
my @instances = ($instances =~ m/^--(\w+)-/mg);
die "No -i 'instance_name' specified to select among known instances: @instances.\n"
unless $opt{i};
die "Instance '$opt{i}' is unknown (known instances: @instances)\n"
unless grep { $_ eq $opt{i} } @instances;
$datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/g)[-1]
or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances";
warn "datadir=$datadir\n" if $opt{v};
}
my $slowlog = ($defaults =~ m/--log[-_]slow[-_]queries=(.*)/g)[-1];
if (!$slowlog)
{
$slowlog = ($defaults =~ m/--slow[-_]query[-_]log[-_]file=(.*)/g)[-1];
}
if ( $slowlog )
{
@ARGV = ($slowlog);
die "Can't find '$slowlog'\n" unless @ARGV;
}
else
{
if (!$opt{h})
{
$opt{h}= ($defaults =~ m/--log[-_]basename=(.*)/g)[-1];
}
@ARGV = <$datadir/$opt{h}-slow.log>;
die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
}
}
warn "\nReading mysql slow query log from @ARGV\n";
my @pending;
my %stmt;
$/ = ";\n#"; # read entire statements using paragraph mode
while ( defined($_ = shift @pending) or defined($_ = <>) ) {
warn "[[$_]]\n" if $opt{d}; # show raw paragraph being read
my @chunks = split /^\/.*Version.*started with[\000-\377]*?Time.*Id.*Command.*Argument.*\n/m;
if (@chunks > 1) {
unshift @pending, map { length($_) ? $_ : () } @chunks;
warn "<<".join(">>\n<<",@chunks).">>" if $opt{d};
next;
}
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
s/^# Thread_id: [0-9]+\s+Schema: [^\n]+\n//;
s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+)\s+Rows_examined: ([0-9.]+).*\n//;
my ($t, $l, $r, $e) = ($1, $2, $3, $4);
$t -= $l unless $opt{l};
# remove fluff that mysqld writes to log when it (re)starts:
s!^/.*Version.*started with:.*\n!!mg;
s!^Tcp port: \d+ Unix socket: \S+\n!!mg;
s!^Time.*Id.*Command.*Argument.*\n!!mg;
# Remove optimizer info
s!^# QC_Hit: \S+\s+Full_scan: \S+\s+Full_join: \S+\s+Tmp_table: \S+\s+Tmp_table_on_disk: \S+[^\n]+\n!!mg;
s!^# Filesort: \S+\s+Filesort_on_disk: \S+[^\n]+\n!!mg;
s!^# Full_scan: \S+\s+Full_join: \S+[^\n]+\n!!mg;
s/^use \w+;\n//; # not consistently added
s/^SET timestamp=\d+;\n//;
s/^[ ]*\n//mg; # delete blank lines
s/^[ ]*/ /mg; # normalize leading whitespace
s/\s*;\s*(#\s*)?$//; # remove trailing semicolon(+newline-hash)
next if $opt{g} and !m/$opt{g}/io;
unless ($opt{a}) {
s/\b\d+\b/N/g;
s/\b0x[0-9A-Fa-f]+\b/N/g;
s/''/'S'/g;
s/""/"S"/g;
s/(\\')//g;
s/(\\")//g;
s/'[^']+'/'S'/g;
s/"[^"]+"/"S"/g;
# -n=8: turn log_20001231 into log_NNNNNNNN
s/([a-z_]+)(\d{$opt{n},})/$1.('N' x length($2))/ieg if $opt{n};
# abbreviate massive "in (...)" statements and similar
s!(([NS],){100,})!sprintf("$2,{repeated %d times}",length($1)/2)!eg;
}
my $s = $stmt{$_} ||= { users=>{}, hosts=>{} };
$s->{c} += 1;
$s->{t} += $t;
$s->{l} += $l;
$s->{r} += $r;
$s->{e} += $e;
$s->{users}->{$user}++ if $user;
$s->{hosts}->{$host}++ if $host;
warn "{{$_}}\n\n" if $opt{d}; # show processed statement string
}
foreach (keys %stmt) {
my $v = $stmt{$_} || die;
my ($c, $t, $l, $r, $e) = @{ $v }{qw(c t l r e)};
$v->{at} = $t / $c;
$v->{al} = $l / $c;
$v->{ar} = $r / $c;
$v->{ae} = $e / $c;
}
my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt;
@sorted = @sorted[0 .. $opt{t}-1] if $opt{t};
@sorted = reverse @sorted if $opt{r};
foreach (@sorted) {
my $v = $stmt{$_} || die;
my ($c, $t,$at, $l,$al, $r,$ar,$e, $ae) = @{ $v }{qw(c t at l al r ar e ae)};
my @users = keys %{$v->{users}};
my $user = (@users==1) ? $users[0] : sprintf "%dusers",scalar @users;
my @hosts = keys %{$v->{hosts}};
my $host = (@hosts==1) ? $hosts[0] : sprintf "%dhosts",scalar @hosts;
printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows_sent=%.1f (%d), Rows_examined=%.1f (%d), $user\@$host\n%s\n\n",
$c, $at,$t, $al,$l, $ar,$r, $ae, $e, $_;
}
sub usage {
my $str= shift;
my $text= <<HERE;
Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]
Parse and summarize the MySQL slow query log. Options are
--verbose verbose
--debug debug
--help write this text to standard output
-v verbose
-d debug
-s ORDER what to sort by (al, at, ar, ae, c, l, r, e, t), 'at' is default
al: average lock time
ar: average rows sent
at: average query time
c: count
l: lock time
r: rows sent
t: query time
-r reverse the sort order (largest last instead of first)
-t NUM just show the top n queries
-a don't abstract all numbers to N and strings to 'S'
-n NUM abstract numbers with at least n digits within names
-g PATTERN grep: only consider stmts that include this string
-h HOSTNAME hostname of db server for *-slow.log filename (can be wildcard),
default is '*', i.e. match all
-i NAME name of server instance (if using mysql.server startup script)
-l don't subtract lock time from total time
HERE
if ($str) {
print STDERR "ERROR: $str\n\n";
print STDERR $text;
exit 1;
} else {
print $text;
exit 0;
}
}

1161
database/bin/mysqlhotcopy.pl Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,56 @@
#ifndef MYSQL_AUTH_DIALOG_CLIENT_INCLUDED
/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab
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; version 2 of the License.
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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/**
@file
Definitions needed to use Dialog client authentication plugin
*/
struct st_mysql;
#define MYSQL_AUTH_DIALOG_CLIENT_INCLUDED
/**
type of the mysql_authentication_dialog_ask function
@param mysql mysql
@param type type of the input
1 - ordinary string input
2 - password string
@param prompt prompt
@param buf a buffer to store the use input
@param buf_len the length of the buffer
@retval a pointer to the user input string.
It may be equal to 'buf' or to 'mysql->password'.
In all other cases it is assumed to be an allocated
string, and the "dialog" plugin will free() it.
*/
typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql,
int type, const char *prompt, char *buf, int buf_len);
/**
first byte of the question string is the question "type".
It can be an "ordinary" or a "password" question.
The last bit set marks a last question in the authentication exchange.
*/
#define ORDINARY_QUESTION "\2"
#define LAST_QUESTION "\3"
#define PASSWORD_QUESTION "\4"
#define LAST_PASSWORD "\5"
#endif

View file

@ -0,0 +1,186 @@
#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED
/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab
Copyright (c) 2010, 2011, Oracle and/or its affiliates.
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; version 2 of the License.
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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/**
@file
MySQL Client Plugin API
This file defines the API for plugins that work on the client side
*/
#define MYSQL_CLIENT_PLUGIN_INCLUDED
/*
On Windows, exports from DLL need to be declared
Also, plugin needs to be declared as extern "C" because MSVC
unlike other compilers, uses C++ mangling for variables not only
for functions.
*/
#undef MYSQL_PLUGIN_EXPORT
#if defined(_MSC_VER)
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
#endif
#else /*_MSC_VER */
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C"
#else
#define MYSQL_PLUGIN_EXPORT
#endif
#endif
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
#endif
/* known plugin types */
#define MYSQL_CLIENT_reserved1 0
#define MYSQL_CLIENT_reserved2 1
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100
#define MYSQL_CLIENT_MAX_PLUGINS 3
#define mysql_declare_client_plugin(X) \
MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \
_mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_ ## X ## _PLUGIN, \
MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION,
#define mysql_end_client_plugin }
/* generic plugin header structure */
#define MYSQL_CLIENT_PLUGIN_HEADER \
int type; \
unsigned int interface_version; \
const char *name; \
const char *author; \
const char *desc; \
unsigned int version[3]; \
const char *license; \
void *mysql_api; \
int (*init)(char *, size_t, int, va_list); \
int (*deinit)(); \
int (*options)(const char *option, const void *);
struct st_mysql_client_plugin
{
MYSQL_CLIENT_PLUGIN_HEADER
};
struct st_mysql;
/******** authentication plugin specific declarations *********/
#include <mysql/plugin_auth_common.h>
struct st_mysql_client_plugin_AUTHENTICATION
{
MYSQL_CLIENT_PLUGIN_HEADER
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
};
#include <mysql/auth_dialog_client.h>
/******** using plugins ************/
/**
loads a plugin and initializes it
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
function
@param ... arguments for the plugin initialization function
@retval
a pointer to the loaded plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *
mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
int argc, ...);
/**
loads a plugin and initializes it, taking va_list as an argument
This is the same as mysql_load_plugin, but take va_list instead of
a list of arguments.
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
function
@param args arguments for the plugin initialization function
@retval
a pointer to the loaded plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *
mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
int argc, va_list args);
/**
finds an already loaded plugin by name, or loads it, if necessary
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded
@retval
a pointer to the plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *
mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
/**
adds a plugin structure to the list of loaded plugins
This is useful if an application has the necessary functionality
(for example, a special load data handler) statically linked into
the application binary. It can use this function to register the plugin
directly, avoiding the need to factor it out into a shared object.
@param mysql MYSQL structure. It is only used for error reporting
@param plugin an st_mysql_client_plugin structure to register
@retval
a pointer to the plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *
mysql_client_register_plugin(struct st_mysql *mysql,
struct st_mysql_client_plugin *plugin);
/**
set plugin options
Can be used to set extra options and affect behavior for a plugin.
This function may be called multiple times to set several options
@param plugin an st_mysql_client_plugin structure
@param option a string which specifies the option to set
@param value value for the option.
@retval 0 on success, 1 in case of failure
**/
int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
const char *option, const void *value);
#endif

View file

@ -0,0 +1,116 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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; version 2 of the License.
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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#ifndef _decimal_h
#define _decimal_h
typedef enum
{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR}
decimal_round_mode;
typedef int32 decimal_digit_t;
/**
intg is the number of *decimal* digits (NOT number of decimal_digit_t's !)
before the point
frac is the number of decimal digits after the point
len is the length of buf (length of allocated space) in decimal_digit_t's,
not in bytes
sign false means positive, true means negative
buf is an array of decimal_digit_t's
*/
typedef struct st_decimal_t {
int intg, frac, len;
my_bool sign;
decimal_digit_t *buf;
} decimal_t;
int internal_str2dec(const char *from, decimal_t *to, char **end,
my_bool fixed);
int decimal2string(const decimal_t *from, char *to, int *to_len,
int fixed_precision, int fixed_decimals,
char filler);
int decimal2ulonglong(const decimal_t *from, ulonglong *to);
int ulonglong2decimal(ulonglong from, decimal_t *to);
int decimal2longlong(const decimal_t *from, longlong *to);
int longlong2decimal(longlong from, decimal_t *to);
int decimal2double(const decimal_t *from, double *to);
int double2decimal(double from, decimal_t *to);
int decimal_actual_fraction(decimal_t *from);
int decimal2bin(const decimal_t *from, uchar *to, int precision, int scale);
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale);
int decimal_size(int precision, int scale);
int decimal_bin_size(int precision, int scale);
int decimal_result_size(decimal_t *from1, decimal_t *from2, char op,
int param);
int decimal_intg(const decimal_t *from);
int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
int decimal_cmp(const decimal_t *from1, const decimal_t *from2);
int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to,
int scale_incr);
int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
int decimal_round(const decimal_t *from, decimal_t *to, int new_scale,
decimal_round_mode mode);
int decimal_is_zero(const decimal_t *from);
void max_decimal(int precision, int frac, decimal_t *to);
#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0)
#define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1)
/* set a decimal_t to zero */
#define decimal_make_zero(dec) do { \
(dec)->buf[0]=0; \
(dec)->intg=1; \
(dec)->frac=0; \
(dec)->sign=0; \
} while(0)
/*
returns the length of the buffer to hold string representation
of the decimal (including decimal dot, possible sign and \0)
*/
#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \
(dec)->frac + ((dec)->frac > 0) + 2)
/* negate a decimal */
#define decimal_neg(dec) do { (dec)->sign^=1; } while(0)
/*
conventions:
decimal_smth() == 0 -- everything's ok
decimal_smth() <= 1 -- result is usable, but precision loss is possible
decimal_smth() <= 2 -- result can be unusable, most significant digits
could've been lost
decimal_smth() > 2 -- no result was generated
*/
#define E_DEC_OK 0
#define E_DEC_TRUNCATED 1
#define E_DEC_OVERFLOW 2
#define E_DEC_DIV_ZERO 4
#define E_DEC_BAD_NUM 8
#define E_DEC_OOM 16
#define E_DEC_ERROR 31
#define E_DEC_FATAL_ERROR 30
#endif

View file

@ -0,0 +1,110 @@
#ifndef ERRMSG_INCLUDED
#define ERRMSG_INCLUDED
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
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; version 2 of the License.
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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/* Error messages for MySQL clients */
/* (Error messages for the daemon are in sql/share/errmsg.txt) */
#ifdef __cplusplus
extern "C" {
#endif
void init_client_errs(void);
void finish_client_errs(void);
extern const char *client_errors[]; /* Error messages */
#ifdef __cplusplus
}
#endif
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#if !defined(ER)
#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \
client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR])
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
/* Do not add error numbers before CR_ERROR_FIRST. */
/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */
#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/
#define CR_UNKNOWN_ERROR 2000
#define CR_SOCKET_CREATE_ERROR 2001
#define CR_CONNECTION_ERROR 2002
#define CR_CONN_HOST_ERROR 2003
#define CR_IPSOCK_ERROR 2004
#define CR_UNKNOWN_HOST 2005
#define CR_SERVER_GONE_ERROR 2006
#define CR_VERSION_ERROR 2007
#define CR_OUT_OF_MEMORY 2008
#define CR_WRONG_HOST_INFO 2009
#define CR_LOCALHOST_CONNECTION 2010
#define CR_TCP_CONNECTION 2011
#define CR_SERVER_HANDSHAKE_ERR 2012
#define CR_SERVER_LOST 2013
#define CR_COMMANDS_OUT_OF_SYNC 2014
#define CR_NAMEDPIPE_CONNECTION 2015
#define CR_NAMEDPIPEWAIT_ERROR 2016
#define CR_NAMEDPIPEOPEN_ERROR 2017
#define CR_NAMEDPIPESETSTATE_ERROR 2018
#define CR_CANT_READ_CHARSET 2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_EMBEDDED_CONNECTION 2021
#define CR_PROBE_SLAVE_STATUS 2022
#define CR_PROBE_SLAVE_HOSTS 2023
#define CR_PROBE_SLAVE_CONNECT 2024
#define CR_PROBE_MASTER_CONNECT 2025
#define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027
#define CR_WRONG_LICENSE 2028
/* new 4.1 error codes */
#define CR_NULL_POINTER 2029
#define CR_NO_PREPARE_STMT 2030
#define CR_PARAMS_NOT_BOUND 2031
#define CR_DATA_TRUNCATED 2032
#define CR_NO_PARAMETERS_EXISTS 2033
#define CR_INVALID_PARAMETER_NO 2034
#define CR_INVALID_BUFFER_USE 2035
#define CR_UNSUPPORTED_PARAM_TYPE 2036
#define CR_SHARED_MEMORY_CONNECTION 2037
#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038
#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039
#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040
#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041
#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042
#define CR_SHARED_MEMORY_MAP_ERROR 2043
#define CR_SHARED_MEMORY_EVENT_ERROR 2044
#define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046
#define CR_CONN_UNKNOW_PROTOCOL 2047
#define CR_INVALID_CONN_HANDLE 2048
#define CR_SECURE_AUTH 2049
#define CR_FETCH_CANCELED 2050
#define CR_NO_DATA 2051
#define CR_NO_STMT_METADATA 2052
#define CR_NO_RESULT_SET 2053
#define CR_NOT_IMPLEMENTED 2054
#define CR_SERVER_LOST_EXTENDED 2055
#define CR_STMT_CLOSED 2056
#define CR_NEW_STMT_METADATA 2057
#define CR_ALREADY_CONNECTED 2058
#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059
#define CR_ERROR_LAST /*Copy last error nr:*/ 2059
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
#endif /* ERRMSG_INCLUDED */

View file

@ -0,0 +1,81 @@
/* Copyright (c) 2013 SkySQL Ab
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; version 2 of the License.
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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/* Names of all handler error numbers. Used by mysqltest */
{ "HA_ERR_KEY_NOT_FOUND", HA_ERR_KEY_NOT_FOUND, "" },
{ "HA_ERR_FOUND_DUPP_KEY", HA_ERR_FOUND_DUPP_KEY, "" },
{ "HA_ERR_INTERNAL_ERROR", HA_ERR_INTERNAL_ERROR, "" },
{ "HA_ERR_RECORD_CHANGED", HA_ERR_RECORD_CHANGED, "" },
{ "HA_ERR_WRONG_INDEX", HA_ERR_WRONG_INDEX, "" },
{ "HA_ERR_CRASHED", HA_ERR_CRASHED, "" },
{ "HA_ERR_WRONG_IN_RECORD", HA_ERR_WRONG_IN_RECORD, "" },
{ "HA_ERR_OUT_OF_MEM", HA_ERR_OUT_OF_MEM, "" },
{ "HA_ERR_NOT_A_TABLE", HA_ERR_NOT_A_TABLE, "" },
{ "HA_ERR_WRONG_COMMAND", HA_ERR_WRONG_COMMAND, "" },
{ "HA_ERR_OLD_FILE", HA_ERR_OLD_FILE, "" },
{ "HA_ERR_NO_ACTIVE_RECORD", HA_ERR_NO_ACTIVE_RECORD, "" },
{ "HA_ERR_RECORD_DELETED", HA_ERR_RECORD_DELETED, "" },
{ "HA_ERR_RECORD_FILE_FULL", HA_ERR_RECORD_FILE_FULL, "" },
{ "HA_ERR_INDEX_FILE_FULL", HA_ERR_INDEX_FILE_FULL, "" },
{ "HA_ERR_END_OF_FILE", HA_ERR_END_OF_FILE, "" },
{ "HA_ERR_UNSUPPORTED", HA_ERR_UNSUPPORTED, "" },
{ "HA_ERR_TO_BIG_ROW", HA_ERR_TO_BIG_ROW, "" },
{ "HA_WRONG_CREATE_OPTION", HA_WRONG_CREATE_OPTION, "" },
{ "HA_ERR_FOUND_DUPP_UNIQUE", HA_ERR_FOUND_DUPP_UNIQUE, "" },
{ "HA_ERR_UNKNOWN_CHARSET", HA_ERR_UNKNOWN_CHARSET, "" },
{ "HA_ERR_WRONG_MRG_TABLE_DEF", HA_ERR_WRONG_MRG_TABLE_DEF, "" },
{ "HA_ERR_CRASHED_ON_REPAIR", HA_ERR_CRASHED_ON_REPAIR, "" },
{ "HA_ERR_CRASHED_ON_USAGE", HA_ERR_CRASHED_ON_USAGE, "" },
{ "HA_ERR_LOCK_WAIT_TIMEOUT", HA_ERR_LOCK_WAIT_TIMEOUT, "" },
{ "HA_ERR_LOCK_TABLE_FULL", HA_ERR_LOCK_TABLE_FULL, "" },
{ "HA_ERR_READ_ONLY_TRANSACTION", HA_ERR_READ_ONLY_TRANSACTION, "" },
{ "HA_ERR_LOCK_DEADLOCK", HA_ERR_LOCK_DEADLOCK, "" },
{ "HA_ERR_CANNOT_ADD_FOREIGN", HA_ERR_CANNOT_ADD_FOREIGN, "" },
{ "HA_ERR_NO_REFERENCED_ROW", HA_ERR_NO_REFERENCED_ROW, "" },
{ "HA_ERR_ROW_IS_REFERENCED", HA_ERR_ROW_IS_REFERENCED, "" },
{ "HA_ERR_NO_SAVEPOINT", HA_ERR_NO_SAVEPOINT, "" },
{ "HA_ERR_NON_UNIQUE_BLOCK_SIZE", HA_ERR_NON_UNIQUE_BLOCK_SIZE, "" },
{ "HA_ERR_NO_SUCH_TABLE", HA_ERR_NO_SUCH_TABLE, "" },
{ "HA_ERR_TABLE_EXIST", HA_ERR_TABLE_EXIST, "" },
{ "HA_ERR_NO_CONNECTION", HA_ERR_NO_CONNECTION, "" },
{ "HA_ERR_NULL_IN_SPATIAL", HA_ERR_NULL_IN_SPATIAL, "" },
{ "HA_ERR_TABLE_DEF_CHANGED", HA_ERR_TABLE_DEF_CHANGED, "" },
{ "HA_ERR_NO_PARTITION_FOUND", HA_ERR_NO_PARTITION_FOUND, "" },
{ "HA_ERR_RBR_LOGGING_FAILED", HA_ERR_RBR_LOGGING_FAILED, "" },
{ "HA_ERR_DROP_INDEX_FK", HA_ERR_DROP_INDEX_FK, "" },
{ "HA_ERR_FOREIGN_DUPLICATE_KEY", HA_ERR_FOREIGN_DUPLICATE_KEY, "" },
{ "HA_ERR_TABLE_NEEDS_UPGRADE", HA_ERR_TABLE_NEEDS_UPGRADE, "" },
{ "HA_ERR_TABLE_READONLY", HA_ERR_TABLE_READONLY, "" },
{ "HA_ERR_AUTOINC_READ_FAILED", HA_ERR_AUTOINC_READ_FAILED, "" },
{ "HA_ERR_AUTOINC_ERANGE", HA_ERR_AUTOINC_ERANGE, "" },
{ "HA_ERR_GENERIC", HA_ERR_GENERIC, "" },
{ "HA_ERR_RECORD_IS_THE_SAME", HA_ERR_RECORD_IS_THE_SAME, "" },
{ "HA_ERR_LOGGING_IMPOSSIBLE", HA_ERR_LOGGING_IMPOSSIBLE, "" },
{ "HA_ERR_CORRUPT_EVENT", HA_ERR_CORRUPT_EVENT, "" },
{ "HA_ERR_NEW_FILE", HA_ERR_NEW_FILE, "" },
{ "HA_ERR_ROWS_EVENT_APPLY", HA_ERR_ROWS_EVENT_APPLY, "" },
{ "HA_ERR_INITIALIZATION", HA_ERR_INITIALIZATION, "" },
{ "HA_ERR_FILE_TOO_SHORT", HA_ERR_FILE_TOO_SHORT, "" },
{ "HA_ERR_WRONG_CRC", HA_ERR_WRONG_CRC, "" },
{ "HA_ERR_TOO_MANY_CONCURRENT_TRXS", HA_ERR_TOO_MANY_CONCURRENT_TRXS, "" },
{ "HA_ERR_INDEX_COL_TOO_LONG", HA_ERR_INDEX_COL_TOO_LONG, "" },
{ "HA_ERR_INDEX_CORRUPT", HA_ERR_INDEX_CORRUPT, "" },
{ "HA_ERR_UNDO_REC_TOO_BIG", HA_ERR_UNDO_REC_TOO_BIG, "" },
{ "HA_ERR_TABLE_IN_FK_CHECK", HA_ERR_TABLE_IN_FK_CHECK, "" },
{ "HA_ERR_ROW_NOT_VISIBLE", HA_ERR_ROW_NOT_VISIBLE, "" },
{ "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" },
{ "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" },
{ "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" },

Some files were not shown because too many files have changed in this diff Show more