Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3.8' of https://github.com/JumpMind/symmetric-ds.git in…
…to 3.8
- Loading branch information
Showing
17 changed files
with
245 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
symmetric-db/src/main/java/org/jumpmind/db/sql/ChangeCatalogConnectionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.jumpmind.db.sql; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
public class ChangeCatalogConnectionHandler implements IConnectionHandler { | ||
|
||
private String previousCatalog; | ||
|
||
private String changeCatalog; | ||
|
||
public ChangeCatalogConnectionHandler(String newCatalog) { | ||
changeCatalog = newCatalog; | ||
} | ||
|
||
@Override | ||
public void before(Connection connection) { | ||
if (changeCatalog != null) { | ||
try { | ||
previousCatalog = connection.getCatalog(); | ||
connection.setCatalog(changeCatalog); | ||
} catch (SQLException e) { | ||
if (changeCatalog != null) { | ||
try { | ||
connection.setCatalog(previousCatalog); | ||
} catch (SQLException ex) { | ||
} | ||
} | ||
throw new SqlException(e); | ||
} | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void after(Connection connection) { | ||
try { | ||
if (previousCatalog != null) { | ||
connection.setCatalog(previousCatalog); | ||
} | ||
} | ||
catch (SQLException ex) {} | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
symmetric-db/src/main/java/org/jumpmind/db/sql/IConnectionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.jumpmind.db.sql; | ||
|
||
import java.sql.Connection; | ||
|
||
public interface IConnectionHandler { | ||
|
||
public void before(Connection connection); | ||
|
||
public void after(Connection connection); | ||
|
||
} |
Oops, something went wrong.