diff --git a/java-library/pom.xml b/java-library/pom.xml index 8712d7852..b1dd8d933 100644 --- a/java-library/pom.xml +++ b/java-library/pom.xml @@ -4,7 +4,7 @@ com.microsoft.azure.functions azure-functions-java-library-sql - 0.1.1 + 2.0.0-preview jar diff --git a/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/CommandType.java b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/CommandType.java new file mode 100644 index 000000000..f275ecb14 --- /dev/null +++ b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/CommandType.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +package com.microsoft.azure.functions.sql.annotation; + +/** + * The type of commandText. + */ +public enum CommandType { + /** + * The commandText is a SQL query. + */ + Text, + + /** + * The commandText is a SQL stored procedure. + */ + StoredProcedure +} diff --git a/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLInput.java b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLInput.java index 997d4686b..f75f3901c 100644 --- a/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLInput.java +++ b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLInput.java @@ -25,12 +25,12 @@ /** * Query string or name of stored procedure to be run. */ - String commandText() default ""; + String commandText(); /** * Text or Stored Procedure. */ - String commandType() default ""; + CommandType commandType(); /** * Parameters to the query or stored procedure. This string must follow the format @@ -42,5 +42,5 @@ /** * Setting name for SQL connection string. */ - String connectionStringSetting() default ""; + String connectionStringSetting(); } diff --git a/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLOutput.java b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLOutput.java index 65ae46987..f97c17870 100644 --- a/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLOutput.java +++ b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLOutput.java @@ -26,10 +26,10 @@ /** * Name of the table to upsert data to. */ - String commandText() default ""; + String commandText(); /** * Setting name for SQL connection string. */ - String connectionStringSetting() default ""; + String connectionStringSetting(); } diff --git a/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLTrigger.java b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLTrigger.java new file mode 100644 index 000000000..f52bf97fa --- /dev/null +++ b/java-library/src/main/java/com/microsoft/azure/functions/sql/annotation/SQLTrigger.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.functions.sql.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.ElementType; + +import com.microsoft.azure.functions.annotation.CustomBinding; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PARAMETER) +@CustomBinding(direction = "in", name = "", type = "sqlTrigger") +public @interface SQLTrigger { + /** + * The variable name used in function.json. + */ + String name(); + + /** + * Name of the table to watch for changes. + */ + String tableName(); + + /** + * Setting name for SQL connection string. + */ + String connectionStringSetting(); +} \ No newline at end of file