Project

General

Profile

« Previous | Next » 

Revision 2504

Added by sgarg almost 19 years ago

Making changes in postgres db upgrade script such that instead of JDBC, SQL is used for updating the DB

View differences:

src/upgrade_db_to_1_5.java
111 111

  
112 112
                    count++;
113 113
                    if (count%5 == 0) {
114
                        System.out.print(count + "...");
114
                        System.out.println(count + "...");
115 115
                    }
116 116
                }
117 117
            } catch (NumberFormatException nfe) {
......
136 136
            DriverManager.registerDriver(new @dbDriver@());
137 137
            sqlca = DriverManager.getConnection(url, user, password);
138 138

  
139
            // Upgrade the xml_nodes table
140
            upgrade_xml_nodes(sqlca);
141

  
139
            // Upgrade the xml_nodes table only if it oracle
140
	    if (database.equals("oracle")) {
141
            	upgrade_xml_nodes(sqlca);
142
	    }
142 143
            // Close the connection...
143 144
            sqlca.close();
144 145
        } catch (SQLException ex) {
src/upgrade-db-to-1.5-postgres.sql
116 116
);
117 117

  
118 118
CREATE SEQUENCE xml_queryresult_id_seq;
119
     
120 119

  
120
ALTER TABLE xml_nodes ADD nodedatanumerical FLOAT8;
121

  
122
UPDATE xml_nodes SET nodedatanumerical = to_number(nodedata, '999999999999999999999999999D9999999999999999999999999999')
123
WHERE nodedata IS NOT NULL AND UPPER(nodedata) = LOWER(nodedata)
124
AND (TRIM(REPLACE(nodedata,'\n','')) SIMILAR TO '(^(-|[+]|[0-9])[0-9]*[.][0-9]*)'
125
OR TRIM(REPLACE(nodedata,'\n','')) SIMILAR TO '^(.)[0-9]+'
126
OR TRIM(REPLACE(nodedata,'\n','')) SIMILAR TO '^(-|[+]|[0-9])[0-9]*')
127
AND TRIM(REPLACE(nodedata,'\n','')) not SIMILAR TO '(-|[+])';
128

  

Also available in: Unified diff