Project

General

Profile

Revision 3989c417

ID3989c4176b6f4c0cbb0dc7e8bb0e581490243c3a
Parent 42b7ab89
Child c9369086

Added by Andreas Müller over 3 years ago

ref #6661 some final updates for addInitials to person (length = 80 + handle ' in updatescript)

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Person.java
95 95
    @XmlElement(name = "FirstName")
96 96
    @Field
97 97
    @NullOrNotEmpty
98
    @Column(length=50)
98
    @Column(length=80)
99 99
    private String initials;
100 100

  
101 101
    @XmlElement(name = "LastName")
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v41_47/InitialsUpdater.java
69 69

  
70 70
            ResultSet rs = datasource.executeQuery(sqlSelectInitials);
71 71
            while (rs.next()){
72
                handleSingel(datasource, formatter, sqlRemoveFirstname, rs, monitor, result);
72
                handleSingle(datasource, formatter, sqlRemoveFirstname, rs, monitor, result);
73 73
            }
74 74
        } catch (Exception e) {
75 75
            String message = e.getMessage();
......
90 90
     * @param monitor
91 91
     * @throws SQLException
92 92
     */
93
    private void handleSingel(ICdmDataSource datasource, PersonDefaultCacheStrategy formatter,
93
    private void handleSingle(ICdmDataSource datasource, PersonDefaultCacheStrategy formatter,
94 94
            String sqlRemoveFirstname, ResultSet rs, IProgressMonitor monitor, SchemaUpdateResult result) throws SQLException {
95 95
        try {
96 96
            Integer id = rs.getInt("id");
......
114 114
                firstnameSql = " firstname ";
115 115
                initialsSql = initialsForced;
116 116
            }
117
            if (initialsSql!= null){
118
                initialsSql = initialsSql.replace("'", "\\'");
119
            }
117 120

  
118 121
            String sql = String.format(sqlRemoveFirstname, firstnameSql, initialsSql, id);
119 122
            //remove old relationship
......
121 124
        } catch (Exception e) {
122 125
            String message = e.getMessage();
123 126
            monitor.warning(message, e);
124
            result.addException(e, message, this, "invoke");
127
            result.addException(e, message, this, "handleSingle");
125 128
        }
126 129
    }
127 130

  
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v41_47/SchemaUpdater_41_47.java
184 184
        stepName = "Add initials to AgentBase";
185 185
        tableName = "AgentBase";
186 186
        newColumnName = "initials";
187
        int length = 50;
187
        int length = 80;
188 188
        step = ColumnAdder.NewStringInstance(stepName, tableName, newColumnName, length, INCLUDE_AUDIT);
189 189
        stepList.add(step);
190 190

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)