Skip to content
Permalink
Browse files

0004076: Get estimated row counts for initial load for SQL Server 2008

needs to use delimiter quoting if turned on
  • Loading branch information...
philipmarzullo64 committed Aug 22, 2019
1 parent b3d9ce1 commit 1d94f77f73fd7676985b5da010317c7c5ff888d8
@@ -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) = ?",

0 comments on commit 1d94f77

Please sign in to comment.
You can’t perform that action at this time.