Service/WindowsAzure/Storage/Table.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Service_WindowsAzure
- Subpackage
- Storage
- Version
- $Id: Table.php 24697 2012-03-23 13:11:04Z ezimuel $
\Zend_Service_WindowsAzure_Storage_Table
- Parent(s)
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract < \Zend_Service_WindowsAzure_Storage
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants

URL_DEV_BLOB
= "127.0.0.1:10000"

URL_DEV_QUEUE
= "127.0.0.1:10001"

URL_DEV_TABLE
= "127.0.0.1:10002"

URL_CLOUD_BLOB
= "blob.core.windows.net"

URL_CLOUD_QUEUE
= "queue.core.windows.net"

URL_CLOUD_TABLE
= "table.core.windows.net"

RESOURCE_UNKNOWN
= "unknown"

RESOURCE_CONTAINER
= "c"

RESOURCE_BLOB
= "b"

RESOURCE_TABLE
= "t"

RESOURCE_ENTITY
= "e"

RESOURCE_QUEUE
= "q"

PREFIX_PROPERTIES
= "x-ms-prop-"

PREFIX_METADATA
= "x-ms-meta-"

PREFIX_STORAGE_HEADER
= "x-ms-"
Properties


string $_accountKey = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_accountKey
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_accountKey


string $_accountName = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_accountName
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_accountName


string $_apiVersion = '2009-09-19'
'2009-09-19'
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_apiVersion
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_apiVersion


\Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $_credentials = null
null
Details

\Zend_Service_WindowsAzure_Storage_Batch $_currentBatch = null
null
Details

string $_host = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_host
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_host


\Zend_Http_Client $_httpClientChannel = null
null
Details

string $_proxyCredentials = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_proxyCredentials
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_proxyCredentials


int $_proxyPort = 80
80
Details- Type
- int
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_proxyPort
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_proxyPort


string $_proxyUrl = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_proxyUrl
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_proxyUrl


\Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $_retryPolicy = null
null
Details

boolean $_throwExceptionOnMissingData = true
true
Details- Type
- boolean


boolean $_usePathStyleUri = false
false
Details- Type
- boolean
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_usePathStyleUri
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_usePathStyleUri


boolean $_useProxy = false
false
Details- Type
- boolean
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_useProxy
- Inherited_from
- \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::$$_useProxy
Methods


__construct(string $host = \Zend_Service_WindowsAzure_Storage::URL_DEV_TABLE, string $accountName = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, string $accountKey = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, boolean $usePathStyleUri = false, \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) : void
Creates a new Zend_Service_WindowsAzure_Storage_Table instance
Name | Type | Description |
---|---|---|
$host | string | Storage host name |
$accountName | string | Account name for Windows Azure |
$accountKey | string | Account key for Windows Azure |
$usePathStyleUri | boolean | Use path-style URI's |
$retryPolicy | \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract | Retry policy to use when making requests |


_changeEntity(string $httpVerb = \Zend_Http_Client::PUT, string $tableName = '', \Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, boolean $verifyEtag = false) : void
Update entity / merge entity
Name | Type | Description |
---|---|---|
$httpVerb | string | HTTP verb to use (PUT = update, MERGE = merge) |
$tableName | string | Table name |
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity | Entity to update |
$verifyEtag | boolean | Verify etag of the entity (used for concurrency) |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


_convertToDateTime(string $value = '') : \DateTime | boolean
Converts a string to a DateTime object.
Returns false on failure.
Name | Type | Description |
---|---|---|
$value | string | The string value to parse |
Type | Description |
---|---|
\DateTime | boolean |


_convertToEdmDateTime(\DateTime $value) : string
Converts a DateTime object into an Edm.DaeTime value in UTC timezone, represented as a string.
Name | Type | Description |
---|---|---|
$value | \DateTime |
Type | Description |
---|---|
string |


_fillTemplate(string $templateText, array $variables = array()) : string
Fill text template with variables from key/value array
Name | Type | Description |
---|---|---|
$templateText | string | Template text |
$variables | array | Array containing key/value pairs |
Type | Description |
---|---|
string |


_generateAzureRepresentation(\Zend_Service_WindowsAzure_Storage_TableEntity $entity = null) : string
Generate Azure representation from entity (creates atompub markup from properties)
Name | Type | Description |
---|---|---|
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity |
Type | Description |
---|---|
string |


_generateMetadataHeaders(array $metadata = array()) : \HTTP
Generate metadata headers
Inherited from: \Zend_Service_WindowsAzure_Storage::_generateMetadataHeaders()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::_generateMetadataHeaders()Name | Type | Description |
---|---|---|
$metadata | array |
Type | Description |
---|---|
\HTTP | headers containing metadata |


_getErrorMessage(\Zend_Http_Response $response, string $alternativeError = 'Unknown error.') : string
Get error message from Zend_Http_Response
Name | Type | Description |
---|---|---|
$response | \Zend_Http_Response | Repsonse |
$alternativeError | string | Alternative error message |
Type | Description |
---|---|
string |


