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
2e87907e
Commit
2e87907e
authored
Aug 11, 2006
by
jimw@rama.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge rama.(none):/home/jimw/my/mysql-5.0-21284
into rama.(none):/home/jimw/my/mysql-5.1-clean
parents
1257062e
faebd5a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
sql/field.h
sql/field.h
+7
-0
sql/ha_federated.cc
sql/ha_federated.cc
+26
-18
No files found.
sql/field.h
View file @
2e87907e
...
@@ -118,6 +118,11 @@ class Field
...
@@ -118,6 +118,11 @@ class Field
*/
*/
virtual
String
*
val_str
(
String
*
,
String
*
)
=
0
;
virtual
String
*
val_str
(
String
*
,
String
*
)
=
0
;
String
*
val_int_as_str
(
String
*
val_buffer
,
my_bool
unsigned_flag
);
String
*
val_int_as_str
(
String
*
val_buffer
,
my_bool
unsigned_flag
);
/*
str_needs_quotes() returns TRUE if the value returned by val_str() needs
to be quoted when used in constructing an SQL query.
*/
virtual
bool
str_needs_quotes
()
{
return
FALSE
;
}
virtual
Item_result
result_type
()
const
=
0
;
virtual
Item_result
result_type
()
const
=
0
;
virtual
Item_result
cmp_type
()
const
{
return
result_type
();
}
virtual
Item_result
cmp_type
()
const
{
return
result_type
();
}
virtual
Item_result
cast_to_int_type
()
const
{
return
result_type
();
}
virtual
Item_result
cast_to_int_type
()
const
{
return
result_type
();
}
...
@@ -412,6 +417,7 @@ class Field_str :public Field {
...
@@ -412,6 +417,7 @@ class Field_str :public Field {
uint32
max_length
()
{
return
field_length
;
}
uint32
max_length
()
{
return
field_length
;
}
friend
class
create_field
;
friend
class
create_field
;
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
virtual
bool
str_needs_quotes
()
{
return
TRUE
;
}
uint
is_equal
(
create_field
*
new_field
);
uint
is_equal
(
create_field
*
new_field
);
};
};
...
@@ -1379,6 +1385,7 @@ class Field_bit :public Field {
...
@@ -1379,6 +1385,7 @@ class Field_bit :public Field {
double
val_real
(
void
);
double
val_real
(
void
);
longlong
val_int
(
void
);
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
String
*
val_str
(
String
*
,
String
*
);
virtual
bool
str_needs_quotes
()
{
return
TRUE
;
}
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
int
cmp
(
const
char
*
a
,
const
char
*
b
)
int
cmp
(
const
char
*
a
,
const
char
*
b
)
{
return
cmp_binary
(
a
,
b
);
}
{
return
cmp_binary
(
a
,
b
);
}
...
...
sql/ha_federated.cc
View file @
2e87907e
...
@@ -1142,7 +1142,7 @@ bool ha_federated::create_where_from_key(String *to,
...
@@ -1142,7 +1142,7 @@ bool ha_federated::create_where_from_key(String *to,
Field
*
field
=
key_part
->
field
;
Field
*
field
=
key_part
->
field
;
uint
store_length
=
key_part
->
store_length
;
uint
store_length
=
key_part
->
store_length
;
uint
part_length
=
min
(
store_length
,
length
);
uint
part_length
=
min
(
store_length
,
length
);
needs_quotes
=
1
;
needs_quotes
=
field
->
str_needs_quotes
()
;
DBUG_DUMP
(
"key, start of loop"
,
(
char
*
)
ptr
,
length
);
DBUG_DUMP
(
"key, start of loop"
,
(
char
*
)
ptr
,
length
);
if
(
key_part
->
null_bit
)
if
(
key_part
->
null_bit
)
...
@@ -1663,23 +1663,22 @@ int ha_federated::write_row(byte *buf)
...
@@ -1663,23 +1663,22 @@ int ha_federated::write_row(byte *buf)
{
{
commas_added
=
TRUE
;
commas_added
=
TRUE
;
if
((
*
field
)
->
is_null
())
if
((
*
field
)
->
is_null
())
insert_field_value
_string
.
append
(
STRING_WITH_LEN
(
" NULL "
));
values
_string
.
append
(
STRING_WITH_LEN
(
" NULL "
));
else
else
{
{
bool
needs_quote
=
(
*
field
)
->
str_needs_quotes
();
(
*
field
)
->
val_str
(
&
insert_field_value_string
);
(
*
field
)
->
val_str
(
&
insert_field_value_string
);
values_string
.
append
(
'\''
);
if
(
needs_quote
)
values_string
.
append
(
'\''
);
insert_field_value_string
.
print
(
&
values_string
);
insert_field_value_string
.
print
(
&
values_string
);
values_string
.
append
(
'\''
);
if
(
needs_quote
)
values_string
.
append
(
'\''
);
insert_field_value_string
.
length
(
0
);
insert_field_value_string
.
length
(
0
);
}
}
/* append the field name */
/* append the field name */
insert_string
.
append
((
*
field
)
->
field_name
);
insert_string
.
append
((
*
field
)
->
field_name
);
/* append the value */
values_string
.
append
(
insert_field_value_string
);
insert_field_value_string
.
length
(
0
);
/* append commas between both fields and fieldnames */
/* append commas between both fields and fieldnames */
/*
/*
unfortunately, we can't use the logic if *(fields + 1) to
unfortunately, we can't use the logic if *(fields + 1) to
...
@@ -1884,12 +1883,15 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1884,12 +1883,15 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
update_string
.
append
(
STRING_WITH_LEN
(
" NULL "
));
update_string
.
append
(
STRING_WITH_LEN
(
" NULL "
));
else
else
{
{
my_bitmap_map
*
old_map
=
tmp_use_all_columns
(
table
,
table
->
read_set
);
/* otherwise = */
/* otherwise = */
my_bitmap_map
*
old_map
=
tmp_use_all_columns
(
table
,
table
->
read_set
);
bool
needs_quote
=
(
*
field
)
->
str_needs_quotes
();
(
*
field
)
->
val_str
(
&
field_value
);
(
*
field
)
->
val_str
(
&
field_value
);
update_string
.
append
(
'\''
);
if
(
needs_quote
)
update_string
.
append
(
'\''
);
field_value
.
print
(
&
update_string
);
field_value
.
print
(
&
update_string
);
update_string
.
append
(
'\''
);
if
(
needs_quote
)
update_string
.
append
(
'\''
);
field_value
.
length
(
0
);
field_value
.
length
(
0
);
tmp_restore_column_map
(
table
->
read_set
,
old_map
);
tmp_restore_column_map
(
table
->
read_set
,
old_map
);
}
}
...
@@ -1903,12 +1905,15 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1903,12 +1905,15 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
where_string
.
append
(
STRING_WITH_LEN
(
" IS NULL "
));
where_string
.
append
(
STRING_WITH_LEN
(
" IS NULL "
));
else
else
{
{
bool
needs_quote
=
(
*
field
)
->
str_needs_quotes
();
where_string
.
append
(
STRING_WITH_LEN
(
" = "
));
where_string
.
append
(
STRING_WITH_LEN
(
" = "
));
(
*
field
)
->
val_str
(
&
field_value
,
(
*
field
)
->
val_str
(
&
field_value
,
(
char
*
)
(
old_data
+
(
*
field
)
->
offset
()));
(
char
*
)
(
old_data
+
(
*
field
)
->
offset
()));
where_string
.
append
(
'\''
);
if
(
needs_quote
)
where_string
.
append
(
'\''
);
field_value
.
print
(
&
where_string
);
field_value
.
print
(
&
where_string
);
where_string
.
append
(
'\''
);
if
(
needs_quote
)
where_string
.
append
(
'\''
);
field_value
.
length
(
0
);
field_value
.
length
(
0
);
}
}
where_string
.
append
(
STRING_WITH_LEN
(
" AND "
));
where_string
.
append
(
STRING_WITH_LEN
(
" AND "
));
...
@@ -1983,11 +1988,14 @@ int ha_federated::delete_row(const byte *buf)
...
@@ -1983,11 +1988,14 @@ int ha_federated::delete_row(const byte *buf)
}
}
else
else
{
{
delete_string
.
append
(
STRING_WITH_LEN
(
" = "
));
bool
needs_quote
=
cur_field
->
str_needs_quotes
();
cur_field
->
val_str
(
&
data_string
);
delete_string
.
append
(
STRING_WITH_LEN
(
" = "
));
delete_string
.
append
(
'\''
);
cur_field
->
val_str
(
&
data_string
);
data_string
.
print
(
&
delete_string
);
if
(
needs_quote
)
delete_string
.
append
(
'\''
);
delete_string
.
append
(
'\''
);
data_string
.
print
(
&
delete_string
);
if
(
needs_quote
)
delete_string
.
append
(
'\''
);
}
}
delete_string
.
append
(
STRING_WITH_LEN
(
" AND "
));
delete_string
.
append
(
STRING_WITH_LEN
(
" AND "
));
}
}
...
...
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