- 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
This commit is contained in:
parent
7bbcc3e4ed
commit
8b7c7b9280
@ -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()) {
|
||||
reclen += cdp->GetLong();
|
||||
n++;
|
||||
} // endfor cdp
|
||||
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
|
||||
if (!(cdp->Flags & U_SPECIAL)) {
|
||||
reclen += cdp->GetLong();
|
||||
n++;
|
||||
} // endif Flags
|
||||
|
||||
if (Lrecl != reclen) {
|
||||
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, reclen);
|
||||
@ -570,30 +571,31 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
|
||||
descp = (DESCRIPTOR*)header;
|
||||
|
||||
// Currently only standard Xbase types are supported
|
||||
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) {
|
||||
descp++;
|
||||
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
|
||||
if (!(cdp->Flags & U_SPECIAL)) {
|
||||
descp++;
|
||||
|
||||
switch ((c = *GetFormatType(cdp->GetType()))) {
|
||||
case 'S': // Short integer
|
||||
case 'L': // Large (big) integer
|
||||
case 'T': // Tiny integer
|
||||
c = 'N'; // Numeric
|
||||
case 'N': // Numeric (integer)
|
||||
case 'F': // Float (double)
|
||||
descp->Decimals = (uchar)cdp->F.Prec;
|
||||
case 'C': // Char
|
||||
case 'D': // Date
|
||||
break;
|
||||
default: // Should never happen
|
||||
sprintf(g->Message, "Unsupported DBF type %c for column %s",
|
||||
c, cdp->GetName());
|
||||
return true;
|
||||
} // endswitch c
|
||||
switch ((c = *GetFormatType(cdp->GetType()))) {
|
||||
case 'S': // Short integer
|
||||
case 'L': // Large (big) integer
|
||||
case 'T': // Tiny integer
|
||||
c = 'N'; // Numeric
|
||||
case 'N': // Numeric (integer)
|
||||
case 'F': // Float (double)
|
||||
descp->Decimals = (uchar)cdp->F.Prec;
|
||||
case 'C': // Char
|
||||
case 'D': // Date
|
||||
break;
|
||||
default: // Should never happen
|
||||
sprintf(g->Message, "Unsupported DBF type %c for column %s",
|
||||
c, cdp->GetName());
|
||||
return true;
|
||||
} // endswitch c
|
||||
|
||||
strncpy(descp->Name, cdp->GetName(), 11);
|
||||
descp->Type = c;
|
||||
descp->Length = (uchar)cdp->GetLong();
|
||||
} // endfor cdp
|
||||
strncpy(descp->Name, cdp->GetName(), 11);
|
||||
descp->Type = c;
|
||||
descp->Length = (uchar)cdp->GetLong();
|
||||
} // 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user