func SaveToken(url string, username string, token string) error {
	connection, err := db.GetDB()
	if err != nil {
		return err
	}

	statement, err := connection.Prepare(`
		UPDATE moodles
		SET wstoken=?
		WHERE url=? AND username=?`)
	if err != nil {
		return err
	}

	defer statement.Close()

	res, err := statement.Exec(token, url, username)
	if err != nil {
		return err
	} else if num, err := res.RowsAffected(); num == 0 || err != nil {
		err = errors.New("Token wasn't stored")
	}
	return err
}
// SaveToken stores the token in the correct place in the DB
// If it succeeds returns nil, otherwise an error is returned
SaveToken stores the token in the correct place in the DB
If it succeeds returns nil, otherwise an error is returned
// SaveToken stores the token in the correct place in the DB // If it succeeds returns nil otherwise an error is returned
func SaveToken(url string, username string, token string) error {
	connection, err := db.GetDB()
	if err != nil {
		return err
	}
	statement, err := connection.Prepare(`
		UPDATE moodles
		SET wstoken=?
		WHERE url=? AND username=?`)
	if err != nil {
		return err
	}
	defer statement.Close()
	res, err := statement.Exec(token, url, username)
	if err != nil {
		return err
	} else if num, err := res.RowsAffected(); num == 0 || err != nil {
		err = errors.New("Token wasn't stored")
	}
	return err
}
func SaveToken ( url string , username string , token string ) error { connection , err := db . GetDB ( ) if err != nil { return err } statement , err := connection . Prepare ( `
		UPDATE moodles
		SET wstoken=?
		WHERE url=? AND username=?` ) if err != nil { return err } defer statement . Close ( ) res , err := statement . Exec ( token , url , username ) if err != nil { return err } else if num , err := res . RowsAffected ( ) ; num == 0 || err != nil { err = errors . New ( " " ) } return err }
SaveToken stores the token in the correct place in the DB
If it succeeds returns nil, otherwise an error is returned
SaveToken stores the token in the correct place in the DB If it succeeds returns nil otherwise an error is returned