Java Code Examples for com.microsoft.sqlserver.jdbc.SQLServerDataTable

The following examples show how to use com.microsoft.sqlserver.jdbc.SQLServerDataTable. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: elastic-db-tools-for-java   Source File: MultiShardStatement.java    License: MIT License 6 votes vote down vote up
@Override
public void run() {
    SQLServerPreparedStatement stmt = (SQLServerPreparedStatement) statement;
    try {
        switch (type) {
            // TODO: Add all types
            case Types.STRUCT:
                if (objects.length == 2) {
                    stmt.setStructured(index, (String) objects[0], (SQLServerDataTable) objects[1]);
                }
                break;
            default:
                throw new RuntimeException("Not Supported yet!",
                        new UnsupportedOperationException(String.format("This SQL Type (%1$s) cannot be added to the statement using this"
                                + " method. Please add the same as an inline parameter at %2$s index.", type, index)));
        }
    }
    catch (SQLServerException ex) {
        throw new RuntimeException(ex);
    }
}