0

I am trying to create two tables with a single query statement. However, below code is creating just 'myprofile' table only. It doesn't create 'groups' table. Am I missing something here? Can someone please help.

let createTableString = """
                    CREATE TABLE `myprofile` (`profile_id` VARCHAR , `first_name` VARCHAR , `profile_type` VARCHAR ,`preferences` VARCHAR);
                    CREATE TABLE `groups` (`account_id` VARCHAR ,`unique_url` VARCHAR, `title` VARCHAR, `participant_id` VARCHAR ,`create_date` VARCHAR,`synced` VARCHAR);
    """

private func createTable() {
      var createTableStatement: OpaquePointer?
      if sqlite3_prepare_v2(db, createTableString, -1, &createTableStatement, nil) == SQLITE_OK {
          if sqlite3_step(createTableStatement) == SQLITE_DONE {
              print("\table's are created.")
          } else {
              print("\table's are not created.")
        }
      } else {
          print("\nCREATE TABLE statement is not prepared.")
      }

      sqlite3_finalize(createTableStatement)
    }
3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.