Commit 8b7c7b92 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix writing header of void CONNECT DBF tables on first insert. An error

  occured when the table definition had a special column that was not skipped
  from the header.
modified:
  storage/connect/filamdbf.cpp

- Update some test cases to reflect a change of error message generated when
  trying to update or delete a read only table.
modified:
  storage/connect/mysql-test/connect/r/csv.result
  storage/connect/mysql-test/connect/r/dbf.result
  storage/connect/mysql-test/connect/r/fix.result
  storage/connect/mysql-test/connect/r/ini.result
  storage/connect/mysql-test/connect/r/vec.result
  storage/connect/mysql-test/connect/t/csv.test
  storage/connect/mysql-test/connect/t/dbf.test
  storage/connect/mysql-test/connect/t/fix.test
  storage/connect/mysql-test/connect/t/ini.test
  storage/connect/mysql-test/connect/t/vec.test
parent 7bbcc3e4
......@@ -546,10 +546,11 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
PDOSDEF tdp = (PDOSDEF)Tdbp->GetDef();
// Count the number of columns
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) {
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!(cdp->Flags & U_SPECIAL)) {
reclen += cdp->GetLong();
n++;
} // endfor cdp
} // endif Flags
if (Lrecl != reclen) {
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, reclen);
......@@ -570,7 +571,8 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
descp = (DESCRIPTOR*)header;
// Currently only standard Xbase types are supported
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) {
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!(cdp->Flags & U_SPECIAL)) {
descp++;
switch ((c = *GetFormatType(cdp->GetType()))) {
......@@ -593,7 +595,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
strncpy(descp->Name, cdp->GetName(), 11);
descp->Type = c;
descp->Length = (uchar)cdp->GetLong();
} // endfor cdp
} // endif Flags
*(char*)(++descp) = EOH;
......
......@@ -52,9 +52,9 @@ children SMALLINT(2) NOT NULL
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
ERROR HY000: Table 't1' is read only
UPDATE t1 SET children=6 WHERE name='BILL';
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE name='BILL';
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
SELECT * FROM t1;
......
......@@ -77,9 +77,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (30);
ERROR HY000: Table 't1' is read only
UPDATE t1 SET a=30 WHERE a=10;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE a=10;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=NO;
......
......@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (20);
ERROR HY000: Table 't1' is read only
UPDATE t1 SET id=20 WHERE id=10;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE id=10;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=0;
......
......@@ -194,9 +194,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES ('US',40);
ERROR HY000: Table 't1' is read only
UPDATE t1 SET c2=20 WHERE c2=10;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE c2=10;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=0;
......
......@@ -103,9 +103,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (4,'test04');
ERROR HY000: Table 't1' is read only
UPDATE t1 SET b='test04' WHERE a=3;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE a=3;
ERROR HY000: Table 't1' is read only
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=no;
......
......@@ -47,9 +47,9 @@ CREATE TABLE t1
HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
--error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
UPDATE t1 SET children=6 WHERE name='BILL';
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE name='BILL';
--error ER_OPEN_AS_READONLY
TRUNCATE TABLE t1;
......
......@@ -68,9 +68,9 @@ ALTER TABLE t1 READONLY=Yes;
SHOW CREATE TABLE t1;
--error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES (30);
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
UPDATE t1 SET a=30 WHERE a=10;
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=10;
--error ER_OPEN_AS_READONLY
TRUNCATE TABLE t1;
......
......@@ -30,9 +30,9 @@ ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1;
--error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES (20);
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
UPDATE t1 SET id=20 WHERE id=10;
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE id=10;
--error ER_OPEN_AS_READONLY
TRUNCATE TABLE t1;
......
......@@ -101,9 +101,9 @@ ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1;
--error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES ('US',40);
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
UPDATE t1 SET c2=20 WHERE c2=10;
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE c2=10;
--error ER_OPEN_AS_READONLY
TRUNCATE TABLE t1;
......
......@@ -54,9 +54,9 @@ ALTER TABLE t1 READONLY=yes;
SHOW CREATE TABLE t1;
--error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES (4,'test04');
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
UPDATE t1 SET b='test04' WHERE a=3;
--error ER_OPEN_AS_READONLY
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=3;
--error ER_OPEN_AS_READONLY
TRUNCATE TABLE t1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment