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
b7403f3d
Commit
b7403f3d
authored
Aug 08, 2002
by
ram@ram.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new QUOTE() fuction has been added
parent
77296b3f
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 @
b7403f3d
...
@@ -73,3 +73,4 @@ worm@altair.is.lan
...
@@ -73,3 +73,4 @@ worm@altair.is.lan
zak@balfor.local
zak@balfor.local
zak@linux.local
zak@linux.local
zgreant@mysql.com
zgreant@mysql.com
ram@ram.(none)
sql/item_create.cc
View file @
b7403f3d
...
@@ -440,3 +440,7 @@ Item *create_func_is_free_lock(Item* a)
...
@@ -440,3 +440,7 @@ Item *create_func_is_free_lock(Item* a)
return
new
Item_func_is_free_lock
(
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 @
b7403f3d
...
@@ -93,3 +93,4 @@ Item *create_func_weekday(Item* a);
...
@@ -93,3 +93,4 @@ Item *create_func_weekday(Item* a);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_is_free_lock
(
Item
*
a
);
Item
*
create_func_is_free_lock
(
Item
*
a
);
Item
*
create_func_quote
(
Item
*
a
);
sql/item_strfunc.cc
View file @
b7403f3d
...
@@ -2070,3 +2070,56 @@ String* Item_func_inet_ntoa::val_str(String* str)
...
@@ -2070,3 +2070,56 @@ String* Item_func_inet_ntoa::val_str(String* str)
str
->
length
(
str
->
length
()
-
1
);
// Remove last '.';
str
->
length
(
str
->
length
()
-
1
);
// Remove last '.';
return
str
;
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 @
b7403f3d
...
@@ -535,3 +535,12 @@ public:
...
@@ -535,3 +535,12 @@ public:
const
char
*
func_name
()
const
{
return
"inet_ntoa"
;
}
const
char
*
func_name
()
const
{
return
"inet_ntoa"
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
3
*
8
+
7
;
}
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 @
b7403f3d
...
@@ -475,6 +475,7 @@ static SYMBOL sql_functions[] = {
...
@@ -475,6 +475,7 @@ static SYMBOL sql_functions[] = {
{
"POW"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_pow
)},
{
"POW"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_pow
)},
{
"POWER"
,
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
)},
{
"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
)},
{
"RADIANS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_radians
)},
{
"RAND"
,
SYM
(
RAND
),
0
,
0
},
{
"RAND"
,
SYM
(
RAND
),
0
,
0
},
{
"RELEASE_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_release_lock
)},
{
"RELEASE_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_release_lock
)},
...
...
sql/sql_yacc.yy
View file @
b7403f3d
...
@@ -283,6 +283,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -283,6 +283,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token PROCESS
%token PROCESS
%token PROCESSLIST_SYM
%token PROCESSLIST_SYM
%token QUERY_SYM
%token QUERY_SYM
%token QUOTE
%token RAID_0_SYM
%token RAID_0_SYM
%token RAID_STRIPED_SYM
%token RAID_STRIPED_SYM
%token RAID_TYPE
%token RAID_TYPE
...
@@ -1815,6 +1816,8 @@ simple_expr:
...
@@ -1815,6 +1816,8 @@ simple_expr:
}
}
| POSITION_SYM '(' no_in_expr IN_SYM expr ')'
| POSITION_SYM '(' no_in_expr IN_SYM expr ')'
{ $$ = new Item_func_locate($5,$3); }
{ $$ = new Item_func_locate($5,$3); }
| QUOTE '(' expr ')'
{ $$= new Item_func_quote($3); }
| RAND '(' expr ')'
| RAND '(' expr ')'
{ $$= new Item_func_rand($3); current_thd->safe_to_cache_query=0;}
{ $$= new Item_func_rand($3); current_thd->safe_to_cache_query=0;}
| RAND '(' ')'
| 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