@Override public boolean isConcurrentUpdateException(Throwable t) { // recent versions of the Oracle JDBC driver throw a SQLException // whose cause, an OracleDatabaseException, is not itself a SQLException Throwable cause; while ((cause = t.getCause()) != null && cause instanceof SQLException) { t = cause; } switch (getOracleErrorCode(t)) { case 1: // ORA-00001: unique constraint violated case 60: // ORA-00060: deadlock detected while waiting for resource case 1403: // ORA-01403: no data found (for MERGE statements) case 2291: // ORA-02291: integrity constraint ... violated - parent key not found return true; } return false; }
case STRING: if (type.isUnconstrained()) { return jdbcInfo("NVARCHAR2(2000)", Types.VARCHAR); } else if (type.isClob() || type.length > 2000) { return jdbcInfo("NCLOB", Types.CLOB); } else { return jdbcInfo("NVARCHAR2(%d)", type.length, Types.VARCHAR); return jdbcInfo("NUMBER(1,0)", Types.BIT); case LONG: return jdbcInfo("NUMBER(19,0)", Types.BIGINT); case DOUBLE: return jdbcInfo("DOUBLE PRECISION", Types.DOUBLE); case TIMESTAMP: return jdbcInfo("TIMESTAMP", Types.TIMESTAMP); case BLOBID: return jdbcInfo("VARCHAR2(250)", Types.VARCHAR); case BLOB: return jdbcInfo("BLOB", Types.BLOB); switch (idType) { case VARCHAR: return jdbcInfo("VARCHAR2(36)", Types.VARCHAR); case SEQUENCE: return jdbcInfo("NUMBER(10,0)", Types.INTEGER); default: case SYSNAME: case SYSNAMEARRAY:
switch (column.getJdbcType()) { case Types.VARCHAR: return getFromResultSetString(rs, index, column); case Types.CLOB: return rs.getDouble(index); case Types.TIMESTAMP: return getFromResultSetTimestamp(rs, index, column); case Types.BLOB: return rs.getBytes(index);
throw new NuxeoException("Unknown id type: '" + idt + "'"); xaErrorLogger = newXAErrorLogger(); initReflection();
@Override public FulltextMatchInfo getFulltextScoredMatchInfo(String fulltextQuery, String indexName, int nthMatch, Column mainColumn, Model model, Database database) { String indexSuffix = model.getFulltextIndexSuffix(indexName); Table ft = database.getTable(Model.FULLTEXT_TABLE_NAME); Column ftMain = ft.getColumn(Model.MAIN_KEY); Column ftColumn = ft.getColumn(Model.FULLTEXT_FULLTEXT_KEY + indexSuffix); String score = String.format("SCORE(%d)", nthMatch); String nthSuffix = nthMatch == 1 ? "" : String.valueOf(nthMatch); FulltextMatchInfo info = new FulltextMatchInfo(); if (nthMatch == 1) { // Need only one JOIN involving the fulltext table info.joins = Collections.singletonList(new Join(Join.INNER, ft.getQuotedName(), null, null, ftMain.getFullQuotedName(), mainColumn.getFullQuotedName())); } info.whereExpr = String.format("CONTAINS(%s, ?, %d) > 0", ftColumn.getFullQuotedName(), nthMatch); info.whereExprParam = fulltextQuery; info.scoreExpr = String.format("(%s / 100)", score); info.scoreAlias = openQuote() + "_nxscore" + nthSuffix + closeQuote(); info.scoreCol = new Column(mainColumn.getTable(), null, ColumnType.DOUBLE, null); return info; }
} while (rs.next()); String body = StringUtils.join(lines, ' '); if (normalizeString(procCreate).contains(normalizeString(body))) { logger.log(" -> exists, unchanged"); return Collections.emptyList();
properties.put("usersSeparator", getUsersSeparator()); properties.put("everyone", SecurityConstants.EVERYONE); return properties;