Last active
October 29, 2018 03:46
-
-
Save MMcM/f2592ec387130430c4e5 to your computer and use it in GitHub Desktop.
FoundationDB SQL Layer Java Routine Example
This file contains hidden or 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
SQLActions[] = { | |
"BEGIN INSTALL | |
CREATE OR REPLACE PROCEDURE test.add_sub(IN x INT, IN y INT, OUT "sum" INT, out diff INT) | |
LANGUAGE java PARAMETER STYLE java | |
EXTERNAL NAME 'thisjar:com.foundationdb.example.TestJavaBasic.addSub'; | |
END INSTALL", | |
"BEGIN REMOVE | |
DROP PROCEDURE test.add_sub; | |
END REMOVE" | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.foundationdb</groupId> | |
<artifactId>sql-layer-java-routine-example</artifactId> | |
<packaging>jar</packaging> | |
<version>0.1.0-SNAPSHOT</version> | |
<name>FoundationDB SQL Layer Java Routine Example</name> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
</properties> | |
<licenses> | |
<license> | |
<name>MIT License</name> | |
<url>http://www.opensource.org/licenses/mit-license.php</url> | |
<distribution>repo</distribution> | |
</license> | |
</licenses> | |
<scm> | |
<url>https://gist.github.com/MMcM/f2592ec387130430c4e5</url> | |
</scm> | |
<dependencies> | |
<dependency> | |
<groupId>com.foundationdb</groupId> | |
<artifactId>fdb-sql-layer</artifactId> | |
<version>1.9.6-SNAPSHOT</version> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>2.5.1</version> | |
<configuration> | |
<source>1.7</source> | |
<target>1.7</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-resources-plugin</artifactId> | |
<version>2.6</version> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jar-plugin</artifactId> | |
<version>2.4</version> | |
<configuration> | |
<archive> | |
<manifestSections> | |
<manifestSection> | |
<name>install.ddr</name> | |
<manifestEntries> | |
<SQLJDeploymentDescriptor>TRUE</SQLJDeploymentDescriptor> | |
</manifestEntries> | |
</manifestSection> | |
</manifestSections> | |
</archive> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
This file contains hidden or 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
CALL sqlj.install_jar('/path/to/sql-layer-java-routine-example/target/sql-layer-java-example-0.1.0-SNAPSHOT.jar', 'examplejar', 1); | |
CALL test.add_sub(100,59); |
This file contains hidden or 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
package com.foundationdb.example; | |
public class TestJavaBasic | |
{ | |
public static void addSub(int x, int y, int[] sum, int[] diff) { | |
sum[0] = x + y; | |
diff[0] = x - y; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment