func GetFriends(userIndex int) (map[string]*Friend, error) {
	var friends map[string]*Friend = make(map[string]*Friend)
	friendRows, friendRowsErr := database.Query("Select " + friendsColumnFriend + ", " + friendsColumnStatus + " FROM " + tableFriends + " WHERE " + friendsColumnUser + "=" + strconv.Itoa(userIndex) + ";")
	if friendRowsErr != nil {
		return nil, friendRowsErr
	}
	for friendRows.Next() {
		var friendName string
		var friendID int
		var friendStatus int
		if scanErr := friendRows.Scan(&friendID, &friendStatus); scanErr != nil {
			friendRows.Close()
			return nil, scanErr
		}
		friendInfoRows, friendInfoErr := database.Query("Select " + usersColumnName + " FROM " + tableUsers + " WHERE " + usersColumnID + "=" + strconv.Itoa(friendID) + " LIMIT 1;")
		if friendInfoErr != nil {
			friendRows.Close()
			return nil, friendInfoErr
		}
		friendInfoRows.Next()
		if scanErr := friendInfoRows.Scan(&friendName); scanErr != nil {
			friendRows.Close()
			friendInfoRows.Close()
			return nil, scanErr
		}
		friendInfoRows.Close()
		aFriend := Friend{name: friendName, dbID: friendID, status: friendStatus}
		friends[friendName] = &aFriend
	}
	friendRows.Close()
	return friends, nil
}
////////////////////////////////////////////////////////////////////////////////////////////////////
GET FRIENDS   /////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
GetFriends gets a User's frinds list from the database.

WARNING: This is only meant for internal Gopher Game Server mechanics. Use the *User.Friends() function
instead to avoid errors when using the SQL features.
package database
import (
	"strconv"
)
type Friend struct {
	name   string
	dbID   int
	status int
}
const (
	FriendStatusRequested = iota
	FriendStatusPending
	FriendStatusAccepted
)
func FriendRequest(userIndex int, friendIndex int) error {
	_, insertErr := database.Exec("INSERT INTO " + tableFriends + " (" + friendsColumnUser + ", " + friendsColumnFriend + ", " + friendsColumnStatus + ") " +
		"VALUES (" + strconv.Itoa(userIndex) + ", " + strconv.Itoa(friendIndex) + ", " + strconv.Itoa(FriendStatusPending) + ");")
	if insertErr != nil {
		return insertErr
	}
	_, insertErr = database.Exec("INSERT INTO " + tableFriends + " (" + friendsColumnUser + ", " + friendsColumnFriend + ", " + friendsColumnStatus + ") " +
		"VALUES (" + strconv.Itoa(friendIndex) + ", " + strconv.Itoa(userIndex) + ", " + strconv.Itoa(FriendStatusRequested) + ");")
	if insertErr != nil {
		return insertErr
	}
	return nil
}
func FriendRequestAccepted(userIndex int, friendIndex int) error {
	_, updateErr := database.Exec("UPDATE " + tableFriends + " SET " + friendsColumnStatus + "=" + strconv.Itoa(FriendStatusAccepted) + " WHERE (" + friendsColumnUser + "=" + strconv.Itoa(userIndex) +
		" AND " + friendsColumnFriend + "=" + strconv.Itoa(friendIndex) + ") OR (" + friendsColumnUser + "=" + strconv.Itoa(friendIndex) +
		" AND " + friendsColumnFriend + "=" + strconv.Itoa(userIndex) + ");")
	if updateErr != nil {
		return updateErr
	}
	return nil
}
func RemoveFriend(userIndex int, friendIndex int) error {
	_, updateErr := database.Exec("DELETE FROM " + tableFriends + " WHERE (" + friendsColumnUser + "=" + strconv.Itoa(userIndex) + " AND " + friendsColumnFriend + "=" + strconv.Itoa(friendIndex) + ") OR (" +
		friendsColumnUser + "=" + strconv.Itoa(friendIndex) + " AND " + friendsColumnFriend + "=" + strconv.Itoa(userIndex) + ");")
	if updateErr != nil {
		return updateErr
	}
	return nil
}