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
3a0df3cf
Commit
3a0df3cf
authored
Sep 15, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-8372 Use helper methods introduced in MDEV-7824 all around the code
parent
3079bd43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
sql/field.cc
sql/field.cc
+3
-5
sql/sql_select.cc
sql/sql_select.cc
+5
-8
No files found.
sql/field.cc
View file @
3a0df3cf
...
...
@@ -10434,16 +10434,14 @@ Create_field::Create_field(THD *thd, Field *old_field, Field *orig_field)
if
(
!
default_now
)
// Give a constant default
{
/* Get the value from default_values */
my_ptrdiff_t
diff
=
orig_field
->
table
->
default_values_offset
();
orig_field
->
move_field_offset
(
diff
);
// Points now at default_values
if
(
!
orig_field
->
is_real_null
())
const
uchar
*
dv
=
orig_field
->
table
->
s
->
default_values
;
if
(
!
orig_field
->
is_null_in_record
(
dv
))
{
StringBuffer
<
MAX_FIELD_WIDTH
>
tmp
(
charset
);
String
*
res
=
orig_field
->
val_str
(
&
tmp
);
String
*
res
=
orig_field
->
val_str
(
&
tmp
,
orig_field
->
ptr_in_record
(
dv
)
);
char
*
pos
=
(
char
*
)
sql_strmake
(
res
->
ptr
(),
res
->
length
());
def
=
new
(
thd
->
mem_root
)
Item_string
(
thd
,
pos
,
res
->
length
(),
charset
);
}
orig_field
->
move_field_offset
(
-
diff
);
// Back to record[0]
}
}
}
...
...
sql/sql_select.cc
View file @
3a0df3cf
...
...
@@ -16571,20 +16571,17 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
inherit the default value that is defined for the field referred
by the Item_field object from which 'field' has been created.
*/
my_ptrdiff_t
diff
;
Field
*
orig_field
=
default_field
[
i
];
const
Field
*
orig_field
=
default_field
[
i
];
/* Get the value from default_values */
diff
=
(
my_ptrdiff_t
)
(
orig_field
->
table
->
s
->
default_values
-
orig_field
->
table
->
record
[
0
]);
orig_field
->
move_field_offset
(
diff
);
// Points now at default_values
if
(
orig_field
->
is_real_null
())
if
(
orig_field
->
is_null_in_record
(
orig_field
->
table
->
s
->
default_values
))
field
->
set_null
();
else
{
field
->
set_notnull
();
memcpy
(
field
->
ptr
,
orig_field
->
ptr
,
field
->
pack_length
());
memcpy
(
field
->
ptr
,
orig_field
->
ptr_in_record
(
orig_field
->
table
->
s
->
default_values
),
field
->
pack_length
());
}
orig_field
->
move_field_offset
(
-
diff
);
// Back to record[0]
}
if
(
from_field
[
i
])
...
...
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