Revision 28
Added by Matt Jones over 24 years ago
DBSimpleQuery.java | ||
---|---|---|
34 | 34 |
} else { |
35 | 35 |
try { |
36 | 36 |
|
37 |
String query = args[1];
|
|
37 |
String query = args[0];
|
|
38 | 38 |
String user = args[1]; |
39 | 39 |
String password = args[2]; |
40 | 40 |
String dbstring = null; |
... | ... | |
59 | 59 |
nodeid = ((Long)rootlist.nextElement()).longValue(); |
60 | 60 |
result.append(" <nodeid>").append(nodeid).append("</nodeid>\n"); |
61 | 61 |
} |
62 |
result.append("</resultset>\n");
|
|
62 |
result.append("</resultset>"); |
|
63 | 63 |
|
64 | 64 |
System.out.println(result); |
65 | 65 |
|
... | ... | |
104 | 104 |
try { |
105 | 105 |
pstmt = |
106 | 106 |
conn.prepareStatement("SELECT nodeid " + |
107 |
"FROM xml_nodes WHERE nodedata LIKE 'Value1'"); |
|
108 |
//"FROM xml_nodes WHERE nodedata LIKE ?"); |
|
107 |
"FROM xml_nodes WHERE nodedata LIKE ?"); |
|
109 | 108 |
// Bind the values to the query |
110 |
//pstmt.setString(1, query);
|
|
109 |
pstmt.setString(1, query); |
|
111 | 110 |
|
112 | 111 |
pstmt.execute(); |
113 | 112 |
try { |
src/edu/ucsb/nceas/metacat/DBSimpleQuery.java | ||
---|---|---|
34 | 34 |
} else { |
35 | 35 |
try { |
36 | 36 |
|
37 |
String query = args[1];
|
|
37 |
String query = args[0];
|
|
38 | 38 |
String user = args[1]; |
39 | 39 |
String password = args[2]; |
40 | 40 |
String dbstring = null; |
... | ... | |
59 | 59 |
nodeid = ((Long)rootlist.nextElement()).longValue(); |
60 | 60 |
result.append(" <nodeid>").append(nodeid).append("</nodeid>\n"); |
61 | 61 |
} |
62 |
result.append("</resultset>\n");
|
|
62 |
result.append("</resultset>"); |
|
63 | 63 |
|
64 | 64 |
System.out.println(result); |
65 | 65 |
|
... | ... | |
104 | 104 |
try { |
105 | 105 |
pstmt = |
106 | 106 |
conn.prepareStatement("SELECT nodeid " + |
107 |
"FROM xml_nodes WHERE nodedata LIKE 'Value1'"); |
|
108 |
//"FROM xml_nodes WHERE nodedata LIKE ?"); |
|
107 |
"FROM xml_nodes WHERE nodedata LIKE ?"); |
|
109 | 108 |
// Bind the values to the query |
110 |
//pstmt.setString(1, query);
|
|
109 |
pstmt.setString(1, query); |
|
111 | 110 |
|
112 | 111 |
pstmt.execute(); |
113 | 112 |
try { |
Makefile | ||
---|---|---|
47 | 47 |
java -cp $(CPATH) DBReader 31 $(USER) $(PW) |
48 | 48 |
|
49 | 49 |
qtest: |
50 |
java -cp $(CPATH) DBSimpleQuery \'Value1\' $(USER) $(PW)
|
|
50 |
java -cp $(CPATH) DBSimpleQuery Value1 $(USER) $(PW)
|
|
51 | 51 |
|
52 |
qtest1: |
|
53 |
java -cp $(CPATH) DBSimpleQuery lakename $(USER) $(PW) |
|
54 |
|
|
52 | 55 |
clean: |
53 | 56 |
-rm -f *.class Log |
Also available in: Unified diff
Finished modifications to DBSimpleQuery.java to allow simple, free text searching on element and attribute content