Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SphinxQL Connections #90

Open
martingallagher opened this issue Feb 4, 2014 · 1 comment
Open

SphinxQL Connections #90

martingallagher opened this issue Feb 4, 2014 · 1 comment

Comments

@martingallagher
Copy link

Has anyone had any luck connecting to a recent version of Sphinx with this package?

I'm trying using this code (along with Sphinx 2.2.2-id64-dev (r4536)) with no luck:

package main

import (
    "database/sql"
    "db"
    "fmt"
    _ "github.com/ziutek/mymysql/godrv"
)

func main() {
    con, err := sql.Open("mymysql", "tcp://dev:9306")

    if err != nil {
        println("Connection error:", err.Error())

        return
    }

    defer con.Close()

    if err = con.Ping(); err != nil {
        println("Ping error:", err.Error())

        return
    }

    rows, err := con.Query("SELECT * FROM documents")

    if err != nil {
        println("Query error:", err.Error())

        return
    }

    defer rows.Close()

    data, _ := db.FetchAll(rows) // Just a helper function to populate rows into map[string]string

    fmt.Printf("%#v\n", data)
}
@mileusna
Copy link

Sphinx has added Go MySQL connector support in 2.2.3 so the 2.2.2 might not work. You can find they are mentioning Go in release notes for 2.2.3 beta http://sphinxsearch.com/blog/2014/05/15/sphinx-2-2-3-beta-is-now-available/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants