summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/sql/quote.pgc
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2006-08-02 14:14:04 +0000
committerMichael Meskes <meskes@postgresql.org>2006-08-02 14:14:04 +0000
commit1f0a6cd60caa3216d41b048c4c9d65049f069bac (patch)
treeb95ff425cea76585c97422aad39f9968832ed4b3 /src/interfaces/ecpg/test/sql/quote.pgc
parent6392518c6943bfe9b1c0b378db4e2339dc56c634 (diff)
downloadpostgresql-1f0a6cd60caa3216d41b048c4c9d65049f069bac.tar.gz
Hopefully that's it. The remaining files for ecpg regression tests.
Diffstat (limited to 'src/interfaces/ecpg/test/sql/quote.pgc')
-rw-r--r--src/interfaces/ecpg/test/sql/quote.pgc43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/test/sql/quote.pgc b/src/interfaces/ecpg/test/sql/quote.pgc
new file mode 100644
index 0000000000..244c628edc
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/quote.pgc
@@ -0,0 +1,43 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+EXEC SQL INCLUDE ../regression;
+
+int main(int argc, char* argv[]) {
+ EXEC SQL BEGIN DECLARE SECTION;
+ char var[25];
+ EXEC SQL END DECLARE SECTION;
+
+ ECPGdebug(1, stderr);
+ EXEC SQL CONNECT TO REGRESSDB1;
+
+ EXEC SQL SET AUTOCOMMIT TO ON;
+ EXEC SQL WHENEVER SQLWARNING SQLPRINT;
+ EXEC SQL WHENEVER SQLERROR SQLPRINT;
+
+ EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
+
+ EXEC SQL SHOW standard_conforming_strings INTO :var;
+ printf("Standard conforming strings: %s\n", var);
+
+ /* this is a\\b actually */
+ EXEC SQL INSERT INTO My_Table VALUES ( 1, 'a\\\\b' );
+ /* this is a\b */
+ EXEC SQL INSERT INTO My_Table VALUES ( 1, E'a\\\\b' );
+
+ EXEC SQL SET standard_conforming_strings TO on;
+
+ /* this is a\\b actually */
+ EXEC SQL INSERT INTO My_Table VALUES ( 1, 'a\\\\b' );
+ /* this is a\b */
+ EXEC SQL INSERT INTO My_Table VALUES ( 1, E'a\\\\b' );
+
+ EXEC SQL SELECT * FROM My_Table;
+
+ EXEC SQL DROP TABLE My_Table;
+
+ EXEC SQL DISCONNECT ALL;
+
+ return 0;
+}