{"action":"opened","issue":{"url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/51","repository_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock","labels_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/51/comments","events_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/51/events","html_url":"https://github.com/DATA-DOG/go-sqlmock/issues/51","id":186823064,"number":51,"title":"ExpectQuery in prepared statement fails if the argument is \"2\" ( or, putatively greater than 1) ","user":{"login":"luistm","id":15702603,"avatar_url":"https://avatars.githubusercontent.com/u/15702603?v=3","gravatar_id":"","url":"https://api.github.com/users/luistm","html_url":"https://github.com/luistm","followers_url":"https://api.github.com/users/luistm/followers","following_url":"https://api.github.com/users/luistm/following{/other_user}","gists_url":"https://api.github.com/users/luistm/gists{/gist_id}","starred_url":"https://api.github.com/users/luistm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luistm/subscriptions","organizations_url":"https://api.github.com/users/luistm/orgs","repos_url":"https://api.github.com/users/luistm/repos","events_url":"https://api.github.com/users/luistm/events{/privacy}","received_events_url":"https://api.github.com/users/luistm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-02T14:52:56Z","updated_at":"2016-11-02T14:52:56Z","closed_at":null,"body":"Hi ,\r\n\r\nThe following test will fail:\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"database/sql\"\r\n\t\"fmt\"\r\n)\r\n\r\nfunc testFunction(db *sql.DB) {\r\n\tstmt, err := db.Prepare(\"SELECT id FROM test WHERE id=$1\")\r\n\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\r\n\tstmt.QueryRow(\"2\")\r\n\r\n\tstmt.Close()\r\n\r\n}\r\n\r\nfunc main() {}\r\n\r\n```\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"testing\"\r\n\r\n\t\"github.com/stretchr/testify/assert\"\r\n\tsqlmock \"gopkg.in/DATA-DOG/go-sqlmock.v1\"\r\n)\r\n\r\nfunc TestPrepare(t *testing.T) {\r\n\tdb, mock, mErr := sqlmock.New()\r\n\tassert.NoError(t, mErr)\r\n\tdefer db.Close()\r\n\r\n\tmock.ExpectPrepare(\"^SELECT id FROM test WHERE id=\\\\$1$\")\r\n\tmock.ExpectQuery(\"2\")\r\n\r\n\ttestFunction(db)\r\n\r\n\tif err := mock.ExpectationsWereMet(); err != nil {\r\n\t\tt.Errorf(\"there were unfulfilled expections: %s\", err)\r\n\t}\r\n\r\n}\r\n\r\n```\r\n\r\nIf i replace the code with \r\n```\r\nmock.ExpectQuery(\"1\")\r\n```\r\nand \r\n```\r\nstmt.QueryRow(\"1\")\r\n```\r\neverything runs as expected. \r\n\r\nI'm i doing something wrong? \r\n\r\nThanks\r\n"}}
{"actor":{"display_login":"luistm"}}