內容簡介
建立到 Amazon Simple DB 的連線,使用了令人驚嘆的 php-sdb2 SDB 庫。
使用方式
載入 simple db 類別
$go_simple_db = go_simple_db(
YOUR_SDB_DOMAIN,
YOUR_KEY,
YOUR_SECRET
);
SDB Domain 值與 SQL 表格相似。如果 SDB Domain 尚未存在,Gigaom Simple DB 將為您建立它。
有關獲取 Key 和 Secret 值的更多信息,請參閱 Amazon Simple DB 入門指南。
同時參閱 SDB Limits 以了解 Amazon Simple DB 支持的允許範圍。因為這不會與您以前使用的其他資料庫相同。
將一列資料寫入 SDB Domain:$go_simple_db->putAttributes( YOUR_SDB_DOMAIN, array( 'post_id' => array( 'value' => '1234' ) ) )
查詢您的 SDB Domain:$go_simple_db->select( 'SELECT * FROM `' . YOUR_SDB_DOMAIN . '` LIMIT 100, NULL );
在您從 SDB Domain 獲取下一塊結果的情況下,上述代碼中的 NULL 值將替換為 SDB 下一個 Token(它本質上觸發查詢中的偏移),有關詳細信息,請參閱開發人員指南。
SDB 的查詢方式有所不同,您需要熟悉這些差異。
我有提到過SDB 開發人員指南嗎?
貢獻
此外掛在 GitHub 上進行開發和可用。歡迎貢獻和提問!
外掛標籤
開發者團隊
原文外掛簡介
Establish a connection to Amazon Simple DB. Uses the awesome php-sdb2 SDB library.
Usage
Load simple db class
$go_simple_db = go_simple_db(
YOUR_SDB_DOMAIN,
YOUR_KEY,
YOUR_SECRET
);
The SDB Domain value is analagous to an SQL Table. If the SDB Domain doesn’t exist yet Gigaom Simple DB will create it for you.
See: Amazon Simple DB Getting Started Guide for more information on getting your Key and Secret values.
Also see: SDB Limits to get an idea of what Amazon Simple DB allows as it’s not going to be the same as other databases you’ve worked with before.
Write a row to the your SDB Domain: $go_simple_db->putAttributes( YOUR_SDB_DOMAIN, array( 'post_id' => array( 'value' => '1234' ) ) )
Query your SDB Domain: $go_simple_db->select( 'SELECT * FROM `' . YOUR_SDB_DOMAIN . '` LIMIT 100, NULL );
In the case where you are getting the next chunk of results from you SDB Domain the NULL value in the code above would be replaced with a SDB Next Token (which essentially triggers an offset in the query) see the Developer Guide for more info on that.
Queries are quite different in SDB and you’ll need to familiarize yourself with those differences.
Did I mention the SDB Developer Guide?
Contributing
This plugin is developed and available on GitHub. Contributions and questions are welcome!
