コード例 #1
0
ファイル: showrssFetch.php プロジェクト: naseemr/torrent_dl
function saveTorrent($url)
{
    global $destDir;
    // get filename from http://showrss.karmorra.info/r/67849b94daf750c142adf43266525b3a.torrent
    $matches = split("/", $url);
    $filename = $matches[count($matches) - 1];
    $torData = getData($url);
    // write to disk
    writeBack($destDir . $filename, $torData);
}
コード例 #2
0
ファイル: 1c-RA.php プロジェクト: psagi/sdo
    echo "SDO_DAS_Relational_Exception raised when trying to create the DAS.";
    echo "Probably something wrong with the metadata.";
    echo "\n" . $e->getMessage();
    exit;
}
/*************************************************************************************
* Find Acme, update it, add another company, and write them both back.
*************************************************************************************/
$root = findCompanies($das, 'Acme');
foreach ($root['company'] as $acme) {
    assert($acme['name'] == 'Acme');
    echo "Looked for Acme and found company with name = " . $acme->name . " and id " . $acme->id . "\n";
}
$acme2 = $root->createDataObject('company');
$acme2->name = "Acme";
writeBack($das, $root);
echo "Added a second Acme company and wrote both back - should now have an extra Acme\n";
/*************************************************************************************
* Function to issue executeQuery() to the DAS
*
* We could reuse a connection but in this case we get a new one to illustrate the
* disconnected nature of the data graph.
*
*************************************************************************************/
function findCompanies($das, $name)
{
    $dbh = new PDO(PDO_DSN, DATABASE_USER, DATABASE_PASSWORD);
    try {
        $pdo_stmt = $dbh->prepare('select name, id from company where name=?');
        $root = $das->executePreparedQuery($dbh, $pdo_stmt, array($name), array('company.name', 'company.id', 'company.employee_of_the_month'));
    } catch (SDO_DAS_Relational_Exception $e) {
コード例 #3
0
ファイル: 1c-CRU.php プロジェクト: psagi/sdo
 * Create the root data object then a single company object underneath it. 
 * Set the company name to 'Acme'.
 *************************************************************************************/
$root = $das->createRootDataObject();
$company = $root->createDataObject('company');
$company->name = "Acme";
writeBack($das, $company);
echo "Created a company with name Acme and wrote it to the database\n";
/*************************************************************************************
 * Find it again (with its autogenerated id this time).
 * Now update it and write it back again.
 *************************************************************************************/
$company2 = findCompany($das, 'Acme');
echo "Looked for Acme and found company with name = " . $company2->name . " and id " . $company2->id . "\n";
$company2->name = 'MegaCorp';
writeBack($das, $company2);
echo "Wrote back Acme with name changed to MegaCorp\n";
/*************************************************************************************
 * Find it again under its new name.
 *************************************************************************************/
$company3 = findCompany($das, 'Megacorp');
echo "Looked for MegaCorp and found company with name = " . $company3->name . " and id " . $company3->id . "\n";
/*************************************************************************************
 * Function to issue executeQuery() to the DAS
 *
 * We could reuse a connection but in this case we get a new one to illustrate the
 * disconnected nature of the data graph.
 * 
 * Since we want to put a variable into the SQL, use the prepared statement interface
 * and a placeholder to ensure invalid SQL cannot be injected, regardless of what is 
 * passed in $name.