本文整理汇总了PHP中PHPUnit_Extensions_Database_DataSet_ITableMetaData::getPrimaryKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Extensions_Database_DataSet_ITableMetaData::getPrimaryKeys方法的具体用法?PHP PHPUnit_Extensions_Database_DataSet_ITableMetaData::getPrimaryKeys怎么用?PHP PHPUnit_Extensions_Database_DataSet_ITableMetaData::getPrimaryKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Extensions_Database_DataSet_ITableMetaData
的用法示例。
在下文中一共展示了PHPUnit_Extensions_Database_DataSet_ITableMetaData::getPrimaryKeys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildTableSelect
/**
* Creates the query necessary to pull all of the data from a table.
*
* @param PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData
* @return unknown
*/
public static function buildTableSelect(PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData, PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection = NULL)
{
if ($tableMetaData->getTableName() == '') {
$e = new Exception('Empty Table Name');
echo $e->getTraceAsString();
throw $e;
}
$columns = $tableMetaData->getColumns();
if ($databaseConnection) {
$columns = array_map([$databaseConnection, 'quoteSchemaObject'], $columns);
}
$columnList = implode(', ', $columns);
if ($databaseConnection) {
$tableName = $databaseConnection->quoteSchemaObject($tableMetaData->getTableName());
} else {
$tableName = $tableMetaData->getTableName();
}
$primaryKeys = $tableMetaData->getPrimaryKeys();
if ($databaseConnection) {
$primaryKeys = array_map([$databaseConnection, 'quoteSchemaObject'], $primaryKeys);
}
if (count($primaryKeys)) {
$orderBy = 'ORDER BY ' . implode(' ASC, ', $primaryKeys) . ' ASC';
} else {
$orderBy = '';
}
return "SELECT {$columnList} FROM {$tableName} {$orderBy}";
}
示例2: disablePrimaryKeys
protected function disablePrimaryKeys(PHPUnit_Extensions_Database_DataSet_ITableMetaData $databaseTableMetaData, PHPUnit_Extensions_Database_DataSet_ITable $table, PHPUnit_Extensions_Database_DB_IDatabaseConnection $connection)
{
if (count($databaseTableMetaData->getPrimaryKeys())) {
return TRUE;
}
return FALSE;
}
示例3: buildOperationArguments
protected function buildOperationArguments(PHPUnit_Extensions_Database_DataSet_ITableMetaData $databaseTableMetaData, PHPUnit_Extensions_Database_DataSet_ITable $table, $row)
{
$args = array();
foreach ($databaseTableMetaData->getPrimaryKeys() as $columnName) {
$args[] = $table->getValue($row, $columnName);
}
return $args;
}
示例4: getPrimaryKeys
/**
* Returns the names of the primary key columns in the table.
*
* @return array
*/
public function getPrimaryKeys()
{
return $this->originalMetaData->getPrimaryKeys();
}
示例5: buildTableSelect
/**
* Creates the query necessary to pull all of the data from a table.
*
* @param PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData
* @return unknown
*/
public static function buildTableSelect(PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData)
{
if ($tableMetaData->getTableName() == '') {
$e = new Exception("Empty Table Name");
echo $e->getTraceAsString();
throw $e;
}
$columnList = implode(', ', $tableMetaData->getColumns());
$primaryKeys = $tableMetaData->getPrimaryKeys();
if (count($primaryKeys)) {
$orderBy = 'ORDER BY ' . implode(' ASC, ', $primaryKeys) . ' ASC';
} else {
$orderBy = '';
}
return "SELECT {$columnList} FROM {$tableMetaData->getTableName()} {$orderBy}";
}