_parseMetadataElement( $element = null) : array
Parse metadata XML
Inherited from: \Zend_Service_WindowsAzure_Storage::_parseMetadataElement()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::_parseMetadataElement()Name | Type | Description |
---|---|---|
$element |
Type | Description |
---|---|
array |


_parseMetadataHeaders(array $headers = array()) : array
Parse metadata headers
Inherited from: \Zend_Service_WindowsAzure_Storage::_parseMetadataHeaders()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::_parseMetadataHeaders()Name | Type | Description |
---|---|---|
$headers | array | HTTP headers containing metadata |
Type | Description |
---|---|
array |


_parseResponse(\Zend_Http_Response $response = null) : object
Parse result from Zend_Http_Response
Inherited from: \Zend_Service_WindowsAzure_Storage::_parseResponse()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::_parseResponse()Name | Type | Description |
---|---|---|
$response | \Zend_Http_Response | Response from HTTP call |
Type | Description |
---|---|
object |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


_performRequest(string $path = '/', string $queryString = '', string $httpVerb = \Zend_Http_Client::GET, array $headers = array(), boolean $forTableStorage = false, mixed $rawData = null, string $resourceType = \Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN, string $requiredPermission = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ) : \Zend_Http_Response
Perform request using Zend_Http_Client channel
Name | Type | Description |
---|---|---|
$path | string | Path |
$queryString | string | Query string |
$httpVerb | string | HTTP verb the request will use |
$headers | array | x-ms headers to add |
$forTableStorage | boolean | Is the request for table storage? |
$rawData | mixed | Optional RAW HTTP data to be sent over the wire |
$resourceType | string | Resource type |
$requiredPermission | string | Required permission |
Type | Description |
---|---|
\Zend_Http_Response |


createQueryStringFromArray(array $queryString) : string
Builds a query string from an array of elements
Inherited from: \Zend_Service_WindowsAzure_Storage::createQueryStringFromArray()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::createQueryStringFromArray()Name | Type | Description |
---|---|---|
$queryString | array | Array of elements |
Type | Description |
---|---|
string | Assembled query string |


createTable(string $tableName = '') : \Zend_Service_WindowsAzure_Storage_TableInstance
Create table
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_TableInstance |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


createTableIfNotExists(string $tableName = '') : void
Create table if it does not exist
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


deleteEntity(string $tableName = '', \Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, boolean $verifyEtag = false) : void
Delete entity from table
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity | Entity to delete |
$verifyEtag | boolean | Verify etag of the entity (used for concurrency) |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


deleteTable(string $tableName = '') : void
Delete table
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


getAccountName() : string
Returns the Windows Azure account name
Inherited from: \Zend_Service_WindowsAzure_Storage::getAccountName()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::getAccountName()Type | Description |
---|---|
string |


getBaseUrl() : string
Get base URL for creating requests
Inherited from: \Zend_Service_WindowsAzure_Storage::getBaseUrl()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::getBaseUrl()Type | Description |
---|---|
string |


getCredentials() : \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
Get Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
Inherited from: \Zend_Service_WindowsAzure_Storage::getCredentials()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::getCredentials()Type | Description |
---|---|
\Zend_Service_WindowsAzure_Credentials_CredentialsAbstract |


getCurrentBatch() : \Zend_Service_WindowsAzure_Storage_Batch
Get current batch
Inherited from: \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::getCurrentBatch()Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_Batch |


getHttpClientChannel() : \Zend_Http_Client_Adapter_Interface
Retrieve HTTP client channel
Inherited from: \Zend_Service_WindowsAzure_Storage::getHttpClientChannel()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::getHttpClientChannel()Type | Description |
---|---|
\Zend_Http_Client_Adapter_Interface |


getThrowExceptionOnMissingData() : void
Throw Zend_Service_WindowsAzure_Exception when a property is not specified in Windows Azure?


insertEntity(string $tableName = '', \Zend_Service_WindowsAzure_Storage_TableEntity $entity = null) : \Zend_Service_WindowsAzure_Storage_TableEntity
Insert entity into table
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity | Entity to insert |
Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_TableEntity |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


isInBatch() : boolean
Is there a current batch?
Inherited from: \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::isInBatch()Type | Description |
---|---|
boolean |


isValidMetadataName(string $metadataName = '') : boolean
Is valid metadata name?
Inherited from: \Zend_Service_WindowsAzure_Storage::isValidMetadataName()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::isValidMetadataName()Name | Type | Description |
---|---|---|
$metadataName | string | Metadata name |
Type | Description |
---|---|
boolean |


isoDate(int $timestamp = null) : string
Generate ISO 8601 compliant date string in UTC time zone
Inherited from: \Zend_Service_WindowsAzure_Storage::isoDate()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::isoDate()Name | Type | Description |
---|---|---|
$timestamp | int |
Type | Description |
---|---|
string |


listTables(string $nextTableName = '') : array
List tables
Name | Type | Description |
---|---|---|
$nextTableName | string | Next table name, used for listing tables when total amount of tables is > 1000. |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


mergeEntity(string $tableName = '', \Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, boolean $verifyEtag = false, array $properties = array()) : void
Update entity by adding or updating properties
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity | Entity to update |
$verifyEtag | boolean | Verify etag of the entity (used for concurrency) |
$properties | array | Properties to merge. All properties will be used when omitted. |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


