-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathinsert.go
More file actions
27 lines (23 loc) · 734 Bytes
/
insert.go
File metadata and controls
27 lines (23 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
* Radon
*
* Copyright 2018 The Radon Authors.
* Code is licensed under the GPLv3.
*
*/
package proxy
import (
"github.com/xelabs/go-mysqlstack/driver"
"github.com/xelabs/go-mysqlstack/sqlparser"
"github.com/xelabs/go-mysqlstack/sqlparser/depends/sqltypes"
)
// handleInsert used to handle the insert command.
func (spanner *Spanner) handleInsert(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error) {
database := session.Schema()
autoincPlug := spanner.plugins.PlugAutoIncrement()
// AutoIncrement plugin process.
if err := autoincPlug.Process(database, node.(*sqlparser.Insert)); err != nil {
return nil, err
}
return spanner.ExecuteDML(session, database, query, node)
}