本文整理汇总了Golang中github.com/youtube/vitess/go/vt/sqlparser.DDLParse函数的典型用法代码示例。如果您正苦于以下问题:Golang DDLParse函数的具体用法?Golang DDLParse怎么用?Golang DDLParse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DDLParse函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: execDDL
func (qe *QueryEngine) execDDL(logStats *sqlQueryStats, ddl string) *mproto.QueryResult {
ddlPlan := sqlparser.DDLParse(ddl)
if ddlPlan.Action == 0 {
panic(NewTabletError(FAIL, "DDL is not understood"))
}
// Stolen from Begin
conn := qe.txPool.Get()
txid, err := qe.activeTxPool.SafeBegin(conn)
if err != nil {
conn.Recycle()
panic(err)
}
// Stolen from Commit
defer qe.activeTxPool.SafeCommit(txid)
// Stolen from Execute
conn = qe.activeTxPool.Get(txid)
defer conn.Recycle()
result, err := qe.executeSql(logStats, conn, ddl, false)
if err != nil {
panic(NewTabletErrorSql(FAIL, err))
}
qe.schemaInfo.DropTable(ddlPlan.TableName)
if ddlPlan.Action != sqlparser.DROP { // CREATE, ALTER, RENAME
qe.schemaInfo.CreateTable(ddlPlan.NewName)
}
return result
}
开发者ID:jekey,项目名称:vitess,代码行数:30,代码来源:query_engine.go
示例2: InvalidateForDDL
// InvalidateForDDL performs schema and rowcache changes for the ddl.
func (qe *QueryEngine) InvalidateForDDL(ddlInvalidate *proto.DDLInvalidate) {
ddlPlan := sqlparser.DDLParse(ddlInvalidate.DDL)
if ddlPlan.Action == 0 {
panic(NewTabletError(FAIL, "DDL is not understood"))
}
qe.schemaInfo.DropTable(ddlPlan.TableName)
if ddlPlan.Action != sqlparser.DROP { // CREATE, ALTER, RENAME
qe.schemaInfo.CreateTable(ddlPlan.NewName)
}
}
开发者ID:kingpro,项目名称:vitess,代码行数:11,代码来源:query_engine.go
示例3: InvalidateForDDL
func (qe *QueryEngine) InvalidateForDDL(ddlInvalidate *proto.DDLInvalidate) {
qe.mu.RLock()
defer qe.mu.RUnlock()
ddlPlan := sqlparser.DDLParse(ddlInvalidate.DDL)
if ddlPlan.Action == 0 {
panic(NewTabletError(FAIL, "DDL is not understood"))
}
qe.schemaInfo.DropTable(ddlPlan.TableName)
if ddlPlan.Action != sqlparser.DROP { // CREATE, ALTER, RENAME
qe.schemaInfo.CreateTable(ddlPlan.NewName)
}
qe.adminCache.Set(ROWCACHE_INVALIDATION_POSITION, 0, 0, []byte(ddlInvalidate.Position))
}
开发者ID:shrutip,项目名称:vitess,代码行数:14,代码来源:query_engine.go
注:本文中的github.com/youtube/vitess/go/vt/sqlparser.DDLParse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论