performBatch(array $operations = array(), boolean $forTableStorage = false, boolean $isSingleSelect = false, string $resourceType = \Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN, string $requiredPermission = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ) : \Zend_Http_Response
Perform batch using Zend_Http_Client channel, combining all batch operations into one request
Inherited from: \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::performBatch()Name | Type | Description |
---|---|---|
$operations | array | Operations in batch |
$forTableStorage | boolean | Is the request for table storage? |
$isSingleSelect | boolean | Is the request a single select statement? |
$resourceType | string | Resource type |
$requiredPermission | string | Required permission |
Type | Description |
---|---|
\Zend_Http_Response |


retrieveEntities( $tableName = '', string $filter = '', string $entityClass = 'Zend_Service_WindowsAzure_Storage_DynamicTableEntity', string $nextPartitionKey = null, string $nextRowKey = null) : array
Retrieve entities from table
Name | Type | Description |
---|---|---|
$tableName | ||
$filter | string | Filter condition (not applied when $tableName is a Zend_Service_WindowsAzure_Storage_TableEntityQuery instance) |
$entityClass | string | Entity class name |
$nextPartitionKey | string | Next partition key, used for listing entities when total amount of entities is > 1000. |
$nextRowKey | string | Next row key, used for listing entities when total amount of entities is > 1000. |
Type | Description |
---|---|
array | Array of Zend_Service_WindowsAzure_Storage_TableEntity |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


retrieveEntityById(string $tableName, string $partitionKey, string $rowKey, string $entityClass = 'Zend_Service_WindowsAzure_Storage_DynamicTableEntity') : \Zend_Service_WindowsAzure_Storage_TableEntity
Retrieve entity from table, by id
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
$partitionKey | string | Partition key |
$rowKey | string | Row key |
$entityClass | string | Entity class name* |
Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_TableEntity |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


select() : \Zend_Service_WindowsAzure_Storage_TableEntityQuery
Create a new Zend_Service_WindowsAzure_Storage_TableEntityQuery
Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_TableEntityQuery |


setCredentials(\Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials) : void
Set Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
Inherited from: \Zend_Service_WindowsAzure_Storage::setCredentials()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::setCredentials()Name | Type | Description |
---|---|---|
$credentials | \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract | Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance to use for request signing. |


setCurrentBatch(\Zend_Service_WindowsAzure_Storage_Batch $batch = null) : void
Set current batch
Inherited from: \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::setCurrentBatch()Name | Type | Description |
---|---|---|
$batch | \Zend_Service_WindowsAzure_Storage_Batch | Current batch |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


setHttpClientChannel(\Zend_Http_Client_Adapter_Interface | string $adapterInstance = 'Zend_Http_Client_Adapter_Proxy') : void
Set the HTTP client channel to use
Inherited from: \Zend_Service_WindowsAzure_Storage::setHttpClientChannel()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::setHttpClientChannel()Name | Type | Description |
---|---|---|
$adapterInstance | \Zend_Http_Client_Adapter_Interface | string | Adapter instance or adapter class name. |


setProxy(boolean $useProxy = false, string $proxyUrl = '', int $proxyPort = 80, string $proxyCredentials = '') : void
Set proxy
Inherited from: \Zend_Service_WindowsAzure_Storage::setProxy()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::setProxy()Name | Type | Description |
---|---|---|
$useProxy | boolean | Use proxy? |
$proxyUrl | string | Proxy URL |
$proxyPort | int | Proxy port |
$proxyCredentials | string | Proxy credentials |


setRetryPolicy(\Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) : void
Set retry policy to use when making requests
Inherited from: \Zend_Service_WindowsAzure_Storage::setRetryPolicy()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::setRetryPolicy()Name | Type | Description |
---|---|---|
$retryPolicy | \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract | Retry policy to use when making requests |


setThrowExceptionOnMissingData(boolean $value = true) : void
Throw Zend_Service_WindowsAzure_Exception when a property is not specified in Windows Azure? Defaults to true, making behaviour similar to Windows Azure StorageClient in .NET.
Name | Type | Description |
---|---|---|
$value | boolean |


startBatch() : \Zend_Service_WindowsAzure_Storage_Batch
Starts a new batch operation set
Inherited from: \Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::startBatch()Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_Batch |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


tableExists(string $tableName = '') : boolean
Check if a table exists
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
Type | Description |
---|---|
boolean |


updateEntity(string $tableName = '', \Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, boolean $verifyEtag = false) : void
Update entity by replacing it
Name | Type | Description |
---|---|---|
$tableName | string | Table name |
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity | Entity to update |
$verifyEtag | boolean | Verify etag of the entity (used for concurrency) |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


urlencode(string $value) : string
URL encode function
Inherited from: \Zend_Service_WindowsAzure_Storage::urlencode()\Zend_Service_WindowsAzure_Storage_BatchStorageAbstract::urlencode()Name | Type | Description |
---|---|---|
$value | string | Value to encode |
Type | Description |
---|---|
string | Encoded value |