summaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/ecpg/compatlib/informix.c2
-rw-r--r--src/interfaces/ecpg/test/compat_informix/.gitignore2
-rw-r--r--src/interfaces/ecpg/test/compat_informix/Makefile3
-rw-r--r--src/interfaces/ecpg/test/compat_informix/intoasc.pgc21
-rw-r--r--src/interfaces/ecpg/test/compat_informix/meson.build1
-rw-r--r--src/interfaces/ecpg/test/ecpg_schedule1
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-intoasc.c40
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout2
9 files changed, 70 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index dccf39582da..80d40aa3e09 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -654,7 +654,7 @@ intoasc(interval * i, char *str)
if (!tmp)
return -errno;
- memcpy(str, tmp, strlen(tmp));
+ strcpy(str, tmp);
free(tmp);
return 0;
}
diff --git a/src/interfaces/ecpg/test/compat_informix/.gitignore b/src/interfaces/ecpg/test/compat_informix/.gitignore
index f97706ba4be..6967ae77cd2 100644
--- a/src/interfaces/ecpg/test/compat_informix/.gitignore
+++ b/src/interfaces/ecpg/test/compat_informix/.gitignore
@@ -4,6 +4,8 @@
/dec_test.c
/describe
/describe.c
+/intoasc
+/intoasc.c
/rfmtdate
/rfmtdate.c
/rfmtlong
diff --git a/src/interfaces/ecpg/test/compat_informix/Makefile b/src/interfaces/ecpg/test/compat_informix/Makefile
index d50fdc29fd1..638b4e0af78 100644
--- a/src/interfaces/ecpg/test/compat_informix/Makefile
+++ b/src/interfaces/ecpg/test/compat_informix/Makefile
@@ -16,7 +16,8 @@ TESTS = test_informix test_informix.c \
rnull rnull.c \
sqlda sqlda.c \
describe describe.c \
- charfuncs charfuncs.c
+ charfuncs charfuncs.c \
+ intoasc intoasc.c
all: $(TESTS)
diff --git a/src/interfaces/ecpg/test/compat_informix/intoasc.pgc b/src/interfaces/ecpg/test/compat_informix/intoasc.pgc
new file mode 100644
index 00000000000..d13c83bb7a7
--- /dev/null
+++ b/src/interfaces/ecpg/test/compat_informix/intoasc.pgc
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pgtypes_interval.h"
+
+EXEC SQL BEGIN DECLARE SECTION;
+ char dirty_str[100] = "aaaaaaaaa_bbbbbbbb_ccccccccc_ddddddddd_";
+ interval *interval_ptr;
+EXEC SQL END DECLARE SECTION;
+
+int main()
+{
+ interval_ptr = (interval *) malloc(sizeof(interval));
+ interval_ptr->time = 100000000;
+ interval_ptr->month = 240;
+
+ printf("dirty_str contents before intoasc: %s\n", dirty_str);
+ intoasc(interval_ptr, dirty_str);
+ printf("dirty_str contents after intoasc: %s\n", dirty_str);
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/compat_informix/meson.build b/src/interfaces/ecpg/test/compat_informix/meson.build
index ab617b6db0d..c6ed52f51c5 100644
--- a/src/interfaces/ecpg/test/compat_informix/meson.build
+++ b/src/interfaces/ecpg/test/compat_informix/meson.build
@@ -4,6 +4,7 @@ pgc_files = [
'charfuncs',
'dec_test',
'describe',
+ 'intoasc',
'rfmtdate',
'rfmtlong',
'rnull',
diff --git a/src/interfaces/ecpg/test/ecpg_schedule b/src/interfaces/ecpg/test/ecpg_schedule
index 39814a39c17..f9c0a0e3c00 100644
--- a/src/interfaces/ecpg/test/ecpg_schedule
+++ b/src/interfaces/ecpg/test/ecpg_schedule
@@ -7,6 +7,7 @@ test: compat_informix/sqlda
test: compat_informix/describe
test: compat_informix/test_informix
test: compat_informix/test_informix2
+test: compat_informix/intoasc
test: compat_oracle/char_array
test: connect/test2
test: connect/test3
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-intoasc.c b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.c
new file mode 100644
index 00000000000..30988809e92
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.c
@@ -0,0 +1,40 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "intoasc.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pgtypes_interval.h"
+
+/* exec sql begin declare section */
+
+
+
+#line 7 "intoasc.pgc"
+ char dirty_str [ 100 ] = "aaaaaaaaa_bbbbbbbb_ccccccccc_ddddddddd_" ;
+
+#line 8 "intoasc.pgc"
+ interval * interval_ptr ;
+/* exec sql end declare section */
+#line 9 "intoasc.pgc"
+
+
+int main()
+{
+ interval_ptr = (interval *) malloc(sizeof(interval));
+ interval_ptr->time = 100000000;
+ interval_ptr->month = 240;
+
+ printf("dirty_str contents before intoasc: %s\n", dirty_str);
+ intoasc(interval_ptr, dirty_str);
+ printf("dirty_str contents after intoasc: %s\n", dirty_str);
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout
new file mode 100644
index 00000000000..0769465b840
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout
@@ -0,0 +1,2 @@
+dirty_str contents before intoasc: aaaaaaaaa_bbbbbbbb_ccccccccc_ddddddddd_
+dirty_str contents after intoasc: @ 20 years 1 min 40 secs