Merging into main #1
@@ -33,9 +33,10 @@ func Run() {
|
||||
switch statement.PrepareStatements(inputBuffer) {
|
||||
case PrepareSuccess:
|
||||
//todo
|
||||
case PrepareSyntaxError:
|
||||
fmt.Println("Syntax error, could not parse statement")
|
||||
case PrepareUnrecognised:
|
||||
fmt.Printf("Unrecognised keyword at the start of '%s'.\n", inputBuffer.Buffer)
|
||||
continue
|
||||
}
|
||||
|
||||
switch statement.ExecuteStatement(table) {
|
||||
|
||||
+5
-5
@@ -151,11 +151,11 @@ func DoMetaCommands(inputBuffer *InputBuffer) MetaCommandResults {
|
||||
func (statement *Statement) PrepareStatements(inputBuffer *InputBuffer) PrepareResults {
|
||||
if strings.HasPrefix(inputBuffer.Buffer, "insert") {
|
||||
argsAssigned, err := fmt.Sscanf(inputBuffer.Buffer, "insert %d %s %s", &statement.row.id, &statement.row.username, &statement.row.email)
|
||||
if err != nil {
|
||||
fmt.Println("error parsing insert statement")
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
if argsAssigned > 3 {
|
||||
// if err != nil {
|
||||
// fmt.Println("error parsing insert statement")
|
||||
// fmt.Println(err.Error())
|
||||
// }
|
||||
if err != nil || argsAssigned > 3 {
|
||||
return PrepareSyntaxError
|
||||
}
|
||||
statement.stype = StatementInsert
|
||||
|
||||
Reference in New Issue
Block a user