Answer the question
In order to leave comments, you need to log in
How to make go and Sphinx friends?
I'm trying to connect to Sphinx in a Go program via the MySQL driver and I'm getting the commands out of sync error. Did you run multiple statements at once? for any request. Here is an example program. In this case, the Ping() method returns an error. I tried the ?multiStatements=true parameter in the DSN string (although I don't think it has anything to do with it) - it didn't help. What am I doing wrong and how to solve the problem?
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "tcp(127.0.0.1:9312)/")
if err != nil {
fmt.Println(err)
}
defer db.Close()
fmt.Println(db.Ping())
}
Answer the question
In order to leave comments, you need to log in
Remove Ping, Sphinx is a stripped down set of mysql commands.
Also, do not use prepared statements, they are not supported by them either. But do not be afraid, sql injection in Sphinx does not threaten.
Why the hell are you doing prepare and some kind of ping? You read what the sphinx can do
Might be useful to someone. Now there is no point in using Sphinx, because. there are Manticore - they are compatible. And there is an official sdk client to work with Manticore for Go .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question