Last change
on this file since 7305 was 5948, checked in by cs025, 21 years ago |
Extended SQL Support
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.1 KB
|
Line | |
---|
1 | package org.greenstone.gsdl3.gs3build.database;
|
---|
2 |
|
---|
3 | public class GS3SQLUpdate extends GS3SQLAction
|
---|
4 | { GS3SQLWhere where;
|
---|
5 |
|
---|
6 | public GS3SQLUpdate(String table)
|
---|
7 | { super(table);
|
---|
8 | this.where = null;
|
---|
9 | }
|
---|
10 |
|
---|
11 | public void setWhere(GS3SQLWhere where)
|
---|
12 | { this.where = where;
|
---|
13 | }
|
---|
14 |
|
---|
15 | public String toString()
|
---|
16 | {
|
---|
17 | StringBuffer reply = new StringBuffer();
|
---|
18 | reply.append("UPDATE ");
|
---|
19 | reply.append(this.table);
|
---|
20 | reply.append(" SET ");
|
---|
21 | for (int i = 0; i < this.values.size(); i ++)
|
---|
22 | { GS3SQLValue value = (GS3SQLValue) this.values.get(i);
|
---|
23 | if (i > 0)
|
---|
24 | reply.append(", ");
|
---|
25 | reply.append(value.field);
|
---|
26 | reply.append("=");
|
---|
27 | if (value.getType() == null ||
|
---|
28 | value.getType().equals(GS3SQLField.VARCHAR_TYPE))
|
---|
29 | {
|
---|
30 | reply.append("\"");
|
---|
31 | }
|
---|
32 | reply.append(value.value);
|
---|
33 | if (value.getType() == null ||
|
---|
34 | value.getType().equals(GS3SQLField.VARCHAR_TYPE))
|
---|
35 | {
|
---|
36 | reply.append("\"");
|
---|
37 | }
|
---|
38 | }
|
---|
39 | if (this.where != null)
|
---|
40 | { reply.append(" WHERE ");
|
---|
41 | reply.append(where.toString());
|
---|
42 | }
|
---|
43 | reply.append(";");
|
---|
44 | return reply.toString();
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.