You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
465 B
Go
20 lines
465 B
Go
5 years ago
|
package starainrt
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
_ "github.com/mattn/go-sqlite3"
|
||
|
)
|
||
|
|
||
|
func TestDataBase(t *testing.T) {
|
||
|
mysql := new(StarDB)
|
||
|
defer mysql.Close()
|
||
|
mysql.Open("sqlite3", "D:\\Ttest.db")
|
||
|
mysql.Exec("CREATE TABLE IF NOT EXISTS sakura(id INT PRIMARY KEY,xihuan TEXT)")
|
||
|
mysql.Exec("INSERT INTO sakura VALUES(?,?)", 2, "dssfsdfdf")
|
||
|
sakura, _ := mysql.Query("SELECT * FROM sakura")
|
||
|
defer sakura.Close()
|
||
|
fmt.Println(sakura.Row(0).MustString("xihuan"))
|
||
|
}
|