-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccessor.java
More file actions
623 lines (538 loc) · 20.7 KB
/
Accessor.java
File metadata and controls
623 lines (538 loc) · 20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;;
public class Accessor {
private static Accessor singletonAccessor=null;
private Connection con=null;
Statement stat=null ;
// ñêðûòûé êîíñòðóêòîð ïðèíèìàåò äðàéâåð è àäðåñ ÁÄ
// âûáðàñûâàåò èñêëþ÷åíèå Exception
private Accessor() throws Exception {
String server = "DESKTOP-VC16KFA\\SQLEXPRESS:1433";
String urlDatabase ="animal";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// ôîðìèðîâàíèå ñòðîêè ïîäêëþ÷åíèÿ
//String connectionString = "jdbc:sqlserver://localhost;databaseName="+urlDatabase+";integratedSecurity=true;";
//String connectionString = "jdbc:sqlserver://"+server+";databaseName="+urlDatabase+";integratedSecurity=false;";
String connectionString = "jdbc:sqlserver://"+server+";databaseName="+urlDatabase+";integratedSecurity=true;";
// ïîäêëþ÷åíèå ê ÁÄ
con = DriverManager.getConnection(connectionString);
stat = con.createStatement();
}
// îòêðûòûé ìåòîä ïîëó÷åíèÿ åäèíñòâåííîãî ýêçåìïëÿðà àêñåñîðà
// âûáðàñûâàåò èñêëþ÷åíèå Exception
public static Accessor getInstance()
throws Exception {
if (singletonAccessor == null)
singletonAccessor = new Accessor();
return singletonAccessor;
}
//çàêðûâàåò ñîåäèíåíèå ñ ÁÄ
public void closeConnection()
throws SQLException {
if (con!= null)
con.close();
}
void propertyStatement()throws SQLException
{
//ïðîâåðêà, ðåàëèçóåò ëè äðàéâåð JDBC òîò èëè èíîé òèï âûáîðêè
//TYPE_FORWARD_ONLY - êóðñîð âûáîðêè ïåðåìåùàåòñÿ òîëüêî âïåðåä
//TYPE_SCROLL_INSENSITIVE - êóðñîð ïåðåìåùàåòñÿ â îáåèõ íàïðàâëåíèÿõ, âûáîðêà íå èçìåíÿåòñÿ
//TYPE_SCROLL_SENSITIVE - êóðñîð ïåðåìåùàåòñÿ â îáåèõ íàïðàâëåíèÿõ, âûáîðêà èçìåíÿåòñÿ ïðè èçìåíåíèè ñòðîê â ÁÄ
boolean ro=con.getMetaData().supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY);
System.out.println("TYPE_FORWARD_ONLY - "+ro);
ro=con.getMetaData().supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
System.out.println("TYPE_SCROLL_INSENSITIVE - "+ro);
ro=con.getMetaData().supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
System.out.println("TYPE_SCROLL_SENSITIVE - "+ro);
//ïðîâåðêà, ïîääåðæèâàåò ëè äðàéâåð JDBC òîò èëè èíîé ðåæèì èçìåíåíèÿ âûáîðêè
//CONCUR_READ_ONLY - âûáîðêó íåëüçÿ èçìåíÿòü
//CONCUR_UPDATABLE - âûáîðêó ìîæíî èçìåíÿòü
ro=con.getMetaData().supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
System.out.println("CONCUR_READ_ONLY - "+ro);
ro=con.getMetaData().supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
System.out.println("CONCUR_UPDATABLE - "+ro);
}
/*________________________èè 4 êóðñ _____________________*/
public Animal[] getAnimal(Animal[] animal) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM animal");
int i = 0;
while (rs.next()) {
animal[i]=new Animal();
animal[i].ID=rs.getInt("ID");
i++;
}
rs.close();
return animal;
}
public void getArtiodactyls(List<Artiodactyls> artiodactyls) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Artiodactyls");
int i = 0;
while (rs.next()) {
artiodactyls.add(i,new Artiodactyls());
artiodactyls.get(i) .ID = rs.getInt("Id");
artiodactyls.get(i) .food = rs.getString("food");
artiodactyls.get(i) .habitat = rs.getString("Habitat");
artiodactyls.get(i) .reproduction = rs.getString("Reproduction");
artiodactyls.get(i) .locomotion = rs.getString("Locomotion");
artiodactyls.get(i) .lifestyle = rs.getString("Lifestyle");
artiodactyls.get(i) .average_age = rs.getInt("Average_age");
artiodactyls.get(i) .type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
}
/********************************************************************************/
public Cetaceans[] getCetaceans(Cetaceans[] cetaceans) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Cetaceans");
int i=0;
while (rs.next()) {
cetaceans[i]=new Cetaceans();
cetaceans[i].ID = rs.getInt("Id");
cetaceans[i].food = rs.getString("food");
cetaceans[i].habitat = rs.getString("Habitat");
cetaceans[i].reproduction = rs.getString("Reproduction");
cetaceans[i].locomotion = rs.getString("Locomotion");
cetaceans[i].lifestyle = rs.getString("Lifestyle");
cetaceans[i].average_age = rs.getInt("Average_age");
cetaceans[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return cetaceans;
}
/*******************************************************************************/
public Insectivores[] getInsectivores(Insectivores[] insectivores) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Insectivores");
int i=0;
while (rs.next()) {
insectivores[i]=new Insectivores();
insectivores[i].ID = rs.getInt("Id");
insectivores[i].food = rs.getString("food");
insectivores[i].habitat = rs.getString("Habitat");
insectivores[i].reproduction = rs.getString("Reproduction");
insectivores[i].locomotion = rs.getString("Locomotion");
insectivores[i].lifestyle = rs.getString("Lifestyle");
insectivores[i].average_age = rs.getInt("Average_age");
insectivores[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return insectivores;
}
/******************************************************************/
public Primates[] getPrimates(Primates[] primates) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Primates");
int i=0;
while (rs.next()) {
primates[i]=new Primates();
primates[i].ID = rs.getInt("Id");
primates[i].food = rs.getString("food");
primates[i].habitat = rs.getString("Habitat");
primates[i].reproduction = rs.getString("Reproduction");
primates[i].locomotion = rs.getString("Locomotion");
primates[i].lifestyle = rs.getString("Lifestyle");
primates[i].average_age = rs.getInt("Average_age");
primates[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return primates;
}
/****************************************************************************/
public Lizard[] getLizard(Lizard[] lizard) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Primates");
int i=0;
while (rs.next()) {
lizard[i]=new Lizard();
lizard[i].ID = rs.getInt("Id");
lizard[i].food = rs.getString("food");
System.out.println(lizard[i].food+"\n");
lizard[i].habitat = rs.getString("Habitat");
lizard[i].reproduction = rs.getString("Reproduction");
lizard[i].locomotion = rs.getString("Locomotion");
lizard[i].lifestyle = rs.getString("Lifestyle");
lizard[i].average_age = rs.getInt("Average_age");
lizard[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return lizard;
}
public Lagomorphs[] getLagomorphs(Lagomorphs[] lagomorphs) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Lagomorphs");
int i=0;
while (rs.next()) {
lagomorphs[i]=new Lagomorphs();
lagomorphs[i].ID = rs.getInt("Id");
lagomorphs[i].food = rs.getString("food");
lagomorphs[i].habitat = rs.getString("Habitat");
lagomorphs[i].reproduction = rs.getString("Reproduction");
lagomorphs[i].locomotion = rs.getString("Locomotion");
lagomorphs[i].lifestyle = rs.getString("Lifestyle");
lagomorphs[i].average_age = rs.getInt("Average_age");
lagomorphs[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return lagomorphs;
}
public Proboscis[] getProboscis(Proboscis[] proboscis) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Proboscis");
int i=0;
while (rs.next()) {
proboscis[i]=new Proboscis();
proboscis[i].ID = rs.getInt("Id");
proboscis[i].food = rs.getString("food");
proboscis[i].habitat = rs.getString("Habitat");
proboscis[i].reproduction = rs.getString("Reproduction");
proboscis[i].locomotion = rs.getString("Locomotion");
proboscis[i].lifestyle = rs.getString("Lifestyle");
proboscis[i].average_age = rs.getInt("Average_age");
proboscis[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return proboscis;
}
public Rodents[] getRodents(Rodents[] rodents) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Rodents");
int i=0;
while (rs.next()) {
rodents[i]=new Rodents();
rodents[i].ID = rs.getInt("Id");
rodents[i].food = rs.getString("food");
rodents[i].habitat = rs.getString("Habitat");
rodents[i].reproduction = rs.getString("Reproduction");
rodents[i].locomotion = rs.getString("Locomotion");
rodents[i].lifestyle = rs.getString("Lifestyle");
rodents[i].average_age = rs.getInt("Average_age");
rodents[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return rodents;
}
public Edentulous[] getEdentulous(Edentulous[] edentulous) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Edentulous");
int i=0;
while (rs.next()) {
edentulous[i]=new Edentulous();
edentulous[i].ID = rs.getInt("Id");
edentulous[i].food = rs.getString("food");
edentulous[i].habitat = rs.getString("Habitat");
edentulous[i].reproduction = rs.getString("Reproduction");
edentulous[i].locomotion = rs.getString("Locomotion");
edentulous[i].lifestyle = rs.getString("Lifestyle");
edentulous[i].average_age = rs.getInt("Average_age");
edentulous[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return edentulous;
}
public Pinnipeds[] getPinnipeds(Pinnipeds[] pinnipeds) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Pinnipeds");
int i=0;
while (rs.next()) {
pinnipeds[i]=new Pinnipeds();
pinnipeds[i].ID = rs.getInt("Id");
pinnipeds[i].food = rs.getString("food");
pinnipeds[i].habitat = rs.getString("Habitat");
pinnipeds[i].reproduction = rs.getString("Reproduction");
pinnipeds[i].locomotion = rs.getString("Locomotion");
pinnipeds[i].lifestyle = rs.getString("Lifestyle");
pinnipeds[i].average_age = rs.getInt("Average_age");
pinnipeds[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return pinnipeds;
}
public Ardvarks[] getArdvarks(Ardvarks[] ardvarks) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Ardvarks");
int i=0;
while (rs.next()) {
ardvarks[i]=new Ardvarks();
ardvarks[i].ID = rs.getInt("Id");
ardvarks[i].food = rs.getString("food");
ardvarks[i].habitat = rs.getString("Habitat");
ardvarks[i].reproduction = rs.getString("Reproduction");
ardvarks[i].locomotion = rs.getString("Locomotion");
ardvarks[i].lifestyle = rs.getString("Lifestyle");
ardvarks[i].average_age = rs.getInt("Average_age");
ardvarks[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return ardvarks;
}
public Predatory[] getPredatory(Predatory[] predatory) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Predatory");
int i=0;
while (rs.next()) {
predatory[i]=new Predatory();
predatory[i].ID = rs.getInt("Id");
predatory[i].food = rs.getString("food");
predatory[i].habitat = rs.getString("Habitat");
predatory[i].reproduction = rs.getString("Reproduction");
predatory[i].locomotion = rs.getString("Locomotion");
predatory[i].lifestyle = rs.getString("Lifestyle");
predatory[i].average_age = rs.getInt("Average_age");
predatory[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return predatory;
}
public OddToedUngulates[] getOddToedUngulates(OddToedUngulates[] oddToedUngulates) throws SQLException {
ResultSet rs = stat.executeQuery("SELECT * FROM Odd_toed_ungulates");
int i=0;
while (rs.next()) {
oddToedUngulates[i]=new OddToedUngulates();
oddToedUngulates[i].ID = rs.getInt("Id");
oddToedUngulates[i].food = rs.getString("food");
oddToedUngulates[i].habitat = rs.getString("Habitat");
oddToedUngulates[i].reproduction = rs.getString("Reproduction");
oddToedUngulates[i].locomotion = rs.getString("Locomotion");
oddToedUngulates[i].lifestyle = rs.getString("Lifestyle");
oddToedUngulates[i].average_age = rs.getInt("Average_age");
oddToedUngulates[i].type = rs.getString("Type_");
//storage[i]=addInfoStorage(id,storage[i]);
i++;
}
rs.close();
return oddToedUngulates;
}
public boolean PinnipedsGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Pinnipeds\n" +
"where '"+food+"'='carnivores' and \n" +
"'"+habitat+"'='terrestrial-aquatic'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='floating' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"'= '25' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean EdentulousGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Edentulous\n" +
"where '"+food+"' ='omnivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '20' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean CetaceansGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Cetaceans\n" +
"where '"+food+"' ='carnivores' and \n" +
"'"+habitat+"'='aquatic'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='floating' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '60' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean LagomorphsGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Lagomorphs\n" +
"where '"+food+"' ='hebivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='floating' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '6' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean PrimatesGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Primates\n" +
"where '"+food+"' ='hebivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='climbing' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '40' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean Odd_toed_Get(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Odd_toed_ungulates\n" +
"where '"+food+"'='hebivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '25' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean RodentsGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Rodents\n" +
"where '"+food+"'='hebivores' and \n" +
"'"+habitat+"'='underground'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '2' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean InsectivoresGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Insectivores\n" +
"where '"+food+"'='carnivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='nocturnal' and\n" +
"'"+average_age+"' = '6' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean LizardsGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Lizards\n" +
"where '"+food+"'='hebivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='oviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '7' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean ProboscisGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Proboscis\n" +
"where '"+food+"'='hebivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '70' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean ArdvarksGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Ardvarks\n" +
"where '"+food+"'='omnivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='oviparous' and \n" +
"'"+locomotion+"'='running' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '20' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
public boolean PredatoryGet(String food,
String habitat,
String reproduction,
String locomotion,
String lifestyle,
String average_age,
String type) throws SQLException {
ResultSet queryResponse = stat.executeQuery("SELECT *\n" +
"FROM Predatory\n" +
"where '"+food+"'='carnivores' and \n" +
"'"+habitat+"'='terrestrial'and\n" +
"'"+reproduction+"'='viviparous' and \n" +
"'"+locomotion+"'='floating' and \n" +
"'"+lifestyle+"'='daytime' and\n" +
"'"+average_age+"' = '10' and \n" +
"'"+type+"'='placental'");
return queryResponse.next();
}
}