Skip to content

Commit

Permalink
0004076: Get estimated row counts for initial load for SQL Server 2008
Browse files Browse the repository at this point in the history
needs to use delimiter quoting if turned on
  • Loading branch information
philipmarzullo64 committed Aug 22, 2019
1 parent b3d9ce1 commit 1d94f77
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -53,7 +53,13 @@ public String getName() {

@Override
public long getEstimatedRowCount(Table table) {
String catalog = StringUtils.isNotBlank(table.getCatalog()) ? table.getCatalog() + "." : "";
String catalog = StringUtils.isNotBlank(table.getCatalog()) ? table.getCatalog() : "";
if(catalog.length() > 0) {
if(getDdlBuilder().isDelimitedIdentifierModeOn()) {
catalog = getDdlBuilder().getDatabaseInfo().getDelimiterToken() + catalog + getDdlBuilder().getDatabaseInfo().getDelimiterToken();
}
catalog = catalog + ".";
}
return getSqlTemplateDirty().queryForLong("select sum(p.rows) from " + catalog + "sys.tables t inner join " +
catalog + "sys.partitions p on t.object_id = p.object_id and p.index_id IN (0, 1) " +
"where t.name = ? and schema_name(t.schema_id) = ?",
Expand Down

0 comments on commit 1d94f77

Please sign in to comment.