internal static int CalculateUpdateCount(this SFBaseResultSet resultSet)
        {
            SFResultSetMetaData metaData      = resultSet.sfResultSetMetaData;
            SFStatementType     statementType = metaData.statementType;

            int updateCount = 0;

            switch (statementType)
            {
            case SFStatementType.INSERT:
            case SFStatementType.UPDATE:
            case SFStatementType.DELETE:
            case SFStatementType.MERGE:
            case SFStatementType.MULTI_INSERT:
                for (int i = 0; i < resultSet.columnCount; i++)
                {
                    updateCount += resultSet.GetValue <int>(i);
                }
                break;

            case SFStatementType.COPY:
                updateCount = resultSet.GetValue <int>(3);
                break;

            case SFStatementType.SELECT:
                updateCount = -1;
                break;

            default:
                updateCount = 0;
                break;
            }

            return(updateCount);
        }
        internal static int CalculateUpdateCount(this SFBaseResultSet resultSet)
        {
            SFResultSetMetaData metaData      = resultSet.sfResultSetMetaData;
            SFStatementType     statementType = metaData.statementType;

            long updateCount = 0;

            switch (statementType)
            {
            case SFStatementType.INSERT:
            case SFStatementType.UPDATE:
            case SFStatementType.DELETE:
            case SFStatementType.MERGE:
            case SFStatementType.MULTI_INSERT:
                resultSet.Next();
                for (int i = 0; i < resultSet.columnCount; i++)
                {
                    updateCount += resultSet.GetValue <long>(i);
                }

                break;

            case SFStatementType.COPY:
                resultSet.Next();
                var index = resultSet.sfResultSetMetaData.getColumnIndexByName("rows_loaded");
                if (index >= 0)
                {
                    updateCount = resultSet.GetValue <long>(index);
                }
                break;

            case SFStatementType.SELECT:
                updateCount = -1;
                break;

            default:
                updateCount = 0;
                break;
            }

            if (updateCount > int.MaxValue)
            {
                return(-1);
            }

            return((int)updateCount);
        }