Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

How to mock a simple insert statement? #16

Open

Description

@noahyao1024

Thanks you, I want to proxy some query to my own HTTP server, But it does't work on 'INSERT' while 'SELECT' is maybe perfect.

I use this piece of snippet to response, But MySQL received as a Empty query.
if strings.HasPrefix(query, "insert") {
testResult.InsertID = 100
testResult.RowsAffected = 1
testResult.Rows = append(make([][]sqltypes.Value, 0), testResult.Rows[0])
testResult.Rows = make([][]sqltypes.Value, 0)
}

Thanks you very much

Activity

  1. noahyao1024 commented on Jan 5, 2023

    @noahyao1024
    Author

    @bohutang HELP!

  2. bohutang commented on Jan 5, 2023

    @bohutang
    Collaborator

    The codes are no longer maintained, but I'm sure they work.
    I guess the issue is building the testResult, you can try to build it like this:

    https://github.com/xelabs/go-mysqlstack/blob/master/driver/client_test.go#L24-L27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions