Change all databases to mysql
This commit is contained in:
parent
1b342f9976
commit
f4ef1afda0
4
main.go
4
main.go
|
@ -77,7 +77,7 @@ func hash(paste []byte) string {
|
||||||
func save(raw []byte) []string {
|
func save(raw []byte) []string {
|
||||||
p := raw[86 : len(raw)-46]
|
p := raw[86 : len(raw)-46]
|
||||||
|
|
||||||
db, err := sql.Open("sqlite3", "./database.db")
|
db, err := sql.Open("mysql", DATABASE)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
sha := hash(p)
|
sha := hash(p)
|
||||||
|
@ -160,7 +160,7 @@ func langHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func getPaste(paste string) string {
|
func getPaste(paste string) string {
|
||||||
param1 := html.EscapeString(paste)
|
param1 := html.EscapeString(paste)
|
||||||
db, err := sql.Open("sqlite3", "./database.db")
|
db, err := sql.Open("mysql", DATABASE)
|
||||||
var s string
|
var s string
|
||||||
err = db.QueryRow("select data from pastebin where id=?", param1).Scan(&s)
|
err = db.QueryRow("select data from pastebin where id=?", param1).Scan(&s)
|
||||||
db.Close()
|
db.Close()
|
||||||
|
|
Loading…
Reference in New Issue