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
4c3f3b5b
Commit
4c3f3b5b
authored
Aug 08, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new QUOTE() fuction has been added
BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
parent
af27243c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
0 deletions
+72
-0
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
sql/item_create.cc
sql/item_create.cc
+4
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+53
-0
sql/item_strfunc.h
sql/item_strfunc.h
+9
-0
sql/lex.h
sql/lex.h
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-0
No files found.
BitKeeper/etc/logging_ok
View file @
4c3f3b5b
...
...
@@ -73,3 +73,4 @@ worm@altair.is.lan
zak@balfor.local
zak@linux.local
zgreant@mysql.com
ram@ram.(none)
sql/item_create.cc
View file @
4c3f3b5b
...
...
@@ -440,3 +440,7 @@ Item *create_func_is_free_lock(Item* a)
return
new
Item_func_is_free_lock
(
a
);
}
Item
*
create_func_quote
(
Item
*
a
)
{
return
new
Item_func_quote
(
a
);
}
sql/item_create.h
View file @
4c3f3b5b
...
...
@@ -93,3 +93,4 @@ Item *create_func_weekday(Item* a);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_is_free_lock
(
Item
*
a
);
Item
*
create_func_quote
(
Item
*
a
);
sql/item_strfunc.cc
View file @
4c3f3b5b
...
...
@@ -2070,3 +2070,56 @@ String* Item_func_inet_ntoa::val_str(String* str)
str
->
length
(
str
->
length
()
-
1
);
// Remove last '.';
return
str
;
}
String
*
Item_func_quote
::
val_str
(
String
*
str
)
{
String
*
arg
=
args
[
0
]
->
val_str
(
str
);
char
*
strptr
,
*
argptr
,
*
end
,
*
arglast
;
uint
delta
=
2
;
/* for beginning and ending ' signs */
for
(
argptr
=
(
char
*
)
arg
->
ptr
(),
end
=
argptr
+
arg
->
length
();
argptr
<
end
;
argptr
++
)
{
switch
(
*
argptr
)
{
case
'\''
:
case
'\\'
:
case
0
:
case
'\032'
:
delta
++
;
}
}
if
(
str
->
alloc
(
arg
->
length
()
+
delta
))
{
null_value
=
1
;
return
0
;
}
strptr
=
(
char
*
)
str
->
ptr
()
+
arg
->
length
()
+
delta
-
1
;
*
strptr
=
'\''
;
for
(
end
=
(
char
*
)
arg
->
ptr
(),
arglast
=
end
+
arg
->
length
(),
argptr
=
arglast
-
1
;
argptr
>=
end
;
argptr
--
)
{
switch
(
*
argptr
)
{
case
'\''
:
case
'\\'
:
case
0
:
case
'\032'
:
strptr
-=
arglast
-
argptr
;
memmove
(
strptr
,
argptr
,
arglast
-
argptr
);
arglast
=
argptr
;
*--
strptr
=
'\\'
;
}
}
if
(
arglast
!=
end
)
{
strptr
-=
arglast
-
end
;
memmove
(
strptr
,
end
,
arglast
-
end
);
}
*--
strptr
=
'\''
;
str
->
length
(
arg
->
length
()
+
delta
);
return
str
;
}
void
Item_func_quote
::
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
*
2
+
2
;
}
sql/item_strfunc.h
View file @
4c3f3b5b
...
...
@@ -535,3 +535,12 @@ class Item_func_export_set: public Item_str_func
const
char
*
func_name
()
const
{
return
"inet_ntoa"
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
3
*
8
+
7
;
}
};
class
Item_func_quote
:
public
Item_str_func
{
public:
Item_func_quote
(
Item
*
a
)
:
Item_str_func
(
a
)
{}
const
char
*
func_name
()
const
{
return
"quote"
;
}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
};
sql/lex.h
View file @
4c3f3b5b
...
...
@@ -475,6 +475,7 @@ static SYMBOL sql_functions[] = {
{
"POW"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_pow
)},
{
"POWER"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_pow
)},
{
"QUARTER"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_quarter
)},
{
"QUOTE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_quote
)},
{
"RADIANS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_radians
)},
{
"RAND"
,
SYM
(
RAND
),
0
,
0
},
{
"RELEASE_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_release_lock
)},
...
...
sql/sql_yacc.yy
View file @
4c3f3b5b
...
...
@@ -283,6 +283,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token PROCESS
%token PROCESSLIST_SYM
%token QUERY_SYM
%token QUOTE
%token RAID_0_SYM
%token RAID_STRIPED_SYM
%token RAID_TYPE
...
...
@@ -1815,6 +1816,8 @@ simple_expr:
}
| POSITION_SYM '(' no_in_expr IN_SYM expr ')'
{ $$ = new Item_func_locate($5,$3); }
| QUOTE '(' expr ')'
{ $$= new Item_func_quote($3); }
| RAND '(' expr ')'
{ $$= new Item_func_rand($3); current_thd->safe_to_cache_query=0;}
| RAND '(' ')'
...
...
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