diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2014-04-07 00:23:37 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2014-04-07 00:23:37 +0200 |
commit | cc7a08c9410335237e6c19f84d9c5d08938b8e8a (patch) | |
tree | ee9bcf3ab7d4160fd71af679d7173613d653c3df /storage | |
parent | f26be8cae28a6c947278080d45d546ac2b9fa69f (diff) | |
parent | a0266bbdaed380f50fe61f9bef4538a969f2450e (diff) | |
download | mariadb-git-cc7a08c9410335237e6c19f84d9c5d08938b8e8a.tar.gz |
- Commit various changes
added:
storage/connect/mysql-test/connect/r/alter_xml.result
storage/connect/mysql-test/connect/t/alter_xml.test
modified:
storage/connect/myconn.cpp
storage/connect/mysql-test/connect/r/alter.result
storage/connect/mysql-test/connect/t/alter.test
storage/connect/tabdos.cpp
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/myconn.cpp | 20 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/alter.result | 71 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/alter_xml.result | 86 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/alter.test | 19 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/alter_xml.test | 29 | ||||
-rw-r--r-- | storage/connect/tabdos.cpp | 7 |
6 files changed, 131 insertions, 101 deletions
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 13a6f996605..3d0a3d86136 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -1,11 +1,11 @@ /************** MyConn C++ Program Source Code File (.CPP) **************/ /* PROGRAM NAME: MYCONN */ /* ------------- */ -/* Version 1.7 */ +/* Version 1.8 */ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 2007-2013 */ +/* (C) Copyright to the author Olivier BERTRAND 2007-2014 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -47,7 +47,8 @@ #include "myconn.h" extern "C" int trace; -extern MYSQL_PLUGIN_IMPORT uint mysqld_port; +extern MYSQL_PLUGIN_IMPORT uint mysqld_port; +extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port; // Returns the current used port uint GetDefaultPort(void) @@ -340,6 +341,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, const char *user, const char *pwd, int pt) { + const char *pipe = NULL; uint cto = 60, nrt = 120; m_DB = mysql_init(NULL); @@ -356,6 +358,16 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, mysql_options(m_DB, MYSQL_OPT_READ_TIMEOUT, &nrt); //mysql_options(m_DB, MYSQL_OPT_WRITE_TIMEOUT, ...); +#if defined(WIN32) + if (!strcmp(host, ".")) { + mysql_options(m_DB, MYSQL_OPT_NAMED_PIPE, NULL); + pipe = mysqld_unix_port; + } // endif host +#else // !WIN32 + if (!strcmp(host, "localhost")) + pipe = mysqld_unix_port; +#endif // !WIN32 + #if 0 if (pwd && !strcmp(pwd, "*")) { if (GetPromptAnswer(g, "*Enter password:")) { @@ -367,7 +379,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, } // endif pwd #endif // 0 - if (!mysql_real_connect(m_DB, host, user, pwd, db, pt, NULL, CLIENT_MULTI_RESULTS)) { + if (!mysql_real_connect(m_DB, host, user, pwd, db, pt, pipe, CLIENT_MULTI_RESULTS)) { #if defined(_DEBUG) sprintf(g->Message, "mysql_real_connect failed: (%d) %s", mysql_errno(m_DB), mysql_error(m_DB)); diff --git a/storage/connect/mysql-test/connect/r/alter.result b/storage/connect/mysql-test/connect/r/alter.result index 1994ec335f2..7c933a9bac7 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 9f3dd50ba46..37ff34710ec 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -2304,13 +2304,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);
|