MYSQL GET_LOCK not working

Hi,

I need help with the mysql GET_LOCK function. I have something like this:

        var locked bool
        r := db.QueryRow("SELECT GET_LOCK('abc', 1)")
        if err := r.Scan(&locked); err != nil {
        	return false
        }
        fmt.Println("returning lock!", locked)
        return locked

Locked return as if the operation worked successfully, but I check in the database SELECT IS_FREE_LOCK(‘abc’) and it is still free… So seems like GET_LOCK is not working. Any ideas?

Thanks in advance! :slight_smile:

Seems that go sql terminates the session after a query is done dropping the connection after query, thus releasing the lock automatically. Any ideas?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.