Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0002396: Provide functionality to not require context table on sqlite
for threadsafe data capture
- Loading branch information
Showing
3 changed files
with
43 additions
and
26 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
38 changes: 38 additions & 0 deletions
38
...ric-client/src/main/java/org/jumpmind/symmetric/db/sqlite/SqliteJdbcSymmetricDialect.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,38 @@ | ||
package org.jumpmind.symmetric.db.sqlite; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import org.jumpmind.db.platform.IDatabasePlatform; | ||
import org.jumpmind.db.sql.IConnectionCallback; | ||
import org.jumpmind.db.sql.ISqlTransaction; | ||
import org.jumpmind.db.sql.JdbcSqlTransaction; | ||
import org.jumpmind.symmetric.service.IParameterService; | ||
|
||
public class SqliteJdbcSymmetricDialect extends SqliteSymmetricDialect { | ||
|
||
public SqliteJdbcSymmetricDialect(IParameterService parameterService, IDatabasePlatform platform) { | ||
super(parameterService, platform); | ||
} | ||
|
||
@Override | ||
protected void setSqliteFunctionResult(ISqlTransaction transaction, final String name, final String result){ | ||
JdbcSqlTransaction trans = (JdbcSqlTransaction)transaction; | ||
trans.executeCallback(new IConnectionCallback<Object>() { | ||
@Override | ||
public Object execute(Connection con) throws SQLException { | ||
org.sqlite.SQLiteConnection unwrapped = ((org.sqlite.SQLiteConnection)((org.apache.commons.dbcp.DelegatingConnection)con).getInnermostDelegate()); | ||
|
||
org.sqlite.Function.create(unwrapped, name, new org.sqlite.Function() { | ||
@Override | ||
protected void xFunc() throws SQLException { | ||
this.result(result); | ||
} | ||
}); | ||
|
||
return null; | ||
} | ||
}); | ||
} | ||
|
||
} |
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