summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-03-23 15:50:39 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2014-03-23 15:50:39 +0100
commita0266bbdaed380f50fe61f9bef4538a969f2450e (patch)
tree3b2b5d0ddcc0ab6a6364968e14703592056b6b73 /storage/connect
parent21d9c5824b92d28eb38c4346d4c06f47526aa33d (diff)
downloadmariadb-git-a0266bbdaed380f50fe61f9bef4538a969f2450e.tar.gz
- Should fix valgrind diag on uninitialized value
modified: storage/connect/tabdos.cpp - Separate alter.test in two to take care of unsupported LIBXML2 added: storage/connect/mysql-test/connect/r/alter_xml.result storage/connect/mysql-test/connect/t/alter_xml.test modified: storage/connect/mysql-test/connect/r/alter.result storage/connect/mysql-test/connect/t/alter.test
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/mysql-test/connect/r/alter.result71
-rw-r--r--storage/connect/mysql-test/connect/r/alter_xml.result86
-rw-r--r--storage/connect/mysql-test/connect/t/alter.test19
-rw-r--r--storage/connect/mysql-test/connect/t/alter_xml.test29
-rw-r--r--storage/connect/tabdos.cpp7
5 files changed, 115 insertions, 97 deletions
diff --git a/storage/connect/mysql-test/connect/r/alter.result b/storage/connect/mysql-test/connect/r/alter.result
index 49704cbdec3..ccfae3f4ddb 100644
--- a/storage/connect/mysql-test/connect/r/alter.result
+++ b/storage/connect/mysql-test/connect/r/alter.result
@@ -72,77 +72,6 @@ line
1,"One"
2,"Two"
3,"Three"
-# This would fail if the top node name is not specified.
-# This is because the XML top node name defaults to the table name.
-# Sure enough the temporary table name begins with '#' and is rejected by XML.
-# Therefore the top node name must be specified (along with the row nodes name).
-ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
-SELECT * FROM t1;
-c d
-1 One
-2 Two
-3 Three
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c` int(11) NOT NULL,
- `d` char(10) NOT NULL
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='rownode=row'
-# Let us see the XML file
-ALTER TABLE t2 FILE_NAME='t1.xml';
-Warnings:
-Warning 1105 This is an outward table, table data were not modified.
-SELECT * FROM t2;
-line
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Created by CONNECT Version 1.02.0002 March 16, 2014 -->
-<t1>
- <row>
- <TH>c</TH>
- <TH>d</TH>
- </row>
- <row>
- <c>1</c>
- <d>One</d>
- </row>
- <row>
- <c>2</c>
- <d>Two</d>
- </row>
- <row>
- <c>3</c>
- <d>Three</d>
- </row>
-</t1>
-# NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
-# Testing field option modification
-ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
-SELECT * FROM t1;
-c d
-1 One
-2 Two
-3 Three
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c` int(11) NOT NULL,
- `d` char(10) NOT NULL `FIELD_FORMAT`='@'
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='rownode=row' `HEADER`=0
-SELECT * FROM t2;
-line
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Created by CONNECT Version 1.02.0002 March 16, 2014 -->
-<t1>
- <row d="One">
- <c>1</c>
- </row>
- <row d="Two">
- <c>2</c>
- </row>
- <row d="Three">
- <c>3</c>
- </row>
-</t1>
#
# Testing changing engine
#
diff --git a/storage/connect/mysql-test/connect/r/alter_xml.result b/storage/connect/mysql-test/connect/r/alter_xml.result
new file mode 100644
index 00000000000..bd3b281b05b
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/alter_xml.result
@@ -0,0 +1,86 @@
+Warnings:
+Warning 1105 No file name. Table will use t1.xml
+#
+# Testing changing table type (not in-place)
+#
+CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1;
+Warnings:
+Warning 1105 No file name. Table will use t1.csv
+INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
+SELECT * FROM t1;
+c d
+1 One
+2 Two
+3 Three
+# This would fail if the top node name is not specified.
+# This is because the XML top node name defaults to the table name.
+# Sure enough the temporary table name begins with '#' and is rejected by XML.
+# Therefore the top node name must be specified (along with the row nodes name).
+ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
+SELECT * FROM t1;
+c d
+1 One
+2 Two
+3 Three
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) NOT NULL,
+ `d` char(10) NOT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='rownode=row'
+# Let us see the XML file
+CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
+Warnings:
+Warning 1105 No table_type. Will be set to DOS
+SELECT * FROM t2;
+line
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Created by CONNECT Version 1.02.0002 March 16, 2014 -->
+<t1>
+ <row>
+ <TH>c</TH>
+ <TH>d</TH>
+ </row>
+ <row>
+ <c>1</c>
+ <d>One</d>
+ </row>
+ <row>
+ <c>2</c>
+ <d>Two</d>
+ </row>
+ <row>
+ <c>3</c>
+ <d>Three</d>
+ </row>
+</t1>
+# NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
+# Testing field option modification
+ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
+SELECT * FROM t1;
+c d
+1 One
+2 Two
+3 Three
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) NOT NULL,
+ `d` char(10) NOT NULL `FIELD_FORMAT`='@'
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='rownode=row' `HEADER`=0
+SELECT * FROM t2;
+line
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Created by CONNECT Version 1.02.0002 March 16, 2014 -->
+<t1>
+ <row d="One">
+ <c>1</c>
+ </row>
+ <row d="Two">
+ <c>2</c>
+ </row>
+ <row d="Three">
+ <c>3</c>
+ </row>
+</t1>
+DROP TABLE t1, t2;
diff --git a/storage/connect/mysql-test/connect/t/alter.test b/storage/connect/mysql-test/connect/t/alter.test
index 5c86ebfd8b9..299381b925a 100644
--- a/storage/connect/mysql-test/connect/t/alter.test
+++ b/storage/connect/mysql-test/connect/t/alter.test
@@ -41,25 +41,6 @@ SHOW CREATE TABLE t1;
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.csv';
SELECT * FROM t2;
---echo # This would fail if the top node name is not specified.
---echo # This is because the XML top node name defaults to the table name.
---echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
---echo # Therefore the top node name must be specified (along with the row nodes name).
-ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-
---echo # Let us see the XML file
-ALTER TABLE t2 FILE_NAME='t1.xml';
-SELECT * FROM t2;
---echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
-
---echo # Testing field option modification
-ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-SELECT * FROM t2;
-
--echo #
--echo # Testing changing engine
--echo #
diff --git a/storage/connect/mysql-test/connect/t/alter_xml.test b/storage/connect/mysql-test/connect/t/alter_xml.test
new file mode 100644
index 00000000000..decf5e76cdf
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/alter_xml.test
@@ -0,0 +1,29 @@
+--source have_libxml2.inc
+
+--echo #
+--echo # Testing changing table type (not in-place)
+--echo #
+CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1;
+INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
+SELECT * FROM t1;
+
+--echo # This would fail if the top node name is not specified.
+--echo # This is because the XML top node name defaults to the table name.
+--echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
+--echo # Therefore the top node name must be specified (along with the row nodes name).
+ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+
+--echo # Let us see the XML file
+CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
+SELECT * FROM t2;
+--echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
+
+--echo # Testing field option modification
+ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index ef38fe2692f..b56a392ba75 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -1124,13 +1124,6 @@ void DOSCOL::WriteColumn(PGLOBAL g)
htrc("Lrecl=%d deplac=%d int=%d\n", tdbp->Lrecl, Deplac, Long);
field = Long;
- len = (signed)strlen(tdbp->To_Line);
-
- if (tdbp->GetAmType() == TYPE_AM_DOS && len > tdbp->Lrecl) {
- sprintf(g->Message, "Line size %d is bigger than lrecl %d",
- len, tdbp->Lrecl);
- longjmp(g->jumper[g->jump_level], 32);
- } // endif
if (tdbp->Ftype == RECFM_VAR && tdbp->Mode == MODE_UPDATE) {
len = (signed)strlen(tdbp->To_Line);