зеркало из https://github.com/github/vitess-gh.git
Merge pull request #66 from github/patrickcarnahan/mysql8-lock-syntax
Add support for new lock syntax in MySQL8
This commit is contained in:
Коммит
6b8851d007
|
@ -1169,6 +1169,16 @@ func (lock Lock) ToString() string {
|
|||
return NoLockStr
|
||||
case ForUpdateLock:
|
||||
return ForUpdateStr
|
||||
case ForUpdateLockNoWait:
|
||||
return ForUpdateNoWaitStr
|
||||
case ForUpdateLockSkipLocked:
|
||||
return ForUpdateSkipLockedStr
|
||||
case ForShareLock:
|
||||
return ForShareStr
|
||||
case ForShareLockNoWait:
|
||||
return ForShareNoWaitStr
|
||||
case ForShareLockSkipLocked:
|
||||
return ForShareSkipLockedStr
|
||||
case ShareModeLock:
|
||||
return ShareModeStr
|
||||
default:
|
||||
|
|
|
@ -25,9 +25,14 @@ const (
|
|||
SQLCalcFoundRowsStr = "sql_calc_found_rows "
|
||||
|
||||
// Select.Lock
|
||||
NoLockStr = ""
|
||||
ForUpdateStr = " for update"
|
||||
ShareModeStr = " lock in share mode"
|
||||
NoLockStr = ""
|
||||
ForUpdateStr = " for update"
|
||||
ForUpdateNoWaitStr = " for update nowait"
|
||||
ForUpdateSkipLockedStr = " for update skip locked"
|
||||
ForShareStr = " for share"
|
||||
ForShareNoWaitStr = " for share nowait"
|
||||
ForShareSkipLockedStr = " for share skip locked"
|
||||
ShareModeStr = " lock in share mode"
|
||||
|
||||
// Select.Cache
|
||||
SQLCacheStr = "sql_cache "
|
||||
|
@ -468,6 +473,11 @@ const (
|
|||
NoLock Lock = iota
|
||||
ForUpdateLock
|
||||
ShareModeLock
|
||||
ForShareLock
|
||||
ForShareLockNoWait
|
||||
ForShareLockSkipLocked
|
||||
ForUpdateLockNoWait
|
||||
ForUpdateLockSkipLocked
|
||||
)
|
||||
|
||||
// Constants for Enum Type - TrimType
|
||||
|
|
|
@ -403,6 +403,7 @@ var keywords = []keyword{
|
|||
{"localtimestamp", LOCALTIMESTAMP},
|
||||
{"locate", LOCATE},
|
||||
{"lock", LOCK},
|
||||
{"locked", LOCKED},
|
||||
{"logs", LOGS},
|
||||
{"long", UNUSED},
|
||||
{"longblob", LONGBLOB},
|
||||
|
@ -447,6 +448,7 @@ var keywords = []keyword{
|
|||
{"none", NONE},
|
||||
{"not", NOT},
|
||||
{"now", NOW},
|
||||
{"nowait", NOWAIT},
|
||||
{"no_write_to_binlog", NO_WRITE_TO_BINLOG},
|
||||
{"nth_value", NTH_VALUE},
|
||||
{"ntile", NTILE},
|
||||
|
@ -560,6 +562,7 @@ var keywords = []keyword{
|
|||
{"signal", UNUSED},
|
||||
{"signed", SIGNED},
|
||||
{"simple", SIMPLE},
|
||||
{"skip", SKIP},
|
||||
{"slow", SLOW},
|
||||
{"smallint", SMALLINT},
|
||||
{"spatial", SPATIAL},
|
||||
|
|
|
@ -371,8 +371,18 @@ var (
|
|||
input: "select /* distinct */ distinct 1 from t",
|
||||
}, {
|
||||
input: "select /* straight_join */ straight_join 1 from t",
|
||||
}, {
|
||||
input: "select /* for share */ 1 from t for share",
|
||||
}, {
|
||||
input: "select /* for share */ 1 from t for share nowait",
|
||||
}, {
|
||||
input: "select /* for share */ 1 from t for share skip locked",
|
||||
}, {
|
||||
input: "select /* for update */ 1 from t for update",
|
||||
}, {
|
||||
input: "select /* for update */ 1 from t for update nowait",
|
||||
}, {
|
||||
input: "select /* for update */ 1 from t for update skip locked",
|
||||
}, {
|
||||
input: "select /* lock in share mode */ 1 from t lock in share mode",
|
||||
}, {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -6868,6 +6868,26 @@ FOR UPDATE
|
|||
{
|
||||
$$ = ForUpdateLock
|
||||
}
|
||||
| FOR UPDATE NOWAIT
|
||||
{
|
||||
$$ = ForUpdateLockNoWait
|
||||
}
|
||||
| FOR UPDATE SKIP LOCKED
|
||||
{
|
||||
$$ = ForUpdateLockSkipLocked
|
||||
}
|
||||
| FOR SHARE
|
||||
{
|
||||
$$ = ForShareLock
|
||||
}
|
||||
| FOR SHARE NOWAIT
|
||||
{
|
||||
$$ = ForShareLockNoWait
|
||||
}
|
||||
| FOR SHARE SKIP LOCKED
|
||||
{
|
||||
$$ = ForShareLockSkipLocked
|
||||
}
|
||||
| LOCK IN SHARE MODE
|
||||
{
|
||||
$$ = ShareModeLock
|
||||
|
|
|
@ -1004,7 +1004,7 @@ INPUT
|
|||
SELECT 1 FOR SHARE UNION SELECT 2;
|
||||
END
|
||||
ERROR
|
||||
syntax error at position 19 near 'SHARE'
|
||||
syntax error at position 25 near 'UNION'
|
||||
END
|
||||
INPUT
|
||||
SELECT ST_AsText(ST_Union(shore, boundary)) FROM lakes, named_places WHERE lakes.name = 'Blue Lake' AND named_places.name = 'Goose Island';
|
||||
|
|
Загрузка…
Ссылка в новой задаче