# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: pgjdbc/org/postgresql/core/Utils.java
--- pgjdbc/org/postgresql/core/Utils.java Base (1.6)
+++ pgjdbc/org/postgresql/core/Utils.java Locally Modified (Based On 1.6)
@@ -12,6 +12,7 @@
package org.postgresql.core;
import java.sql.SQLException;
+import java.util.ArrayList;
import org.postgresql.util.GT;
import org.postgresql.util.PSQLException;
@@ -146,4 +147,65 @@
return sbuf;
}
+
+
+ /**
+ * Return an ArrayList of Strings representing the table identifiers, quoted or not.
+ * Any number of ids may exists; no attempt is made to validate the maximum number of IDs.
+ * @param sql INSERT INTO stmt
+ * @param start - end-index of the keyword (INTO, FROM, UPDATE etc) preceding
+ * the table reference, after which the catalog.schema.table
identifiers appear
+ * @return ArrayList who first element is the left-most identifiers,
+ * and right-most is the table name.
+ * @author Ken Johanon - ken2006 at onnet.cc
+ */
+ public static ArrayList getTableIdentifiers(String sql, int start)
+ {
+ if (start<0)//assertion
+ throw new IllegalArgumentException("getInsertIds: invalid start index: -1");
+ //advance to first alnum
+ for (; start2)
+ {
+ sb.append('"');
+ Utils.appendEscapedLiteral(sb,args.get(argLen-3).toString(), standardConformingStrings);
+ sb.append('"');
+ sb.append('.');
+ }
+ if (argLen>1)
+ {
+ sb.append('"');
+ Utils.appendEscapedLiteral(sb,args.get(argLen-2).toString(), standardConformingStrings);
+ sb.append('"');
+ sb.append('.');
+ }
+ sb.append('"');
+ Utils.appendEscapedLiteral(sb,args.get(argLen-1).toString(), standardConformingStrings);
+ sb.append('"');
+ String tblRef = sb.toString();
+ String pgCols =
+ "SELECT attname "+
+ "FROM pg_attribute "+
+ "WHERE attrelid = '"+tblRef+"'::regclass "+
+ "AND attnum > 0 "+
+ "AND NOT attisdropped "+
+ "ORDER BY attnum ASC";
+ String[] columnNames = new String[columnIndexes.length];
+ boolean isOutOfBoundsEx = false;
+ ResultSet rs = null;
+ try {
+ rs = this.executeQuery(pgCols);
+ int j=0;
+ try {
+ for (; j