Comments (3)
Hi @paulbrasted
I don't know whether you are still in a position to give more details on this issue, but I have tried to construct a test case based on what you've reported. Here's what I came up with. The trouble is, in my environment it works as expected and doesn't crash. I wonder if you could try it in an empty db in yours.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.logging.Logger;
import org.postgresql.pljava.annotation.SQLAction;
import org.postgresql.pljava.annotation.SQLActions;
import org.postgresql.pljava.annotation.Function;
@SQLActions({
@SQLAction(provides="invoice_batch table", install=
"CREATE TABLE invoice_batch AS " +
"SELECT now() AS time_created, 42 AS id", remove=
"DROP TABLE invoice_batch"
),
@SQLAction(requires={"invoice_batch table","whenCreated fn"}, install=
"SELECT whenCreated(42)"
)
})
public class ttest
{
@Function(provides="whenCreated fn")
public static void whenCreated(Integer batch)
throws SQLException
{
Timestamp createTimeStamp = null;
java.sql.Connection sqlConnection =
DriverManager.getConnection("jdbc:default:connection");
String sql = "SELECT time_created FROM invoice_batch where id = "
+ batch.toString();
ResultSet result = sqlConnection.createStatement().executeQuery(sql);
if (result.next()) {
createTimeStamp = result.getTimestamp("time_created");
}
Logger.getAnonymousLogger().warning(String.valueOf(createTimeStamp));
}
}
If you build a jar from the above, say ttest.jar
, you can run the test simply with SELECT sqlj.install_jar('file:///path/to/ttest.jar', 'ttest', true);
and if things are working it should produce a WARNING
with the timestamp value. In your case, I guess it should crash. Or if it doesn't crash, perhaps you could look for how it is different from your first example and what needs to be changed until it does crash?
Thanks,
-Chap
from pljava.
Hi Chap
Thanks for response. Give me a couple of days
Paul
On 5 Oct 2015 04:51, "Chapman Flack" [email protected] wrote:
Hi @paulbrasted https://github.com/paulbrasted
I don't know whether you are still in a position to give more details on
this issue, but I have tried to construct a test case based on what you've
reported. Here's what I came up with. The trouble is, in my environment it
works as expected and doesn't crash. I wonder if you could try it in an
empty db in yours.import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Timestamp;
import java.util.logging.Logger;
import org.postgresql.pljava.annotation.SQLAction;import org.postgresql.pljava.annotation.SQLActions;import org.postgresql.pljava.annotation.Function;@SQLActions({
@SQLAction(provides="invoice_batch table", install=
"CREATE TABLE invoice_batch AS " +
"SELECT now() AS time_created, 42 AS id", remove=
"DROP TABLE invoice_batch"
),
@SQLAction(requires={"invoice_batch table","whenCreated fn"}, install=
"SELECT whenCreated(42)"
)
})public class ttest
{
@function(provides="whenCreated fn")
public static void whenCreated(Integer batch)
throws SQLException
{
Timestamp createTimeStamp = null;
java.sql.Connection sqlConnection =
DriverManager.getConnection("jdbc:default:connection");
String sql = "SELECT time_created FROM invoice_batch where id = "
+ batch.toString();
ResultSet result = sqlConnection.createStatement().executeQuery(sql);
if (result.next()) {
createTimeStamp = result.getTimestamp("time_created");
}
Logger.getAnonymousLogger().warning(String.valueOf(createTimeStamp));
}
}If you build a jar from the above, say ttest.jar, you can run the test
simply with SELECT sqlj.install_jar('file:///path/to/ttest.jar', 'ttest',
true); and if things are working it should produce a WARNING with the
timestamp value. In your case, I guess it should crash. Or if it doesn't
crash, perhaps you could look for how it is different from your first
example and what needs to be changed until it does crash?Thanks,
-Chap—
Reply to this email directly or view it on GitHub
#47 (comment).
from pljava.
Have not heard from Paul since October, but noticing this involved timestamps and Windows gives it a very strong smell of the MSVC global-variable mislinkage business and I would bet it is fixed by 1f1e8fe.
Closing.
from pljava.
Related Issues (20)
- Fails on s390x HOT 1
- Always prompts that the language pljava does not exist HOT 4
- Class Loading issue HOT 31
- Question: How to install Pl/Java into AWS RDS Postgres HOT 2
- Compilen error occuring while running mvn clean install HOT 2
- dependency not adding..issue in plugin HOT 1
- fatal error: postgres.h: No such file or directory HOT 2
- XML parsing errors reported as `XX000` when DOM API is used HOT 1
- Documentation comments for sandboxed and unsandboxed grants in pljava.policy inverted HOT 6
- Publish PlJava to a public Maven Repository HOT 2
- Unhelpful output when build fails because no platform rules matched HOT 10
- undefined symbol: GetMemoryChunkContext HOT 2
- pljava.ddr This script file related issues HOT 13
- Execute Java Code at PostgreSQL startup to "Get Things Ready" HOT 1
- I meet a compile error while compiling PL/Java using maven HOT 6
- How to implement a special top-N group function? HOT 1
- How to set classpath including multiple jars? HOT 2
- Reminder - there are official-ish releases for Debian + TestContainer notes
- Getting Build Failure issue after 'mvn clean install'. HOT 6
- pljava-so: TypeError: null is not an Object in <eval> HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pljava.