$success = false;
$msg = "";
$link = $connection->AttemptConnection();
//Ensure that any failed connection attempts get reported to the user
if (!$link || !empty($connection->GetLastErrorMessage())) {
    header('HTTP/1.1 500 Connection Failed: ' . $connection->GetLastErrorMessage());
    header('Content-Type: application/json; charset=UTF-8');
    exit;
}
switch ($_POST['action']) {
    //During the action of switching to the table tab we will be looking up a list of tables, and populating a select control with them
    case 'table':
        $tableList = "";
        //Connection was successful.  Start building HTML that will replace a currently empty div
        $success = true;
        $options = $connection->returnTableNameOptions();
        $success = $options && !empty($options);
        if (!$success) {
            header('HTTP/1.1 500 Internal Server Booboo - Failed to retrieve any table data');
            header('Content-Type: application/json; charset=UTF-8');
            break;
        }
        $tableList = '<select id="selectedTable" class="form-control">' . PHP_EOL . $options . PHP_EOL . '</select>' . PHP_EOL;
        //return a JSON encoded array that contains detailed information about what just took place in this AJAX call
        header('Content-Type: application/json');
        echo json_encode(array("html" => $tableList, "success" => $success, "message" => $msg));
        break;
    case 'class':
        //During the action of switching to the class tab we will be looking up a list of columns in the selected table, and retrieving the metadata necessary for generating class declarations that can be used to create objects modeled after them.
        $tableName = '';
        $class_whole = '';