( ctx sessionctx.Context, dbName pmodel.CIStr, tbInfo *model.TableInfo, involvingRef []model.InvolvingSchemaInfo, cs ...CreateTableOption, )
| 1167 | } |
| 1168 | |
| 1169 | func (e *executor) CreateTableWithInfo( |
| 1170 | ctx sessionctx.Context, |
| 1171 | dbName pmodel.CIStr, |
| 1172 | tbInfo *model.TableInfo, |
| 1173 | involvingRef []model.InvolvingSchemaInfo, |
| 1174 | cs ...CreateTableOption, |
| 1175 | ) (err error) { |
| 1176 | c := GetCreateTableConfig(cs) |
| 1177 | |
| 1178 | jobW, err := e.createTableWithInfoJob(ctx, dbName, tbInfo, involvingRef, c) |
| 1179 | if err != nil { |
| 1180 | return err |
| 1181 | } |
| 1182 | if jobW == nil { |
| 1183 | return nil |
| 1184 | } |
| 1185 | |
| 1186 | err = e.DoDDLJobWrapper(ctx, jobW) |
| 1187 | if err != nil { |
| 1188 | // table exists, but if_not_exists flags is true, so we ignore this error. |
| 1189 | if c.OnExist == OnExistIgnore && infoschema.ErrTableExists.Equal(err) { |
| 1190 | ctx.GetSessionVars().StmtCtx.AppendNote(err) |
| 1191 | err = nil |
| 1192 | } |
| 1193 | } else { |
| 1194 | var scatterScope string |
| 1195 | if val, ok := jobW.GetSessionVars(variable.TiDBScatterRegion); ok { |
| 1196 | scatterScope = val |
| 1197 | } |
| 1198 | |
| 1199 | preSplitAndScatterTable(ctx, e.store, tbInfo, scatterScope) |
| 1200 | if err := handleAutoIncID(e.getAutoIDRequirement(), jobW.Job, tbInfo); err != nil { |
| 1201 | return errors.Trace(err) |
| 1202 | } |
| 1203 | } |
| 1204 | return errors.Trace(err) |
| 1205 | } |
| 1206 | |
| 1207 | func (e *executor) BatchCreateTableWithInfo(ctx sessionctx.Context, |
| 1208 | dbName pmodel.CIStr, |
no test coverage detected