Esempio n. 1
0
<?php

require_once './sdk.class.php';
error_reporting(-1);
ini_set('display_errors', true);
header("Content-type: text/html; charset=utf-8");
$sdb = new AmazonSDB();
$domain = 'authors';
//$authors_domain = $sdb->create_domain($domain);
/*$add_authors = $sdb->batch_put_attributes($domain, array(
		'*****@*****.**' => array(
				'name' => 'Behrouz A Forouzan',
				'password' => '1a1dc91c907325c69271ddf0c944bc72', //MD5 of 'pass'
				'type' => '1',
			),
		'*****@*****.**' => array(
				'name' => 'Dennis M. Ritchie',
				'password' => '1a1dc91c907325c69271ddf0c944bc72', //MD5 of 'pass'
				'type' => '1',
		),
		));*/
$sdb->delete_attributes($domain, "author_2", array(array('Name' => 'name'), array('Name' => 'password')));
$query = "SELECT name,password FROM `{$domain}`";
$results = $sdb->select($query);
$authors = $results->body->Item();
foreach ($authors as $author) {
    echo $author->Attribute[0]->Value;
    echo "</br>";
}
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'tarzan.class.php';
require_once 'book.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query for each file
$res1 = $sdb->select("select * from " . CL_ITEM_DOMAIN);
if ($res1->isOK()) {
    foreach ($res1->body->SelectResult->Item as $item) {
        $itemName = $item->Name;
        // Get list of attributes
        $attrs = array_keys(getItemAttributes($item));
        // Delete the attributes
        $res2 = $sdb->delete_attributes(CL_ITEM_DOMAIN, $itemName, $attrs);
        if ($res2->isOK()) {
            print "Deleted item {$itemName}\n";
        } else {
            $error = $res2->body->Errors->Error->Message;
            print "Could not delete item: {$error}\n";
        }
    }
} else {
    $error = $res1->body->Errors->Error->Message;
    exit("Could not run query: {$error}\n");
}
Esempio n. 3
0
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query for each file
$res1 = $sdb->select("select * from " . BOOK_FILE_DOMAIN);
if ($res1->isOK()) {
    foreach ($res1->body->SelectResult->Item as $item) {
        $itemName = (string) $item->Name;
        // Delete the attributes
        $res2 = $sdb->delete_attributes(BOOK_FILE_DOMAIN, $itemName);
        if ($res2->isOK()) {
            print "Deleted item {$itemName}\n";
        } else {
            $error = $res2->body->Errors->Error->Message;
            print "Could not delete item: {$error}\n";
        }
    }
} else {
    $error = $res1->body->Errors->Error->Message;
    exit("Could not run query: {$error}\n");
}
exit(0);
Esempio n. 4
0
// Query for each item
$next = null;
do
{
  $attrs = ($next == null) ? null : array('NextToken' => $next);
  $res1 = $sdb->select("select * from " . BOOK_AWS_USAGE_DOMAIN, $attrs);
  $next  = (string) $res1->body->SelectResult->NextToken;

  if ($res1->isOK())
  {
    foreach ($res1->body->SelectResult->Item as $item)
    {
      $itemName = $item->Name;

      // Delete the attributes
      $res2 = $sdb->delete_attributes(BOOK_AWS_USAGE_DOMAIN, $itemName);

      if ($res2->isOK())
      {
	print("Deleted item $itemName\n");
      }
      else
      {
	$error = $res2->body->Errors->Error->Message;
	print("Could not delete item: ${error}\n");
      }
    }
  }
  else
  {
    $error = $res1->body->Errors->Error->Message;