Skip to content

Commit

Permalink
Resolution of bug #1445745 - Support for table names with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
johncurrier committed Mar 10, 2006
1 parent b9794a2 commit fb758cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/net/sourceforge/schemaspy/model/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ private void initColumnAutoUpdate(DatabaseMetaData meta) throws SQLException {
sql.append(getSchema());
sql.append('.');
}

// SQL Server can have spaces in table names and wants []'s around them
boolean spaceInName = getName().indexOf(' ') != -1;
if (spaceInName)
sql.append('[');
sql.append(getName());
if (spaceInName)
sql.append(']');
sql.append(" where 0 = 1");

try {
Expand Down Expand Up @@ -539,7 +546,14 @@ protected int fetchNumRows(Database db, String clause) throws SQLException {
sql.append(getSchema());
sql.append('.');
}

// SQL Server can have spaces in table names and wants []'s around them
boolean spaceInName = getName().indexOf(' ') != -1;
if (spaceInName)
sql.append('[');
sql.append(getName());
if (spaceInName)
sql.append(']');

try {
stmt = db.getConnection().prepareStatement(sql.toString());
Expand Down

0 comments on commit fb758cd

Please sign in to comment.