public static function fetchPrimaryKey(\mysqli $mysqliConn, string $tableName) : array
    {
        $primaryKeyArray = array();
        
        $query = "show index FROM `" . $tableName . "`";
        /*@var $result mysqli_result */
        $result = $mysqliConn->query($query);
        
        if ($result === FALSE)
        {
            throw new \Exception("Failed to fetch primary key", 500);
        }
        
        while (($row = $result->fetch_assoc()) != null)
        {
            if ($row["Key_name"] === "PRIMARY")
            {
                $primaryKeyArray[] = $row["Column_name"];
            }
        }
        
        if (count($primaryKeyArray) == 0)
        {
            throw new \Exception($tableName . " does not have a primary key.");
        }
        
        return $primaryKeyArray;
    }