Ejemplo n.º 1
0
/**
 * Sets auto commit mode on/off
 * @param resource connection instance
 * @param bool TRUE to turn auto commit on, FALSE to turn it off.
 * @return bool TRUE is auto commit mode was correctly set. FALSE otherwise.
 */
function auto_commit($conn, $flag = TRUE)
{
    if ($conn["socket"] != NULL) {
        $cmd = "auto_commit " . (int) $flag;
        mapi_write($conn["socket"], format_command($cmd));
        mapi_read($conn["socket"]);
        return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 2
0
function mapi_free_result($conn_id, $res_id)
{
    global $connection_pool;
    global $last_error;
    /* Fetch the connection from the pool */
    $conn = NULL;
    foreach ($connection_pool as $connection) {
        if ($connection["id"] == $conn_id) {
            $conn = $connection;
            break;
        }
    }
    if ($conn == NULL) {
        return FALSE;
    }
    $socket = $conn["socket"];
    /* Send a close command */
    $cmd = "close " . $res_id;
    mapi_write($socket, format_command($cmd));
    $last_error = mapi_read($socket);
    if ($last_error != "") {
        return FALSE;
    }
    return TRUE;
}