当前位置: 首页>>代码示例>>Java>>正文


Java SQLError.createSQLException方法代码示例

本文整理汇总了Java中com.mysql.jdbc.SQLError.createSQLException方法的典型用法代码示例。如果您正苦于以下问题:Java SQLError.createSQLException方法的具体用法?Java SQLError.createSQLException怎么用?Java SQLError.createSQLException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mysql.jdbc.SQLError的用法示例。


在下文中一共展示了SQLError.createSQLException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setShardKey

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setShardKey(String shardKey) throws SQLException {
    ensureNoTransactionInProgress();

    this.currentConnection = null;

    if (shardKey != null) {
        if (this.serverGroupName != null) {
            throw SQLError.createSQLException("Shard key cannot be provided when server group is chosen directly.", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    null, getExceptionInterceptor(), this);
        } else if (this.shardTable == null) {
            throw SQLError.createSQLException("Shard key cannot be provided without a shard table.", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, null,
                    getExceptionInterceptor(), this);
        }

        // sharded group selection
        setCurrentServerGroup(this.shardMapping.getGroupNameForKey(shardKey));
    } else if (this.shardTable != null) {
        setCurrentServerGroup(this.shardMapping.getGlobalGroupName());
    }
    this.shardKey = shardKey;
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:22,代码来源:FabricMySQLConnectionProxy.java

示例2: setNClob

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
/**
 * JDBC 4.0 Set a NCLOB parameter.
 * 
 * @param parameterIndex
 *            the first parameter is 1, the second is 2, ...
 * @param reader
 *            the java reader which contains the UNICODE data
 * @param length
 *            the number of characters in the stream
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
    // can't take if characterEncoding isn't utf8
    if (!this.charEncoding.equalsIgnoreCase("UTF-8") && !this.charEncoding.equalsIgnoreCase("utf8")) {
        throw SQLError.createSQLException("Can not call setNClob() when connection character set isn't UTF-8", getExceptionInterceptor());
    }

    checkClosed();

    if (reader == null) {
        setNull(parameterIndex, java.sql.Types.NCLOB);
    } else {
        BindValue binding = getBinding(parameterIndex, true);
        setType(binding, MysqlDefs.FIELD_TYPE_BLOB);

        binding.value = reader;
        binding.isNull = false;
        binding.isLongData = true;

        if (this.connection.getUseStreamLengthsInPrepStmts()) {
            binding.bindLength = length;
        } else {
            binding.bindLength = -1;
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:JDBC4ServerPreparedStatement.java

示例3: setBigDecimal

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setBigDecimal(parameterName, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:12,代码来源:CallableStatementWrapper.java

示例4: getNClob

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
/**
 * @see java.sql.CallableStatement#getNClob(java.lang.String)
 */
public NClob getNClob(String parameterName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getNClob(parameterName);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:17,代码来源:JDBC4CallableStatementWrapper.java

示例5: setDate

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setDate(String parameterName, Date x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setDate(parameterName, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:12,代码来源:CallableStatementWrapper.java

示例6: executeLargeUpdate

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
/**
 * JDBC 4.2
 * Same as {@link #executeUpdate(String, int[])} but returns long instead of int.
 */
public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((StatementImpl) this.wrappedStmt).executeLargeUpdate(sql, columnIndexes);
        }

        throw SQLError.createSQLException("Statement already closed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return -1; // we actually never get here, but the compiler can't figure that out
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:StatementWrapper.java

示例7: setTime

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setTime(parameterIndex, x, cal);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:12,代码来源:PreparedStatementWrapper.java

示例8: getTimestamp

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getTimestamp(parameterName, cal);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
    return null;
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:13,代码来源:CallableStatementWrapper.java

示例9: getRowId

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public RowId getRowId(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getRowId(parameterIndex);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:14,代码来源:JDBC4CallableStatementWrapper.java

示例10: setBlob

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setBlob(parameterIndex, inputStream);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:12,代码来源:JDBC4PreparedStatementWrapper.java

示例11: execute

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return this.wrappedStmt.execute(sql, columnIndexes);
        }

        throw SQLError.createSQLException("Statement already closed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return false; // we actually never get here, but the compiler can't figure that out
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:14,代码来源:StatementWrapper.java

示例12: setString

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setString(int parameterIndex, String x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setString(parameterIndex, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:12,代码来源:PreparedStatementWrapper.java

示例13: setDate

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setDate(parameterIndex, x, cal);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:12,代码来源:PreparedStatementWrapper.java

示例14: setNString

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setNString(String parameterName, String value) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setNString(parameterName, value);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:12,代码来源:JDBC4CallableStatementWrapper.java

示例15: setCursorName

import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public void setCursorName(String name) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            this.wrappedStmt.setCursorName(name);
        } else {
            throw SQLError.createSQLException("Statement already closed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:12,代码来源:StatementWrapper.java


注:本文中的com.mysql.jdbc.SQLError.createSQLException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。