Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
094b01d4
Commit
094b01d4
authored
Jun 09, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
10.0-connect
parents
e6a2d95a
c1973c80
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
539 additions
and
510 deletions
+539
-510
storage/connect/colblk.h
storage/connect/colblk.h
+1
-0
storage/connect/filamdbf.cpp
storage/connect/filamdbf.cpp
+30
-28
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+4
-8
storage/connect/mysql-test/connect/r/csv.result
storage/connect/mysql-test/connect/r/csv.result
+2
-2
storage/connect/mysql-test/connect/r/dbf.result
storage/connect/mysql-test/connect/r/dbf.result
+2
-2
storage/connect/mysql-test/connect/r/fix.result
storage/connect/mysql-test/connect/r/fix.result
+2
-2
storage/connect/mysql-test/connect/r/ini.result
storage/connect/mysql-test/connect/r/ini.result
+2
-2
storage/connect/mysql-test/connect/r/vec.result
storage/connect/mysql-test/connect/r/vec.result
+2
-2
storage/connect/mysql-test/connect/t/csv.test
storage/connect/mysql-test/connect/t/csv.test
+185
-185
storage/connect/mysql-test/connect/t/dbf.test
storage/connect/mysql-test/connect/t/dbf.test
+2
-2
storage/connect/mysql-test/connect/t/fix.test
storage/connect/mysql-test/connect/t/fix.test
+2
-2
storage/connect/mysql-test/connect/t/ini.test
storage/connect/mysql-test/connect/t/ini.test
+156
-156
storage/connect/mysql-test/connect/t/vec.test
storage/connect/mysql-test/connect/t/vec.test
+80
-80
storage/connect/reldef.h
storage/connect/reldef.h
+2
-0
storage/connect/tabdos.cpp
storage/connect/tabdos.cpp
+27
-10
storage/connect/tabdos.h
storage/connect/tabdos.h
+2
-1
storage/connect/tabfmt.cpp
storage/connect/tabfmt.cpp
+37
-26
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+1
-2
No files found.
storage/connect/colblk.h
View file @
094b01d4
...
@@ -55,6 +55,7 @@ class DllExport COLBLK : public XOBJECT {
...
@@ -55,6 +55,7 @@ class DllExport COLBLK : public XOBJECT {
PSZ
GetFmt
(
void
)
{
return
(
Cdp
)
?
Cdp
->
Fmt
:
NULL
;}
PSZ
GetFmt
(
void
)
{
return
(
Cdp
)
?
Cdp
->
Fmt
:
NULL
;}
bool
IsUnsigned
(
void
)
{
return
Unsigned
;}
bool
IsUnsigned
(
void
)
{
return
Unsigned
;}
bool
IsNullable
(
void
)
{
return
Nullable
;}
bool
IsNullable
(
void
)
{
return
Nullable
;}
bool
IsVirtual
(
void
)
{
return
Cdp
->
IsVirtual
();}
void
SetNullable
(
bool
b
)
{
Nullable
=
b
;}
void
SetNullable
(
bool
b
)
{
Nullable
=
b
;}
// Methods
// Methods
...
...
storage/connect/filamdbf.cpp
View file @
094b01d4
...
@@ -546,10 +546,11 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
...
@@ -546,10 +546,11 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
PDOSDEF
tdp
=
(
PDOSDEF
)
Tdbp
->
GetDef
();
PDOSDEF
tdp
=
(
PDOSDEF
)
Tdbp
->
GetDef
();
// Count the number of columns
// 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
();
reclen
+=
cdp
->
GetLong
();
n
++
;
n
++
;
}
// endfor cdp
}
// endif Flags
if
(
Lrecl
!=
reclen
)
{
if
(
Lrecl
!=
reclen
)
{
sprintf
(
g
->
Message
,
MSG
(
BAD_LRECL
),
Lrecl
,
reclen
);
sprintf
(
g
->
Message
,
MSG
(
BAD_LRECL
),
Lrecl
,
reclen
);
...
@@ -570,7 +571,8 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
...
@@ -570,7 +571,8 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
descp
=
(
DESCRIPTOR
*
)
header
;
descp
=
(
DESCRIPTOR
*
)
header
;
// Currently only standard Xbase types are supported
// 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
++
;
descp
++
;
switch
((
c
=
*
GetFormatType
(
cdp
->
GetType
())))
{
switch
((
c
=
*
GetFormatType
(
cdp
->
GetType
())))
{
...
@@ -593,7 +595,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
...
@@ -593,7 +595,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
strncpy
(
descp
->
Name
,
cdp
->
GetName
(),
11
);
strncpy
(
descp
->
Name
,
cdp
->
GetName
(),
11
);
descp
->
Type
=
c
;
descp
->
Type
=
c
;
descp
->
Length
=
(
uchar
)
cdp
->
GetLong
();
descp
->
Length
=
(
uchar
)
cdp
->
GetLong
();
}
// endfor cdp
}
// endif Flags
*
(
char
*
)(
++
descp
)
=
EOH
;
*
(
char
*
)(
++
descp
)
=
EOH
;
...
...
storage/connect/ha_connect.cc
View file @
094b01d4
...
@@ -1058,6 +1058,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
...
@@ -1058,6 +1058,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
break
;
break
;
case
TYPE_DECIM
:
case
TYPE_DECIM
:
pcf
->
Precision
=
((
Field_new_decimal
*
)
fp
)
->
precision
;
pcf
->
Precision
=
((
Field_new_decimal
*
)
fp
)
->
precision
;
pcf
->
Length
=
pcf
->
Precision
;
pcf
->
Scale
=
fp
->
decimals
();
pcf
->
Scale
=
fp
->
decimals
();
break
;
break
;
case
TYPE_DATE
:
case
TYPE_DATE
:
...
@@ -2708,7 +2709,6 @@ int ha_connect::index_next_same(uchar *buf, const uchar *key, uint keylen)
...
@@ -2708,7 +2709,6 @@ int ha_connect::index_next_same(uchar *buf, const uchar *key, uint keylen)
*/
*/
int
ha_connect
::
rnd_init
(
bool
scan
)
int
ha_connect
::
rnd_init
(
bool
scan
)
{
{
int
rc
;
PGLOBAL
g
=
((
table
&&
table
->
in_use
)
?
GetPlug
(
table
->
in_use
,
xp
)
:
PGLOBAL
g
=
((
table
&&
table
->
in_use
)
?
GetPlug
(
table
->
in_use
,
xp
)
:
(
xp
)
?
xp
->
g
:
NULL
);
(
xp
)
?
xp
->
g
:
NULL
);
DBUG_ENTER
(
"ha_connect::rnd_init"
);
DBUG_ENTER
(
"ha_connect::rnd_init"
);
...
@@ -2742,8 +2742,8 @@ int ha_connect::rnd_init(bool scan)
...
@@ -2742,8 +2742,8 @@ int ha_connect::rnd_init(bool scan)
if
(
xmod
==
MODE_UPDATE
)
if
(
xmod
==
MODE_UPDATE
)
bitmap_union
(
table
->
read_set
,
table
->
write_set
);
bitmap_union
(
table
->
read_set
,
table
->
write_set
);
if
(
(
rc
=
OpenTable
(
g
,
xmod
==
MODE_DELETE
)
))
if
(
OpenTable
(
g
,
xmod
==
MODE_DELETE
))
DBUG_RETURN
(
rc
);
DBUG_RETURN
(
HA_ERR_INITIALIZATION
);
xp
->
nrd
=
xp
->
fnd
=
xp
->
nfd
=
0
;
xp
->
nrd
=
xp
->
fnd
=
xp
->
nfd
=
0
;
xp
->
tb1
=
my_interval_timer
();
xp
->
tb1
=
my_interval_timer
();
...
@@ -4239,7 +4239,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
...
@@ -4239,7 +4239,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
strncpy
(
dsn
,
create_info
->
connect_string
.
str
,
len
);
strncpy
(
dsn
,
create_info
->
connect_string
.
str
,
len
);
dsn
[
len
]
=
0
;
dsn
[
len
]
=
0
;
mydef
->
SetName
(
create_info
->
alias
);
mydef
->
SetName
(
create_info
->
alias
);
mydef
->
SetCat
(
cat
);
if
(
!
mydef
->
ParseURL
(
g
,
dsn
,
false
))
{
if
(
!
mydef
->
ParseURL
(
g
,
dsn
,
false
))
{
if
(
mydef
->
GetHostname
())
if
(
mydef
->
GetHostname
())
...
@@ -4696,21 +4695,18 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -4696,21 +4695,18 @@ int ha_connect::create(const char *name, TABLE *table_arg,
int
port
;
int
port
;
host
=
GetListOption
(
g
,
"host"
,
options
->
oplist
,
NULL
);
host
=
GetListOption
(
g
,
"host"
,
options
->
oplist
,
NULL
);
db
=
Get
ListOption
(
g
,
"database"
,
options
->
oplist
,
NULL
);
db
=
Get
StringOption
(
"database"
,
NULL
);
port
=
atoi
(
GetListOption
(
g
,
"port"
,
options
->
oplist
,
"0"
));
port
=
atoi
(
GetListOption
(
g
,
"port"
,
options
->
oplist
,
"0"
));
if
(
create_info
->
connect_string
.
str
)
{
if
(
create_info
->
connect_string
.
str
)
{
char
*
dsn
;
char
*
dsn
;
int
len
=
create_info
->
connect_string
.
length
;
int
len
=
create_info
->
connect_string
.
length
;
PMYDEF
mydef
=
new
(
g
)
MYSQLDEF
();
PMYDEF
mydef
=
new
(
g
)
MYSQLDEF
();
PDBUSER
dup
=
PlgGetUser
(
g
);
PCATLG
cat
=
(
dup
)
?
dup
->
Catalog
:
NULL
;
dsn
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
len
+
1
);
dsn
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
len
+
1
);
strncpy
(
dsn
,
create_info
->
connect_string
.
str
,
len
);
strncpy
(
dsn
,
create_info
->
connect_string
.
str
,
len
);
dsn
[
len
]
=
0
;
dsn
[
len
]
=
0
;
mydef
->
SetName
(
create_info
->
alias
);
mydef
->
SetName
(
create_info
->
alias
);
mydef
->
SetCat
(
cat
);
if
(
!
mydef
->
ParseURL
(
g
,
dsn
,
false
))
{
if
(
!
mydef
->
ParseURL
(
g
,
dsn
,
false
))
{
if
(
mydef
->
GetHostname
())
if
(
mydef
->
GetHostname
())
...
...
storage/connect/mysql-test/connect/r/csv.result
View file @
094b01d4
...
@@ -52,9 +52,9 @@ children SMALLINT(2) NOT NULL
...
@@ -52,9 +52,9 @@ children SMALLINT(2) NOT NULL
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
UPDATE t1 SET children=6 WHERE name='BILL';
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';
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;
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
SELECT * FROM t1;
SELECT * FROM t1;
...
...
storage/connect/mysql-test/connect/r/dbf.result
View file @
094b01d4
...
@@ -77,9 +77,9 @@ t1 CREATE TABLE `t1` (
...
@@ -77,9 +77,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (30);
INSERT INTO t1 VALUES (30);
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
UPDATE t1 SET a=30 WHERE a=10;
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;
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;
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=NO;
ALTER TABLE t1 READONLY=NO;
...
...
storage/connect/mysql-test/connect/r/fix.result
View file @
094b01d4
...
@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
...
@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (20);
INSERT INTO t1 VALUES (20);
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
UPDATE t1 SET id=20 WHERE id=10;
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;
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;
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=0;
ALTER TABLE t1 READONLY=0;
...
...
storage/connect/mysql-test/connect/r/ini.result
View file @
094b01d4
...
@@ -194,9 +194,9 @@ t1 CREATE TABLE `t1` (
...
@@ -194,9 +194,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES ('US',40);
INSERT INTO t1 VALUES ('US',40);
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
UPDATE t1 SET c2=20 WHERE c2=10;
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;
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;
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=0;
ALTER TABLE t1 READONLY=0;
...
...
storage/connect/mysql-test/connect/r/vec.result
View file @
094b01d4
...
@@ -103,9 +103,9 @@ t1 CREATE TABLE `t1` (
...
@@ -103,9 +103,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (4,'test04');
INSERT INTO t1 VALUES (4,'test04');
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
UPDATE t1 SET b='test04' WHERE a=3;
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;
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;
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=no;
ALTER TABLE t1 READONLY=no;
...
...
storage/connect/mysql-test/connect/t/csv.test
View file @
094b01d4
...
@@ -47,9 +47,9 @@ CREATE TABLE t1
...
@@ -47,9 +47,9 @@ CREATE TABLE t1
HEADER
=
1
SEP_CHAR
=
';'
QUOTED
=
1
READONLY
=
yes
;
HEADER
=
1
SEP_CHAR
=
';'
QUOTED
=
1
READONLY
=
yes
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
INSERT
INTO
t1
VALUES
(
'BILL'
,
'1973-06-30'
,
5
);
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'
;
UPDATE
t1
SET
children
=
6
WHERE
name
=
'BILL'
;
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
DELETE
FROM
t1
WHERE
name
=
'BILL'
;
DELETE
FROM
t1
WHERE
name
=
'BILL'
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
TRUNCATE
TABLE
t1
;
TRUNCATE
TABLE
t1
;
...
...
storage/connect/mysql-test/connect/t/dbf.test
View file @
094b01d4
...
@@ -68,9 +68,9 @@ ALTER TABLE t1 READONLY=Yes;
...
@@ -68,9 +68,9 @@ ALTER TABLE t1 READONLY=Yes;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
INSERT
INTO
t1
VALUES
(
30
);
INSERT
INTO
t1
VALUES
(
30
);
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
UPDATE
t1
SET
a
=
30
WHERE
a
=
10
;
UPDATE
t1
SET
a
=
30
WHERE
a
=
10
;
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
DELETE
FROM
t1
WHERE
a
=
10
;
DELETE
FROM
t1
WHERE
a
=
10
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
TRUNCATE
TABLE
t1
;
TRUNCATE
TABLE
t1
;
...
...
storage/connect/mysql-test/connect/t/fix.test
View file @
094b01d4
...
@@ -30,9 +30,9 @@ ALTER TABLE t1 READONLY=1;
...
@@ -30,9 +30,9 @@ ALTER TABLE t1 READONLY=1;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
INSERT
INTO
t1
VALUES
(
20
);
INSERT
INTO
t1
VALUES
(
20
);
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
UPDATE
t1
SET
id
=
20
WHERE
id
=
10
;
UPDATE
t1
SET
id
=
20
WHERE
id
=
10
;
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
DELETE
FROM
t1
WHERE
id
=
10
;
DELETE
FROM
t1
WHERE
id
=
10
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
TRUNCATE
TABLE
t1
;
TRUNCATE
TABLE
t1
;
...
...
storage/connect/mysql-test/connect/t/ini.test
View file @
094b01d4
...
@@ -101,9 +101,9 @@ ALTER TABLE t1 READONLY=1;
...
@@ -101,9 +101,9 @@ ALTER TABLE t1 READONLY=1;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
INSERT
INTO
t1
VALUES
(
'US'
,
40
);
INSERT
INTO
t1
VALUES
(
'US'
,
40
);
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
UPDATE
t1
SET
c2
=
20
WHERE
c2
=
10
;
UPDATE
t1
SET
c2
=
20
WHERE
c2
=
10
;
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
DELETE
FROM
t1
WHERE
c2
=
10
;
DELETE
FROM
t1
WHERE
c2
=
10
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
TRUNCATE
TABLE
t1
;
TRUNCATE
TABLE
t1
;
...
...
storage/connect/mysql-test/connect/t/vec.test
View file @
094b01d4
...
@@ -54,9 +54,9 @@ ALTER TABLE t1 READONLY=yes;
...
@@ -54,9 +54,9 @@ ALTER TABLE t1 READONLY=yes;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
INSERT
INTO
t1
VALUES
(
4
,
'test04'
);
INSERT
INTO
t1
VALUES
(
4
,
'test04'
);
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
UPDATE
t1
SET
b
=
'test04'
WHERE
a
=
3
;
UPDATE
t1
SET
b
=
'test04'
WHERE
a
=
3
;
--
error
ER_
OPEN_AS_READONLY
--
error
ER_
GET_ERRMSG
DELETE
FROM
t1
WHERE
a
=
3
;
DELETE
FROM
t1
WHERE
a
=
3
;
--
error
ER_OPEN_AS_READONLY
--
error
ER_OPEN_AS_READONLY
TRUNCATE
TABLE
t1
;
TRUNCATE
TABLE
t1
;
...
...
storage/connect/reldef.h
View file @
094b01d4
...
@@ -195,6 +195,8 @@ class DllExport COLDEF : public COLCRT { /* Column description block
...
@@ -195,6 +195,8 @@ class DllExport COLDEF : public COLCRT { /* Column description block
int
GetPoff
(
void
)
{
return
Poff
;}
int
GetPoff
(
void
)
{
return
Poff
;}
int
Define
(
PGLOBAL
g
,
void
*
memp
,
PCOLINFO
cfp
,
int
poff
);
int
Define
(
PGLOBAL
g
,
void
*
memp
,
PCOLINFO
cfp
,
int
poff
);
void
Define
(
PGLOBAL
g
,
PCOL
colp
);
void
Define
(
PGLOBAL
g
,
PCOL
colp
);
bool
IsSpecial
(
void
)
{
return
(
Flags
&
U_SPECIAL
)
?
true
:
false
;}
bool
IsVirtual
(
void
)
{
return
(
Flags
&
U_VIRTUAL
)
?
true
:
false
;}
protected:
protected:
int
Buf_Type
;
/* Internal data type */
int
Buf_Type
;
/* Internal data type */
...
...
storage/connect/tabdos.cpp
View file @
094b01d4
...
@@ -924,10 +924,12 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
...
@@ -924,10 +924,12 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
Long
=
cdp
->
GetLong
();
Long
=
cdp
->
GetLong
();
To_Val
=
NULL
;
To_Val
=
NULL
;
OldVal
=
NULL
;
// Currently used only in MinMax
OldVal
=
NULL
;
// Currently used only in MinMax
Dsp
=
0
;
Ldz
=
false
;
Ldz
=
false
;
Nod
=
false
;
Nod
=
false
;
Dcm
=
-
1
;
Dcm
=
-
1
;
p
=
cdp
->
GetFmt
();
p
=
cdp
->
GetFmt
();
Buf
=
NULL
;
if
(
p
&&
IsTypeNum
(
Buf_Type
))
{
if
(
p
&&
IsTypeNum
(
Buf_Type
))
{
// Formatted numeric value
// Formatted numeric value
...
@@ -939,6 +941,9 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
...
@@ -939,6 +941,9 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
case
'N'
:
// Have no decimal point
case
'N'
:
// Have no decimal point
Nod
=
true
;
Nod
=
true
;
break
;
break
;
case
'D'
:
// Decimal separator
Dsp
=
*
(
++
p
);
break
;
}
// endswitch p
}
// endswitch p
// Set number of decimal digits
// Set number of decimal digits
...
@@ -960,6 +965,7 @@ DOSCOL::DOSCOL(DOSCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
...
@@ -960,6 +965,7 @@ DOSCOL::DOSCOL(DOSCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
Long
=
col1
->
Long
;
Long
=
col1
->
Long
;
To_Val
=
col1
->
To_Val
;
To_Val
=
col1
->
To_Val
;
Ldz
=
col1
->
Ldz
;
Ldz
=
col1
->
Ldz
;
Dsp
=
col1
->
Dsp
;
Nod
=
col1
->
Nod
;
Nod
=
col1
->
Nod
;
Dcm
=
col1
->
Dcm
;
Dcm
=
col1
->
Dcm
;
OldVal
=
col1
->
OldVal
;
OldVal
=
col1
->
OldVal
;
...
@@ -1003,7 +1009,7 @@ bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
...
@@ -1003,7 +1009,7 @@ bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
}
// endif's Value, Buf_Type
}
// endif's Value, Buf_Type
// Allocate the buffer used in WriteColumn for numeric columns
// Allocate the buffer used in WriteColumn for numeric columns
if
(
IsTypeNum
(
Buf_Type
))
if
(
!
Buf
&&
IsTypeNum
(
Buf_Type
))
Buf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
MY_MAX
(
32
,
Long
+
Dcm
+
1
));
Buf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
MY_MAX
(
32
,
Long
+
Dcm
+
1
));
// Because Colblk's have been made from a copy of the original TDB in
// Because Colblk's have been made from a copy of the original TDB in
...
@@ -1048,14 +1054,18 @@ void DOSCOL::ReadColumn(PGLOBAL g)
...
@@ -1048,14 +1054,18 @@ void DOSCOL::ReadColumn(PGLOBAL g)
p
=
tdbp
->
To_Line
+
Deplac
;
p
=
tdbp
->
To_Line
+
Deplac
;
field
=
Long
;
field
=
Long
;
switch
(
tdbp
->
Ftype
)
{
/*********************************************************************/
case
RECFM_VAR
:
/*****************************************************************/
/* For a variable length file, check if the field exists. */
/* For a variable length file, check if the field exists. */
/
*****************************************************************/
/****
*****************************************************************/
if
(
strlen
(
tdbp
->
To_Line
)
<
(
unsigned
)
Deplac
)
if
(
tdbp
->
Ftype
==
RECFM_VAR
&&
strlen
(
tdbp
->
To_Line
)
<
(
unsigned
)
Deplac
)
field
=
0
;
field
=
0
;
else
if
(
Dsp
)
for
(
i
=
0
;
i
<
field
;
i
++
)
if
(
p
[
i
]
==
Dsp
)
p
[
i
]
=
'.'
;
switch
(
tdbp
->
Ftype
)
{
case
RECFM_VAR
:
case
RECFM_FIX
:
// Fixed length text file
case
RECFM_FIX
:
// Fixed length text file
case
RECFM_DBF
:
// Fixed length DBase file
case
RECFM_DBF
:
// Fixed length DBase file
if
(
Nod
)
switch
(
Buf_Type
)
{
if
(
Nod
)
switch
(
Buf_Type
)
{
...
@@ -1184,6 +1194,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
...
@@ -1184,6 +1194,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
len
=
sprintf
(
Buf
,
fmt
,
field
-
i
,
Value
->
GetTinyValue
());
len
=
sprintf
(
Buf
,
fmt
,
field
-
i
,
Value
->
GetTinyValue
());
break
;
break
;
case
TYPE_DOUBLE
:
case
TYPE_DOUBLE
:
case
TYPE_DECIM
:
strcpy
(
fmt
,
(
Ldz
)
?
"%0*.*lf"
:
"%*.*lf"
);
strcpy
(
fmt
,
(
Ldz
)
?
"%0*.*lf"
:
"%*.*lf"
);
sprintf
(
Buf
,
fmt
,
field
+
((
Nod
&&
Dcm
)
?
1
:
0
),
sprintf
(
Buf
,
fmt
,
field
+
((
Nod
&&
Dcm
)
?
1
:
0
),
Dcm
,
Value
->
GetFloatValue
());
Dcm
,
Value
->
GetFloatValue
());
...
@@ -1192,7 +1203,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
...
@@ -1192,7 +1203,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
if
(
Nod
&&
Dcm
)
if
(
Nod
&&
Dcm
)
for
(
i
=
k
=
0
;
i
<
len
;
i
++
,
k
++
)
for
(
i
=
k
=
0
;
i
<
len
;
i
++
,
k
++
)
if
(
Buf
[
i
]
!=
' '
)
{
if
(
Buf
[
i
]
!=
' '
)
{
if
(
Buf
[
i
]
==
'.'
||
Buf
[
i
]
==
','
)
if
(
Buf
[
i
]
==
'.'
)
k
++
;
k
++
;
Buf
[
i
]
=
Buf
[
k
];
Buf
[
i
]
=
Buf
[
k
];
...
@@ -1200,10 +1211,13 @@ void DOSCOL::WriteColumn(PGLOBAL g)
...
@@ -1200,10 +1211,13 @@ void DOSCOL::WriteColumn(PGLOBAL g)
len
=
strlen
(
Buf
);
len
=
strlen
(
Buf
);
break
;
break
;
default:
sprintf
(
g
->
Message
,
"Invalid field format for column %s"
,
Name
);
longjmp
(
g
->
jumper
[
g
->
jump_level
],
31
);
}
// endswitch BufType
}
// endswitch BufType
p2
=
Buf
;
p2
=
Buf
;
}
else
// Standard
PlugDB
format
}
else
// Standard
CONNECT
format
p2
=
Value
->
ShowValue
(
Buf
,
field
);
p2
=
Value
->
ShowValue
(
Buf
,
field
);
if
(
trace
)
if
(
trace
)
...
@@ -1212,7 +1226,10 @@ void DOSCOL::WriteColumn(PGLOBAL g)
...
@@ -1212,7 +1226,10 @@ void DOSCOL::WriteColumn(PGLOBAL g)
if
((
len
=
strlen
(
p2
))
>
field
)
{
if
((
len
=
strlen
(
p2
))
>
field
)
{
sprintf
(
g
->
Message
,
MSG
(
VALUE_TOO_LONG
),
p2
,
Name
,
field
);
sprintf
(
g
->
Message
,
MSG
(
VALUE_TOO_LONG
),
p2
,
Name
,
field
);
longjmp
(
g
->
jumper
[
g
->
jump_level
],
31
);
longjmp
(
g
->
jumper
[
g
->
jump_level
],
31
);
}
// endif
}
else
if
(
Dsp
)
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
p2
[
i
]
==
'.'
)
p2
[
i
]
=
Dsp
;
if
(
trace
>
1
)
if
(
trace
>
1
)
htrc
(
"buffer=%s
\n
"
,
p2
);
htrc
(
"buffer=%s
\n
"
,
p2
);
...
...
storage/connect/tabdos.h
View file @
094b01d4
...
@@ -193,7 +193,8 @@ class DllExport DOSCOL : public COLBLK {
...
@@ -193,7 +193,8 @@ class DllExport DOSCOL : public COLBLK {
// Members
// Members
PVAL
To_Val
;
// To value used for Update/Insert
PVAL
To_Val
;
// To value used for Update/Insert
PVAL
OldVal
;
// The previous value of the object.
PVAL
OldVal
;
// The previous value of the object.
char
*
Buf
;
// Buffer used in write operations
char
*
Buf
;
// Buffer used in read/write operations
char
Dsp
;
// The decimal separator
bool
Ldz
;
// True if field contains leading zeros
bool
Ldz
;
// True if field contains leading zeros
bool
Nod
;
// True if no decimal point
bool
Nod
;
// True if no decimal point
int
Dcm
;
// Last Dcm digits are decimals
int
Dcm
;
// Last Dcm digits are decimals
...
...
storage/connect/tabfmt.cpp
View file @
094b01d4
...
@@ -406,7 +406,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
...
@@ -406,7 +406,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
// Double check correctness of offset values
// Double check correctness of offset values
if
(
Catfunc
==
FNC_NO
)
if
(
Catfunc
==
FNC_NO
)
for
(
PCOLDEF
cdp
=
To_Cols
;
cdp
;
cdp
=
cdp
->
GetNext
())
for
(
PCOLDEF
cdp
=
To_Cols
;
cdp
;
cdp
=
cdp
->
GetNext
())
if
(
cdp
->
GetOffset
()
<
1
)
{
if
(
cdp
->
GetOffset
()
<
1
&&
!
cdp
->
IsSpecial
()
)
{
strcpy
(
g
->
Message
,
MSG
(
BAD_OFFSET_VAL
));
strcpy
(
g
->
Message
,
MSG
(
BAD_OFFSET_VAL
));
return
true
;
return
true
;
}
// endif Offset
}
// endif Offset
...
@@ -598,7 +598,7 @@ int TDBCSV::EstimatedLength(PGLOBAL g)
...
@@ -598,7 +598,7 @@ int TDBCSV::EstimatedLength(PGLOBAL g)
PCSVCOL
colp
;
PCSVCOL
colp
;
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
if
(
!
colp
->
IsSpecial
()
)
// Not a pseudo
column
if
(
!
colp
->
IsSpecial
()
&&
!
colp
->
IsVirtual
())
// A true
column
Fields
=
MY_MAX
(
Fields
,
(
int
)
colp
->
Fldnum
);
Fields
=
MY_MAX
(
Fields
,
(
int
)
colp
->
Fldnum
);
if
(
Columns
)
if
(
Columns
)
...
@@ -641,7 +641,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
...
@@ -641,7 +641,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
if
(
!
Fields
)
// May have been set in TABFMT::OpenDB
if
(
!
Fields
)
// May have been set in TABFMT::OpenDB
if
(
Mode
!=
MODE_UPDATE
&&
Mode
!=
MODE_INSERT
)
{
if
(
Mode
!=
MODE_UPDATE
&&
Mode
!=
MODE_INSERT
)
{
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
if
(
!
colp
->
IsSpecial
()
)
// Not a pseudo column
if
(
!
colp
->
IsSpecial
()
&&
!
colp
->
IsVirtual
())
Fields
=
MY_MAX
(
Fields
,
(
int
)
colp
->
Fldnum
);
Fields
=
MY_MAX
(
Fields
,
(
int
)
colp
->
Fldnum
);
if
(
Columns
)
if
(
Columns
)
...
@@ -649,6 +649,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
...
@@ -649,6 +649,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
}
else
}
else
for
(
cdp
=
tdp
->
GetCols
();
cdp
;
cdp
=
cdp
->
GetNext
())
for
(
cdp
=
tdp
->
GetCols
();
cdp
;
cdp
=
cdp
->
GetNext
())
if
(
!
cdp
->
IsVirtual
())
Fields
++
;
Fields
++
;
Offset
=
(
int
*
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
int
)
*
Fields
);
Offset
=
(
int
*
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
int
)
*
Fields
);
...
@@ -672,25 +673,27 @@ bool TDBCSV::OpenDB(PGLOBAL g)
...
@@ -672,25 +673,27 @@ bool TDBCSV::OpenDB(PGLOBAL g)
if
(
Field
)
if
(
Field
)
// Prepare writing fields
// Prepare writing fields
if
(
Mode
!=
MODE_UPDATE
)
if
(
Mode
!=
MODE_UPDATE
)
{
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
{
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
if
(
!
colp
->
IsSpecial
()
&&
!
colp
->
IsVirtual
())
{
i
=
colp
->
Fldnum
;
i
=
colp
->
Fldnum
;
len
=
colp
->
GetLength
();
len
=
colp
->
GetLength
();
Field
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
len
+
1
);
Field
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
len
+
1
);
Field
[
i
][
len
]
=
'\0'
;
Field
[
i
][
len
]
=
'\0'
;
Fldlen
[
i
]
=
len
;
Fldlen
[
i
]
=
len
;
Fldtyp
[
i
]
=
IsTypeNum
(
colp
->
GetResultType
());
Fldtyp
[
i
]
=
IsTypeNum
(
colp
->
GetResultType
());
}
// endfor
colp
}
// endif
colp
else
// MODE_UPDATE
}
else
// MODE_UPDATE
for
(
cdp
=
tdp
->
GetCols
();
cdp
;
cdp
=
cdp
->
GetNext
())
{
for
(
cdp
=
tdp
->
GetCols
();
cdp
;
cdp
=
cdp
->
GetNext
())
if
(
!
cdp
->
IsVirtual
())
{
i
=
cdp
->
GetOffset
()
-
1
;
i
=
cdp
->
GetOffset
()
-
1
;
len
=
cdp
->
GetLength
();
len
=
cdp
->
GetLength
();
Field
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
len
+
1
);
Field
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
len
+
1
);
Field
[
i
][
len
]
=
'\0'
;
Field
[
i
][
len
]
=
'\0'
;
Fldlen
[
i
]
=
len
;
Fldlen
[
i
]
=
len
;
Fldtyp
[
i
]
=
IsTypeNum
(
cdp
->
GetType
());
Fldtyp
[
i
]
=
IsTypeNum
(
cdp
->
GetType
());
}
// endfor col
p
}
// endif cd
p
}
// endif Use
}
// endif Use
...
@@ -1101,7 +1104,7 @@ bool TDBFMT::OpenDB(PGLOBAL g)
...
@@ -1101,7 +1104,7 @@ bool TDBFMT::OpenDB(PGLOBAL g)
PDOSDEF
tdp
=
(
PDOSDEF
)
To_Def
;
PDOSDEF
tdp
=
(
PDOSDEF
)
To_Def
;
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
for
(
colp
=
(
PCSVCOL
)
Columns
;
colp
;
colp
=
(
PCSVCOL
)
colp
->
Next
)
if
(
!
colp
->
IsSpecial
()
)
// Not a pseudo
column
if
(
!
colp
->
IsSpecial
()
&&
!
colp
->
IsVirtual
())
// a true
column
Fields
=
MY_MAX
(
Fields
,
(
int
)
colp
->
Fldnum
);
Fields
=
MY_MAX
(
Fields
,
(
int
)
colp
->
Fldnum
);
if
(
Columns
)
if
(
Columns
)
...
@@ -1115,7 +1118,7 @@ bool TDBFMT::OpenDB(PGLOBAL g)
...
@@ -1115,7 +1118,7 @@ bool TDBFMT::OpenDB(PGLOBAL g)
// Get the column formats
// Get the column formats
for
(
cdp
=
tdp
->
GetCols
();
cdp
;
cdp
=
cdp
->
GetNext
())
for
(
cdp
=
tdp
->
GetCols
();
cdp
;
cdp
=
cdp
->
GetNext
())
if
((
i
=
cdp
->
GetOffset
()
-
1
)
<
Fields
)
{
if
(
!
cdp
->
IsVirtual
()
&&
(
i
=
cdp
->
GetOffset
()
-
1
)
<
Fields
)
{
if
(
!
(
pfm
=
cdp
->
GetFmt
()))
{
if
(
!
(
pfm
=
cdp
->
GetFmt
()))
{
sprintf
(
g
->
Message
,
MSG
(
NO_FLD_FORMAT
),
i
+
1
,
Name
);
sprintf
(
g
->
Message
,
MSG
(
NO_FLD_FORMAT
),
i
+
1
,
Name
);
return
true
;
return
true
;
...
@@ -1318,6 +1321,11 @@ void CSVCOL::ReadColumn(PGLOBAL g)
...
@@ -1318,6 +1321,11 @@ void CSVCOL::ReadColumn(PGLOBAL g)
// Field have been copied in TDB Field array
// Field have been copied in TDB Field array
PSZ
fp
=
tdbp
->
Field
[
Fldnum
];
PSZ
fp
=
tdbp
->
Field
[
Fldnum
];
if
(
Dsp
)
for
(
int
i
=
0
;
fp
[
i
];
i
++
)
if
(
fp
[
i
]
==
Dsp
)
fp
[
i
]
=
'.'
;
Value
->
SetValue_psz
(
fp
);
Value
->
SetValue_psz
(
fp
);
// Set null when applicable
// Set null when applicable
...
@@ -1365,7 +1373,10 @@ void CSVCOL::WriteColumn(PGLOBAL g)
...
@@ -1365,7 +1373,10 @@ void CSVCOL::WriteColumn(PGLOBAL g)
sprintf
(
g
->
Message
,
MSG
(
BAD_FLD_LENGTH
),
Name
,
p
,
flen
,
sprintf
(
g
->
Message
,
MSG
(
BAD_FLD_LENGTH
),
Name
,
p
,
flen
,
tdbp
->
RowNumber
(
g
),
tdbp
->
GetFile
(
g
));
tdbp
->
RowNumber
(
g
),
tdbp
->
GetFile
(
g
));
longjmp
(
g
->
jumper
[
g
->
jump_level
],
34
);
longjmp
(
g
->
jumper
[
g
->
jump_level
],
34
);
}
// endif
}
else
if
(
Dsp
)
for
(
int
i
=
0
;
p
[
i
];
i
++
)
if
(
p
[
i
]
==
'.'
)
p
[
i
]
=
Dsp
;
if
(
trace
>
1
)
if
(
trace
>
1
)
htrc
(
"buffer=%s
\n
"
,
p
);
htrc
(
"buffer=%s
\n
"
,
p
);
...
...
storage/connect/tabmysql.cpp
View file @
094b01d4
...
@@ -191,8 +191,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
...
@@ -191,8 +191,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
}
else
}
else
// Otherwise, straight server name,
// Otherwise, straight server name,
// use tablename of federatedx table as remote table name
Tabname
=
(
b
)
?
GetStringCatInfo
(
g
,
"Tabname"
,
Name
)
:
NULL
;
Tabname
=
Name
;
if
(
trace
)
if
(
trace
)
htrc
(
"server: %s Tabname: %s"
,
url
,
Tabname
);
htrc
(
"server: %s Tabname: %s"
,
url
,
Tabname
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment