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
410782fd
Commit
410782fd
authored
Mar 14, 2003
by
hf@genie.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCRUM
IS_USED_LOCK('lock') implementation
parent
5e66c763
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
2 deletions
+44
-2
sql/item_create.cc
sql/item_create.cc
+6
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/item_func.cc
sql/item_func.cc
+26
-2
sql/item_func.h
sql/item_func.h
+10
-0
sql/lex.h
sql/lex.h
+1
-0
No files found.
sql/item_create.cc
View file @
410782fd
...
...
@@ -475,6 +475,12 @@ Item *create_func_is_free_lock(Item* a)
return
new
Item_func_is_free_lock
(
a
);
}
Item
*
create_func_is_used_lock
(
Item
*
a
)
{
current_thd
->
lex
.
uncacheable
();
return
new
Item_func_is_used_lock
(
a
);
}
Item
*
create_func_quote
(
Item
*
a
)
{
return
new
Item_func_quote
(
a
);
...
...
sql/item_create.h
View file @
410782fd
...
...
@@ -100,6 +100,7 @@ Item *create_func_version(void);
Item
*
create_func_weekday
(
Item
*
a
);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_func_is_free_lock
(
Item
*
a
);
Item
*
create_func_is_used_lock
(
Item
*
a
);
Item
*
create_func_quote
(
Item
*
a
);
Item
*
create_func_geometry_from_text
(
Item
*
a
);
...
...
sql/item_func.cc
View file @
410782fd
...
...
@@ -1632,8 +1632,10 @@ public:
bool
locked
;
pthread_cond_t
cond
;
pthread_t
thread
;
ulong
thread_id
;
ULL
(
const
char
*
key_arg
,
uint
length
)
:
key_length
(
length
),
count
(
1
),
locked
(
1
)
ULL
(
const
char
*
key_arg
,
uint
length
,
ulong
id
)
:
key_length
(
length
),
count
(
1
),
locked
(
1
),
thread_id
(
id
)
{
key
=
(
char
*
)
my_memdup
((
byte
*
)
key_arg
,
length
,
MYF
(
0
));
pthread_cond_init
(
&
cond
,
NULL
);
...
...
@@ -1837,7 +1839,7 @@ longlong Item_func_get_lock::val_int()
if
(
!
(
ull
=
((
ULL
*
)
hash_search
(
&
hash_user_locks
,(
byte
*
)
res
->
ptr
(),
res
->
length
()))))
{
ull
=
new
ULL
(
res
->
ptr
(),
res
->
length
());
ull
=
new
ULL
(
res
->
ptr
(),
res
->
length
()
,
thd
->
thread_id
);
if
(
!
ull
||
!
ull
->
initialized
())
{
delete
ull
;
...
...
@@ -2698,6 +2700,28 @@ longlong Item_func_is_free_lock::val_int()
return
0
;
}
longlong
Item_func_is_used_lock
::
val_int
()
{
String
*
res
=
args
[
0
]
->
val_str
(
&
value
);
THD
*
thd
=
current_thd
;
ULL
*
ull
;
null_value
=
1
;
if
(
!
res
||
!
res
->
length
())
return
0
;
pthread_mutex_lock
(
&
LOCK_user_locks
);
ull
=
(
ULL
*
)
hash_search
(
&
hash_user_locks
,(
byte
*
)
res
->
ptr
(),
res
->
length
());
pthread_mutex_unlock
(
&
LOCK_user_locks
);
if
(
!
ull
||
!
ull
->
locked
)
return
0
;
null_value
=
0
;
return
ull
->
thread_id
;
}
/**************************************************************************
Spatial functions
...
...
sql/item_func.h
View file @
410782fd
...
...
@@ -1151,6 +1151,16 @@ public:
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
1
;
maybe_null
=
1
;}
};
class
Item_func_is_used_lock
:
public
Item_int_func
{
String
value
;
public:
Item_func_is_used_lock
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"is_used_lock"
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
10
;
maybe_null
=
1
;}
};
/* For type casts */
enum
Item_cast
...
...
sql/lex.h
View file @
410782fd
...
...
@@ -509,6 +509,7 @@ static SYMBOL sql_functions[] = {
{
"ISEMPTY"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_isempty
)},
{
"ISNULL"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_isnull
)},
{
"IS_FREE_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_is_free_lock
)},
{
"IS_USED_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_is_used_lock
)},
{
"LAST_INSERT_ID"
,
SYM
(
LAST_INSERT_ID
),
0
,
0
},
{
"ISSIMPLE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_issimple
)},
{
"LCASE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
...
...
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