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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
05b30fbc
Commit
05b30fbc
authored
Apr 04, 2015
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MDEV-7890
parent
836740cd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
16 deletions
+48
-16
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+17
-13
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+1
-1
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+1
-2
storage/connect/xobject.cpp
storage/connect/xobject.cpp
+28
-0
storage/connect/xobject.h
storage/connect/xobject.h
+1
-0
No files found.
storage/connect/ha_connect.cc
View file @
05b30fbc
...
...
@@ -2173,12 +2173,12 @@ int ha_connect::CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf)
/***********************************************************************/
/* Return the where clause for remote indexed read. */
/***********************************************************************/
bool
ha_connect
::
MakeKeyWhere
(
PGLOBAL
g
,
char
*
qry
,
OPVAL
op
,
char
*
q
,
bool
ha_connect
::
MakeKeyWhere
(
PGLOBAL
g
,
PSTRG
qry
,
OPVAL
op
,
char
q
,
const
void
*
key
,
int
klen
)
{
const
uchar
*
ptr
;
uint
rem
,
len
,
stlen
;
//, prtlen;
bool
nq
,
b
=
false
;
bool
nq
,
oom
,
b
=
false
;
Field
*
fp
;
KEY
*
kfp
;
KEY_PART_INFO
*
kpart
;
...
...
@@ -2190,7 +2190,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
return
true
;
}
// endif key
strcat
(
qry
,
" WHERE ("
);
oom
=
qry
->
Append
(
" WHERE ("
);
kfp
=
&
table
->
key_info
[
active_index
];
rem
=
kfp
->
user_defined_key_parts
,
len
=
klen
,
...
...
@@ -2203,24 +2203,26 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
nq
=
fp
->
str_needs_quotes
();
if
(
b
)
strcat
(
qry
,
" AND "
);
oom
|=
qry
->
Append
(
" AND "
);
else
b
=
true
;
strcat
(
strncat
(
strcat
(
qry
,
q
),
fp
->
field_name
,
strlen
(
fp
->
field_name
)),
q
);
oom
|=
qry
->
Append
(
q
);
oom
|=
qry
->
Append
((
PSZ
)
fp
->
field_name
);
oom
|=
qry
->
Append
(
q
);
switch
(
op
)
{
case
OP_EQ
:
case
OP_GT
:
case
OP_GE
:
strcat
(
qry
,
GetValStr
(
op
,
false
));
oom
|=
qry
->
Append
((
PSZ
)
GetValStr
(
op
,
false
));
break
;
default:
strcat
(
qry
,
" ??? "
);
oom
|=
qry
->
Append
(
" ??? "
);
}
// endwitch op
if
(
nq
)
strcat
(
qry
,
"'"
);
oom
|=
qry
->
Append
(
'\''
);
if
(
kpart
->
key_part_flag
&
HA_VAR_LENGTH_PART
)
{
String
varchar
;
...
...
@@ -2228,17 +2230,17 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
varchar
.
set_quick
((
char
*
)
ptr
+
HA_KEY_BLOB_LENGTH
,
var_length
,
&
my_charset_bin
);
strncat
(
qry
,
varchar
.
ptr
(),
varchar
.
length
());
oom
|=
qry
->
Append
(
varchar
.
ptr
(),
varchar
.
length
());
}
else
{
char
strbuff
[
MAX_FIELD_WIDTH
];
String
str
(
strbuff
,
sizeof
(
strbuff
),
kpart
->
field
->
charset
()),
*
res
;
res
=
fp
->
val_str
(
&
str
,
ptr
);
strncat
(
qry
,
res
->
ptr
(),
res
->
length
());
oom
|=
qry
->
Append
(
res
->
ptr
(),
res
->
length
());
}
// endif flag
if
(
nq
)
strcat
(
qry
,
"'"
);
oom
|=
qry
->
Append
(
'\''
);
if
(
stlen
>=
len
)
break
;
...
...
@@ -2251,8 +2253,10 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
ptr
+=
stlen
-
MY_TEST
(
kpart
->
null_bit
);
}
// endfor kpart
strcat
(
qry
,
")"
);
return
false
;
if
((
oom
|=
qry
->
Append
(
")"
)))
strcpy
(
g
->
Message
,
"Out of memory"
);
return
oom
;
}
// end of MakeKeyWhere
...
...
storage/connect/ha_connect.h
View file @
05b30fbc
...
...
@@ -235,7 +235,7 @@ public:
int
CheckRecord
(
PGLOBAL
g
,
const
uchar
*
oldbuf
,
uchar
*
newbuf
);
int
ReadIndexed
(
uchar
*
buf
,
OPVAL
op
,
const
uchar
*
key
=
NULL
,
uint
key_len
=
0
);
bool
MakeKeyWhere
(
PGLOBAL
g
,
char
*
qry
,
OPVAL
op
,
char
*
q
,
bool
MakeKeyWhere
(
PGLOBAL
g
,
PSTRG
qry
,
OPVAL
op
,
char
q
,
const
void
*
key
,
int
klen
);
inline
char
*
Strz
(
LEX_STRING
&
ls
);
...
...
storage/connect/tabmysql.cpp
View file @
05b30fbc
...
...
@@ -1078,8 +1078,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
if
(
Myc
.
m_Res
)
Myc
.
FreeResult
();
To_Def
->
GetHandler
()
->
MakeKeyWhere
(
g
,
Query
->
GetStr
(),
op
,
"`"
,
key
,
len
);
To_Def
->
GetHandler
()
->
MakeKeyWhere
(
g
,
Query
,
op
,
'`'
,
key
,
len
);
if
(
To_CondFil
)
{
oom
=
Query
->
Append
(
" AND ("
);
...
...
storage/connect/xobject.cpp
View file @
05b30fbc
...
...
@@ -289,6 +289,34 @@ bool STRING::Set(char *s, uint n)
return
false
;
}
// end of Set
/***********************************************************************/
/* Append a char* to a STRING. */
/***********************************************************************/
bool
STRING
::
Append
(
const
char
*
s
,
uint
ln
)
{
if
(
!
s
)
return
false
;
uint
len
=
Length
+
ln
+
1
;
if
(
len
>
Size
)
{
char
*
p
=
Realloc
(
len
);
if
(
!
p
)
return
true
;
else
if
(
p
!=
Strp
)
{
strcpy
(
p
,
Strp
);
Strp
=
p
;
}
// endif p
}
// endif n
strncpy
(
Strp
+
Length
,
s
,
ln
);
Length
=
len
-
1
;
Strp
[
Length
]
=
0
;
return
false
;
}
// end of Append
/***********************************************************************/
/* Append a PSZ to a STRING. */
/***********************************************************************/
...
...
storage/connect/xobject.h
View file @
05b30fbc
...
...
@@ -134,6 +134,7 @@ class DllExport STRING : public BLOCK {
inline
void
Reset
(
void
)
{
*
Strp
=
0
;}
bool
Set
(
PSZ
s
);
bool
Set
(
char
*
s
,
uint
n
);
bool
Append
(
const
char
*
s
,
uint
ln
);
bool
Append
(
PSZ
s
);
bool
Append
(
STRING
&
str
);
bool
Append
(
char
c
);
...
...
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