· 8 years ago · Jul 18, 2018, 12:28 AM
1com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '5784' for key 'PRIMARY'
2 at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
3 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
4 at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
5 at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
6 at com.mysql.jdbc.Util.getInstance(Util.java:381)
7 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
8 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
9 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
10 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
11 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
12 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
13 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
14 at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
15 at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
16 at org.zephyrion.mysql.MySQLDataStream.executeUpdate(MySQLDataStream.java:66)
17 at ItemDef.dumpItems(ItemDef.java:232)
18 at client.dumpItems(client.java:674)
19 at client.method6(client.java:5695)
20 at Applet_Sub1.run(Applet_Sub1.java:89)
21 at client.run(client.java:9291)
22 at java.lang.Thread.run(Thread.java:636)
23
24
25
26
27
28
29/*** Item Dumper ***/
30public static void dumpItems() {
31 try {
32 MySQLDataStream writer = new MySQLDataStream(new MySQLConnection("127.0.0.1", "client", "Zymus", "4w2MQyM5tJhFzzqU"));
33 System.out.println("anInt335=" + anInt335 + ", anInt352=" + anInt352 + ", anIntArray342.length=" + anIntArray342.length);
34 String query = ("DROP TABLE IF EXISTS `item_defs`;" +/*** Table Structure ***/
35 "CREATE TABLE `item_defs` (" +
36 "`id` int(11) NOT NULL," +
37 "`item_name` text COMMENT 'aString329'," +
38 "`anInt326` int(11) NOT NULL," +
39 "`anInt327` int(11) NOT NULL," +
40 "`anInt331` int(11) NOT NULL," +
41 "`anInt332` int(11) NOT NULL," +
42 "`anInt333` int(11) NOT NULL," +
43 "`anInt334` int(11) NOT NULL," +
44 "`anInt339` int(11) NOT NULL," +
45 "`anInt340` int(11) NOT NULL," +
46 "`anInt343` int(11) NOT NULL," +
47 "`anInt345` int(11) NOT NULL," +
48 "`anInt351` int(11) NOT NULL," +
49 "`anInt353` int(11) NOT NULL," +
50 "`anInt354` int(11) NOT NULL," +
51 "`anInt355` int(11) NOT NULL," +
52 "`anInt356` int(11) NOT NULL," +
53 "`anInt357` int(11) NOT NULL," +
54 "`anInt358` int(11) NOT NULL," +
55 "`anInt359` int(11) NOT NULL," +
56 "`anInt360` int(11) NOT NULL," +
57 "`anInt361` int(11) NOT NULL," +
58 "`anInt362` int(11) NOT NULL," +
59 "`item_id` int(11) NOT NULL COMMENT 'anInt363'," +
60 "`anInt366` int(11) NOT NULL," +
61 "`anInt367` int(11) NOT NULL," +
62 "`anInt368` int(11) NOT NULL," +
63 "`anInt369` int(11) NOT NULL," +
64 "`anInt370` int(11) NOT NULL," +
65 "`anInt372` int(11) NOT NULL," +
66 "`anInt375` int(11) NOT NULL," +
67 "`members_only` bit(1) NOT NULL COMMENT 'aBoolean349'," +
68 "`aBoolean371` bit(1) NOT NULL," +
69 "`aBoolean374` bit(1) NOT NULL," +
70 "`aBoolean377` bit(1) NOT NULL," +
71 "`aByte330` int(4) NOT NULL," +
72 "`aByte378` int(4) NOT NULL," +
73 "`unique_options` text COMMENT 'aStringArray338', " +
74 "`options` text COMMENT 'aStringArray348'," +
75 "`description` text COMMENT 'aByteArray328'," +
76 "`amount_for_model_change` text COMMENT 'anIntArray376'," +
77 "`changed_model_item_id` text COMMENT 'anIntArray365'," +
78 "`original_model_colors` text COMMENT 'anIntArray364'," +
79 "`new_model_colors` text COMMENT 'anIntArray341'," +
80 "PRIMARY KEY (`id`)" +
81 ") ENGINE=MyISAM DEFAULT CHARSET=latin1;");
82 writer.query = query;
83 writer.executeUpdate();
84
85 for(int itemID = 0; itemID < 7956; itemID++) {
86 ItemDef itemDef = method212(itemID);
87 query = ("INSERT INTO item_defs VALUES(" +
88 itemID + ", \"" +
89 itemDef.name + "\", " +
90 itemDef.anInt326 + ", " +
91 itemDef.anInt327 + ", " +
92 itemDef.anInt331 + ", " +
93 itemDef.anInt332 + ", " +
94 itemDef.anInt333 + ", " +
95 itemDef.anInt334 + ", " +
96 itemDef.anInt339 + ", " +
97 itemDef.anInt340 + ", " +
98 itemDef.anInt343 + ", " +
99 itemDef.anInt345 + ", " +
100 itemDef.anInt351 + ", " +
101 itemDef.anInt353 + ", " +
102 itemDef.anInt354 + ", " +
103 itemDef.anInt355 + ", " +
104 itemDef.anInt356 + ", " +
105 itemDef.anInt357 + ", " +
106 itemDef.anInt358 + ", " +
107 itemDef.anInt359 + ", " +
108 itemDef.anInt360 + ", " +
109 itemDef.anInt361 + ", " +
110 itemDef.anInt362 + ", " +
111 itemDef.itemID + ", " +
112 itemDef.anInt366 + ", " +
113 itemDef.anInt367 + ", " +
114 itemDef.anInt368 + ", " +
115 itemDef.anInt369 + ", " +
116 itemDef.anInt370 + ", " +
117 itemDef.anInt372 + ", " +
118 itemDef.anInt375 + ", " +
119 itemDef.membersOnly + ", " +
120 itemDef.aBoolean371 + ", " +
121 itemDef.aBoolean374 + ", " +
122 itemDef.aBoolean377 + ", " +
123 itemDef.aByte330 + ", " +
124 itemDef.aByte378 + ", ");
125
126 if(itemDef.uniqueOptions != null) {
127 query += "\"";
128 for(int i = 0; i < itemDef.uniqueOptions.length; i++) {
129 query += itemDef.uniqueOptions[i] + ", ";
130 }
131 query += "\"";
132 } else {
133 query += "\"null\"";
134 }
135
136 if(itemDef.options != null) {
137 query += ", \"";
138 for(int i = 0; i < itemDef.options.length; i++) {
139 query += itemDef.options[i] + ", ";
140 }
141 query += "\"";
142 } else {
143 query += ", \"null\"";
144 }
145
146 if(itemDef.description != null) {
147 query += ", \"";
148 query += new String(itemDef.description);
149 query += "\"";
150 } else {
151 query += ", \"null\"";
152 }
153
154 if(itemDef.modelChangeAmount != null) {
155 query += ", \"";
156 for(int i = 0; i < itemDef.modelChangeAmount.length; i++) {
157 query += itemDef.modelChangeAmount[i] + ", ";
158 }
159 query += "\"";
160 } else {
161 query += ", \"null\"";
162 }
163
164 if(itemDef.model_changes != null) {
165 query += ", \"";
166 for(int i = 0; i < itemDef.model_changes.length; i++) {
167 query += itemDef.model_changes[i] + ", ";
168 }
169 query += "\"";
170 } else {
171 query += ", \"null\"";
172 }
173
174 if(itemDef.originalModelColors != null) {
175 query += ", \"";
176 for(int i = 0; i < itemDef.originalModelColors.length; i++) {
177 query += itemDef.originalModelColors[i] + ", ";
178 }
179 query += "\"";
180 } else {
181 query += ", \"null\"";
182 }
183
184 if(itemDef.modifiedModelColors != null) {
185 query += ", \"";
186 for(int i = 0; i < itemDef.modifiedModelColors.length; i++) {
187 query += itemDef.modifiedModelColors[i] + ", ";
188 }
189 query += "\"";
190 } else {
191 query += ", \"null\"";
192 }
193
194 query += ");";
195 //System.out.println(query);
196
197 writer.query = query;
198 writer.executeUpdate();
199 }
200 } catch(Exception error) {
201 error.printStackTrace();
202 }
203 }