Public Member Functions | |
Table (String name, int autoColumn, String[] columns) | |
Public Attributes | |
String | name |
int | autoColumn |
String[] | columns |
String | select |
String | update |
String | delete |
String | insert |
Definition at line 7 of file TableEditor.java.
|
Definition at line 13 of file TableEditor.java. References insert, select, and update. 00014 { 00015 this.name = name; 00016 this.autoColumn = autoColumn; 00017 this.columns = columns; 00018 00019 delete = "DELETE FROM " + name + " WHERE oid = ?;\n"; 00020 00021 StringBuffer select = new StringBuffer("SELECT oid"); 00022 StringBuffer insert = new StringBuffer("INSERT INTO " + name + " ("); 00023 StringBuffer insertLast = new StringBuffer("VALUES ("); 00024 StringBuffer update = new StringBuffer("UPDATE " + name + " SET "); 00025 00026 boolean first = true, firstna = true; 00027 for (int i = 0; i < columns.length; ++i) 00028 { 00029 if (first) first = false; else update.append(", "); 00030 update.append(columns[i]); 00031 update.append(" = ?"); 00032 00033 select.append(", "); 00034 select.append(columns[i]); 00035 00036 if (autoColumn != i) 00037 { 00038 if (firstna) 00039 firstna = false; 00040 else 00041 { 00042 insert.append(", "); 00043 insertLast.append(", "); 00044 } 00045 insert.append(columns[i]); 00046 insertLast.append("?"); 00047 } 00048 } 00049 insert.append(") "); 00050 insert.append(insertLast); 00051 insert.append(")"); 00052 select.append(" FROM " + name); 00053 update.append(" WHERE oid = ?"); 00054 00055 this.update = update.toString(); 00056 this.select = select.toString(); 00057 this.insert = insert.toString(); 00058 }
|
|
Definition at line 10 of file TableEditor.java. |
|
Definition at line 11 of file TableEditor.java. |
|
Definition at line 12 of file TableEditor.java. |
|
Definition at line 12 of file TableEditor.java. |
|
Definition at line 9 of file TableEditor.java. |
|
Definition at line 12 of file TableEditor.java. |
|
Definition at line 12 of file TableEditor.java. |