summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql
diff options
context:
space:
mode:
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql')
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/issue_527.sqc17
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/mysql.sqc53
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/sta-select.sqc74
3 files changed, 144 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/issue_527.sqc b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/issue_527.sqc
new file mode 100644
index 00000000..5514ff31
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/issue_527.sqc
@@ -0,0 +1,17 @@
+void myfunc1()
+{
+ EXEC SQL create or replace
+ function my_func (in_str IN varchar2)
+ return date
+ IS
+ x date;
+ BEGIN
+ IF in_str IS NULL THEN
+ x: = NULL;
+ ELSIF substr(in_str, 5, 1) = '-' THEN
+ x := to_date(in_str, 'YYYY-MM-DD HH24:MI:SS');
+ END IF;
+ return x;
+ END my_func;
+ END-EXEC;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/mysql.sqc b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/mysql.sqc
new file mode 100644
index 00000000..197c2847
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/mysql.sqc
@@ -0,0 +1,53 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+/*----------------------------------------------------------------*/
+EXEC SQL INCLUDE SQLCA;
+short sqlcode;
+
+EXEC SQL BEGIN DECLARE SECTION;
+int host_a;
+double host_b;
+char host_c;
+EXEC SQL END DECLARE SECTION;
+
+EXEC SQL DECLARE csr1 CURSOR FOR
+SELECT a, b, c
+ FROM table1
+ WHERE x = :hostvar1;
+
+/* dollar sign notation */
+$DECLARE cursorName CURSOR for
+ SELECT
+ a,
+ b
+ INTO
+ $struct->a,
+ $struct->b
+ FROM table;
+
+/*----------------------------------------------------------------*/
+void main (void)
+{
+ hostvar1 = 42;
+
+ EXEC SQL OPEN csr1;
+ if (sqlcode < 0)
+ exit(0);
+
+ while (rc >= 0 && rc != 100)
+ {
+ EXEC SQL FETCH csr1 INTO :host_a, :host_b, :host_c;
+ printf("Fetch %d, %lf, %s\n", host_a, host_b, host_c);
+ }
+
+ EXEC SQL CLOSE csr1;
+}
+
+void foo(void)
+{
+ strcpy(demoquery1,"some SQL statement");
+ EXEC SQL prepare demo3id from :demoquery1;
+ /* a comment */
+ EXEC SQL declare demo3cursor cursor for demo3id;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/sta-select.sqc b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/sta-select.sqc
new file mode 100644
index 00000000..863edf5b
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/sql/sta-select.sqc
@@ -0,0 +1,74 @@
+/*******************************************************
+**
+** A sample program that demonstrates the use of Static embedded SQL.
+** Before compiling this program, be sure you have created a table
+** called video and inserted some tuples in it.
+**
+********************************************************/
+#include <stdio.h>
+
+/* sqlca: is the sql communications area. All error codes
+ are returned from db2 in that structure which is filled
+ each time an interaction with db2 takes place.
+*/
+
+EXEC SQL INCLUDE SQLCA; /* SQL communication area structure */
+
+EXEC SQL BEGIN DECLARE SECTION; /* declare host variables */
+ char db_name[8]; /* database name */
+ char video_title[30]; /* title of the video */
+ short video_id; /* serial number */
+ char director[20]; /* director name */
+EXEC SQL END DECLARE SECTION;
+
+/* These lines are redundant here because the default
+ action is to continue. They just show the kind of
+ errors that could arise and one way to control them.
+*/
+
+EXEC SQL WHENEVER SQLWARNING CONTINUE; /* sqlca.sqlcode > 0 */
+EXEC SQL WHENEVER SQLERROR CONTINUE; /* sqlca.sqlcode < 0 */
+EXEC SQL WHENEVER NOT FOUND CONTINUE; /* sqlca.sqlcode = 100 */
+ /* sqlca.sqlcode = 0 (no error) */
+
+void main() {
+
+strcpy(db_name, "csc343h");
+
+/* C variables are preceded by a colon when they are passed to DB2 */
+
+EXEC SQL CONNECT TO :db_name;
+
+if (sqlca.sqlcode != 0) {
+ printf("Connect failed!: reason %ld\n", sqlca.sqlcode);
+ exit(1);
+}
+
+/* cursor delcaration. Have to declare a cursor each time you
+ want tuples back from db2
+*/
+
+EXEC SQL DECLARE c1 CURSOR FOR
+ SELECT video_title
+ FROM video;
+
+/* you have to open the cursor in order to get tuples back */
+
+EXEC SQL OPEN c1;
+
+do {
+
+ /* fetch tuples from the cursor. This will execute the statement
+ the cursor implements and will return the results */
+
+ EXEC SQL FETCH c1 into :video_title;
+ if (SQLCODE != 0) break; /* SQLCODE refers to sqlca.sqlcode */
+
+ /* host variables should have ':' prefix when they are used in DB2 commands */
+
+ printf("%s\n",video_title);
+
+} while (1);
+EXEC SQL CLOSE c1;
+EXEC SQL CONNECT RESET;
+}