本文整理汇总了PHP中SelectQuery::addColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::addColumn方法的具体用法?PHP SelectQuery::addColumn怎么用?PHP SelectQuery::addColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::addColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PersistentOrderedSet
/**
* Constructor.
* @param object Id $setId The Id of this set.
* @param integer $dbIndex The index of the database connection which has
* tables in which to store the set.
*/
function PersistentOrderedSet($setId, $dbIndex)
{
parent::OrderedSet($setId);
ArgumentValidator::validate($dbIndex, IntegerValidatorRule::getRule(), true);
// Create our internal array
$this->_dbIndex = $dbIndex;
// populate our array with any previously stored items.
$query = new SelectQuery();
$query->addColumn("item_order", "item_order");
$query->addColumn("item_id", "item_id");
$query->addTable("sets");
$query->addWhere("id = '" . addslashes($this->_setId->getIdString()) . "'");
$query->addOrderBy("item_order");
$dbHandler = Services::getService("DatabaseManager");
$result = $dbHandler->query($query, $this->_dbIndex);
$i = 0;
$oldItems = array();
while ($result->hasMoreRows()) {
// Add the items to our array
$this->_items[$i] = $result->field("item_id");
// Store an array of the order-key/value relationships to reference
// when updating any inconsistancies in order numbering.
$oldItems[$result->field("item_order")] = $result->field("item_id");
$i++;
$result->advanceRow();
}
$result->free();
// Make sure that we have our set is filled from 0 to count()
reset($oldItems);
$this->_updateOrders($oldItems);
}
示例2: loadMultiple
/**
* Will load the data structures for multiple {@link Schema}s.
* @param ref object An array containing the list of types IDs to be loaded.
* @return void
* @access public
*/
function loadMultiple($preloadTypes)
{
$ids = $preloadTypes;
if (count($ids)) {
// let's do it
$query = new SelectQuery();
$query->addTable("dm_schema_field");
$query->addColumn("id", "id", "dm_schema_field");
$query->addColumn("name", "label", "dm_schema_field");
$query->addColumn("mult", "mult", "dm_schema_field");
$query->addColumn("required", "required", "dm_schema_field");
$query->addColumn("active", "active", "dm_schema_field");
$query->addColumn("fieldtype", "fieldtype", "dm_schema_field");
$query->addColumn("fk_schema", "fk_schema", "dm_schema_field");
$wheres = array();
foreach ($ids as $id) {
$wheres[] = "fk_schema='" . addslashes($id) . "'";
}
$query->setWhere("(" . implode(" OR ", $wheres) . ")");
// print "<PRE>".MySQL_SQLGenerator::generateSQLQuery($query)."</PRE>";
$dbHandler = Services::getService("DatabaseManager");
$res = $dbHandler->query($query, DATAMANAGER_DBID);
$rows = array();
while ($res->hasMoreRows()) {
$row = $res->getCurrentRow();
$res->advanceRow();
$theID = $row["fk_schema"];
if (!isset($rows[$theID])) {
$rows[$theID] = array();
}
$rows[$theID][] = $row;
}
$res->free();
// printpre($rows);
// now distribute the rows among their respective objects
foreach (array_keys($rows) as $id) {
$obj = $this->getSchema($id);
if (!$obj->loaded()) {
$obj->populate($rows[$id]);
}
}
}
}
示例3: initializeForTokens
/**
* Initialize this object for a set of authentication tokens. Set the
* password to the encrypted version.
*
* @param mixed $tokens
* @return void
* @access public
* @since 3/1/05
*/
function initializeForTokens($tokens)
{
ArgumentValidator::validate($tokens, ArrayValidatorRule::getRule());
ArgumentValidator::validate($tokens['username'], StringValidatorRule::getRule());
ArgumentValidator::validate($tokens['password'], StringValidatorRule::getRule());
$this->_tokens = $tokens;
$this->_identifier = $tokens['username'];
// set the password to the encrypted version.
$dbc = Services::getService("DatabaseManager");
$dbId = $this->_configuration->getProperty('database_id');
$passwordQuery = new SelectQuery();
$passwordQuery->addColumn("SHA1('" . addslashes($tokens['password']) . "')", "encryptedPassword");
$passwordResult = $dbc->query($passwordQuery, $dbId);
$this->_tokens['password'] = $passwordResult->field("encryptedPassword");
$passwordResult->free();
}
示例4: getThemes
/**
* Answer an array of all of the themes known to this source
*
* @return array of Harmoni_Gui2_ThemeInterface
* @access public
* @since 5/6/08
*/
public function getThemes()
{
$themes = array();
$query = new SelectQuery();
$query->addTable('segue_site_theme');
$query->addColumn('id');
$query->addWhereEqual('fk_site', $this->getSiteId());
$dbMgr = Services::getService("DatabaseManager");
$result = $dbMgr->query($query, $this->databaseIndex);
while ($result->hasNext()) {
$row = $result->next();
$themes[] = new Segue_Gui2_SiteTheme($this->databaseIndex, $row['id']);
}
$result->free();
return $themes;
}
示例5: getMatching
/**
* Since the agent manager package already has support for filtering agents and
* groups from traversal info iterators, return our search results as traversal
* info.
*
* @param string $criteria
* @return TraversalInfoIterator
* @access protected
* @since 1/31/08
*/
protected function getMatching($criteria)
{
$dbc = Services::getService('DatabaseManager');
$idMgr = Services::getService('Id');
$query = new SelectQuery();
$query->addTable('agent_properties');
$query->addColumn("DISTINCT fk_object_id", "agent_id");
$query->addWhereLike("property_value", str_replace('*', '%', $criteria));
$info = array();
$result = $dbc->query($query, $this->databaseIndex);
while ($result->hasNext()) {
$row = $result->next();
if (!strlen($row['agent_id'])) {
throw new OperationFailedException("No valid agent_id found in row for query: " . $query->asString());
}
$info[] = new HarmoniTraversalInfo($idMgr->getId($row['agent_id']), '', 0);
}
return new HarmoniTraversalInfoIterator($info);
}
示例6: getPartStructureIdsForTagGeneration
/**
* Answer the PartStructure Ids for which Tags should be auto-generated, in
* the given repository.
*
* @param object Id $repositoryId
* @return object IdIterator
* @access public
* @since 11/21/06
*/
function getPartStructureIdsForTagGeneration($repositoryId)
{
if (!isset($this->_cache[$repositoryId->getIdString()])) {
$this->_cache[$repositoryId->getIdString()] = array();
$query = new SelectQuery();
$query->addColumn('fk_partstruct');
$query->addTable('tag_part_map');
$query->addWhere("fk_repository ='" . addslashes($repositoryId->getIdString()) . "'");
$dbc = Services::getService("DatabaseManager");
$result = $dbc->query($query, $this->getDatabaseIndex());
// Add tag objects to an array, still sorted by frequency of usage
$idManager = Services::getService('Id');
while ($result->hasNext()) {
$row = $result->next();
$this->_cache[$repositoryId->getIdString()][] = $idManager->getId($row['fk_partstruct']);
}
}
$iterator = new HarmoniIterator($this->_cache[$repositoryId->getIdString()]);
return $iterator;
}
示例7: updateValue
/**
* Update the value for this Part.
*
* @param object mixed $value (original type: java.io.Serializable)
*
* @throws object RepositoryException An exception with one of
* the following messages defined in
* org.osid.repository.RepositoryException may be thrown: {@link
* org.osid.repository.RepositoryException#OPERATION_FAILED
* OPERATION_FAILED}, {@link
* org.osid.repository.RepositoryException#PERMISSION_DENIED
* PERMISSION_DENIED}, {@link
* org.osid.repository.RepositoryException#CONFIGURATION_ERROR
* CONFIGURATION_ERROR}, {@link
* org.osid.repository.RepositoryException#UNIMPLEMENTED
* UNIMPLEMENTED}, {@link
* org.osid.repository.RepositoryException#NULL_ARGUMENT
* NULL_ARGUMENT}
*
* @access public
*/
function updateValue($value)
{
ArgumentValidator::validate($value, StringValidatorRule::getRule());
// Store the size in the object in case its asked for again.
try {
$size = ByteSize::fromString($value);
} catch (InvalidArgumentException $e) {
$size = ByteSize::withValue(0);
}
$this->_size = $size->value();
// then write it to the database.
$dbHandler = Services::getService("DatabaseManager");
// Check to see if the name is in the database
$query = new SelectQuery();
$query->addTable("dr_file");
$query->addColumn("COUNT(*) as count");
$query->addWhere("id = '" . $this->_recordId->getIdString() . "'");
$result = $dbHandler->query($query, $this->_configuration->getProperty("database_index"));
// If it already exists, use an update query.
if ($result->field("count") > 0) {
$query = new UpdateQuery();
$query->setTable("dr_file");
$query->setColumns(array("size"));
$query->setValues(array("'" . addslashes($this->_size) . "'"));
$query->addWhere("id = '" . $this->_recordId->getIdString() . "'");
} else {
$query = new InsertQuery();
$query->setTable("dr_file");
$query->setColumns(array("id", "size"));
$query->setValues(array("'" . $this->_recordId->getIdString() . "'", "'" . addslashes($this->_size) . "'"));
}
$result->free();
// run the query
$dbHandler->query($query, $this->_configuration->getProperty("database_index"));
$this->_asset->updateModificationDate();
}
示例8: testDBHandler
/**
* Test dynamic SELECT WHERE IN queries
*
* @param object $db
* @param array $testSet
* @return void
* @access public
* @since 4/7/08
*/
public function testDBHandler($dbHandler, array $testSet)
{
foreach ($testSet as $id) {
$query = new SelectQuery();
$query->addColumn('*');
$query->addTable('log_entry');
$query->addWhereEqual('id', $id);
$result = $dbHandler->query($query);
while ($result->hasNext()) {
$row = $result->next();
}
$result->free();
// printpre($result);
}
}
示例9: _loadMultiple
/**
* Load authorizations for multiple qualifiers
*
* @param string $agentIdString
* @param array $qualifierIdStrings
* @return void
* @access public
* @since 4/29/08
*/
public function _loadMultiple($agentIdString, array $qualifierIdStrings)
{
$dbHandler = Services::getService("DatabaseManager");
$dbIndex = $this->_configuration->getProperty('database_index');
$agentIdStrings = $this->getAgentIdStringArray($agentIdString);
/*********************************************************
* Explicit AZs
*********************************************************/
// Select and create all of the explicit AZs
$query = new SelectQuery();
$query->addColumn("*");
$query->addTable("az2_explicit_az");
$query->addWhereIn("fk_agent", $agentIdStrings);
$query->addWhere("(effective_date IS NULL OR effective_date < NOW())");
$query->addWhere("(expiration_date IS NULL OR expiration_date > NOW())");
$query->addWhereIn("fk_qualifier", $qualifierIdStrings);
// printpre(MySQL_SQLGenerator::generateSQLQuery($query));
$result = $dbHandler->query($query, $dbIndex);
// Create the explicit AZs
while ($result->hasMoreRows()) {
// Set a boolean for the AZ.
if (!isset($_SESSION['__isAuthorizedCache'][$agentIdString][$result->field("fk_qualifier")])) {
$_SESSION['__isAuthorizedCache'][$agentIdString][$result->field("fk_qualifier")] = array();
}
$_SESSION['__isAuthorizedCache'][$agentIdString][$result->field("fk_qualifier")][$result->field("fk_function")] = true;
$result->advanceRow();
}
$result->free();
/*********************************************************
* Implicit AZs
*********************************************************/
// Select and create all of the explicit AZs
$query = new SelectQuery();
$query->addColumn("*");
$query->addTable("az2_implicit_az");
$query->addWhereIn("fk_agent", $agentIdStrings);
$query->addWhere("(effective_date IS NULL OR effective_date < NOW())");
$query->addWhere("(expiration_date IS NULL OR expiration_date > NOW())");
$query->addWhereIn("fk_qualifier", $qualifierIdStrings);
// printpre(MySQL_SQLGenerator::generateSQLQuery($query));
$result = $dbHandler->query($query, $dbIndex);
// Create the explicit AZs
while ($result->hasMoreRows()) {
// Set a boolean for the AZ.
if (!isset($_SESSION['__isAuthorizedCache'][$agentIdString][$result->field("fk_qualifier")])) {
$_SESSION['__isAuthorizedCache'][$agentIdString][$result->field("fk_qualifier")] = array();
}
$_SESSION['__isAuthorizedCache'][$agentIdString][$result->field("fk_qualifier")][$result->field("fk_function")] = true;
$result->advanceRow();
}
$result->free();
}
示例10: substr
function _getCourseOffering($can, $term, $courseString)
{
//$num = substr($courseString,4,4);
$number = substr($courseString, 0, strlen($courseString) - 5);
$termId = $term->getId();
$dbHandler = Services::getService("DBHandler");
$query = new SelectQuery();
$query->addTable('cm_offer');
$query->addWhere("number='" . addslashes($number) . "'");
$query->addWhere("fk_cm_term='" . addslashes($termId->getIdString()) . "'");
$query->addColumn('id');
$res = $dbHandler->query($query);
if ($res->getNumberOfRows() == 0) {
$deftype1 = new Type("CourseOfferingType", "edu.middlebury", "LDAP");
$deftype2 = new Type("CourseOfferingStatusType", "edu.middlebury", "LDAP");
$deftype3 = new Type("GradeType", "edu.middlebury", "LDAP");
$offer = $can->createCourseOffering($number, $number, "", $termId, $deftype1, $deftype2, $deftype3);
// print "<font size=3 color='red'>#</font>\n";
return $offer;
} else {
//print " ";
$row = $res->getCurrentRow();
$cm = Services::getService("CourseManagement");
$idManager = Services::getService("Id");
$id = $idManager->getId($row['id']);
$offer = $cm->getCourseOffering($id);
//print "<font size=3>#</font>\n";
return $offer;
}
}
示例11: updateTable
/**
* Update a record table for a set of harvesters and repositories
*
* @param string $table
* @param array $allowedRepositoryIdStrings
* @param array $authGroupIdStrings The ids of the groups to check view authorization for,
* May be one of the following or another group Id string:
* edu.middlebury.agents.everyone
* edu.middlebury.agents.all_agents
* If empty, all assets in the specified repositories will be added regardless of
* their visibility.
*
* @return void
* @access public
* @since 3/9/07
*/
function updateTable($table, $allowedRepositoryIdStrings, $authGroupIdStrings)
{
ArgumentValidator::validate($table, StringValidatorRule::getRule());
ArgumentValidator::validate($allowedRepositoryIdStrings, ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule()));
ArgumentValidator::validate($authGroupIdStrings, ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule()));
$harmoni = Harmoni::instance();
$config = $harmoni->getAttachedData('OAI_CONFIG');
$repositoryManager = Services::getService('Repository');
$authorizationManager = Services::getService('AuthZ');
$idManager = Services::getService("IdManager");
$dbc = Services::getService("DatabaseManager");
$authGroupIds = array();
foreach ($authGroupIdStrings as $id) {
$authGroupIds[] = $idManager->getId($id);
}
$baseCheckQuery = new SelectQuery();
$baseCheckQuery->addTable('oai_' . $table);
$baseCheckQuery->addColumn('datestamp');
$baseCheckQuery->addColumn('deleted');
$baseUpdateQuery = new UpdateQuery();
$baseUpdateQuery->setTable('oai_' . $table);
$baseUpdateColumns = array('datestamp', 'deleted', 'oai_set', 'dc_title', 'dc_description');
$dcUpdateColumns = array('datestamp', 'deleted', 'oai_set', 'dc_title', 'dc_description', 'dc_creator', 'dc_subject', 'dc_contributor', 'dc_publisher', 'dc_date', 'dc_type', 'dc_format', 'dc_identifier', 'dc_source', 'dc_language', 'dc_relation', 'dc_coverage', 'dc_rights');
$baseInsertQuery = new InsertQuery();
$baseInsertQuery->setTable('oai_' . $table);
$baseInsertColumns = array('datestamp', 'oai_identifier', 'deleted', 'oai_set', 'dc_title', 'dc_description');
$dcInsertColumns = array('datestamp', 'oai_identifier', 'deleted', 'oai_set', 'dc_title', 'dc_description', 'dc_creator', 'dc_subject', 'dc_contributor', 'dc_publisher', 'dc_date', 'dc_type', 'dc_format', 'dc_identifier', 'dc_source', 'dc_language', 'dc_relation', 'dc_coverage', 'dc_rights');
$baseDeleteQuery = new UpdateQuery();
$baseDeleteQuery->setTable('oai_' . $table);
$baseDeleteQuery->addValue('deleted', 'true');
$baseDeleteQuery->addRawValue('datestamp', 'NOW()');
$baseUndeleteQuery = new UpdateQuery();
$baseUndeleteQuery->setTable('oai_' . $table);
$baseUndeleteQuery->addValue('deleted', 'false');
$baseUndeleteQuery->addRawValue('datestamp', 'NOW()');
$forceUpdate = false;
$repositories = $repositoryManager->getRepositories();
$r = 0;
if (count($allowedRepositoryIdStrings)) {
$numR = count($allowedRepositoryIdStrings);
} else {
$numR = $repositories->count();
}
$numUpdates = 0;
$numDeleted = 0;
$message = _('Updating OAI records for repository (%1 of %2) : ');
$message = str_replace('%2', $numR, $message);
$instituteId = $idManager->getId('edu.middlebury.agents.users');
$viewId = $idManager->getId('edu.middlebury.authorization.view');
require_once HARMONI . "/utilities/Timer.class.php";
$timer = new Timer();
$timer->start();
$existingRepositoryIds = array();
while ($repositories->hasNext()) {
$updatesInRepository = 0;
$repository = $repositories->next();
$repositoryId = $repository->getId();
// Only work with allowed repositories
if (count($allowedRepositoryIdStrings) && !in_array($repositoryId->getIdString(), $allowedRepositoryIdStrings)) {
continue;
}
$r++;
$existingRepositoryIds[] = $repositoryId->getIdString();
$assets = $repository->getAssets();
$status = new CLIStatusStars(str_replace('%1', $r, $message) . $repository->getDisplayName());
$status->initializeStatistics($assets->count());
$existingAssetIds = array();
while ($assets->hasNext()) {
$asset = $assets->next();
$assetId = $asset->getId();
$existingAssetIds[] = $assetId->getIdString();
try {
$modificationDate = $asset->getModificationDate();
} catch (UnimplementedException $e) {
$modificationDate = DateAndTime::now();
}
$query = $baseCheckQuery->copy();
$query->addWhereEqual("oai_set", $repositoryId->getIdString());
$query->addWhereEqual("oai_identifier", $assetId->getIdString());
$result = $dbc->query($query, $config->getProperty('OAI_DBID'));
if (!$result->getNumberOfRows()) {
// printpre("Doesn't exist:\t".$asset->getDisplayName()."");
$query = $baseInsertQuery->copy();
$query->addValue('oai_set', $repositoryId->getIdString());
//.........这里部分代码省略.........
示例12: SelectQuery
/**
* Create a select query with table joins.
*
* @return object SelectQuery
* @access private
* @since 3/9/05
*/
function _createSelectQuery()
{
$query = new SelectQuery();
$query->addTable($this->_mappingTable);
$query->addTable($this->_typeTable, LEFT_JOIN, $this->_mappingTable . '.fk_type=' . $this->_typeTable . '.id');
$query->addColumn('agent_id');
$query->addColumn('token_identifier');
$query->addColumn('domain');
$query->addColumn('authority');
$query->addColumn('keyword');
$query->addColumn('description');
return $query;
}
示例13: getRecordIDsByType
/**
* @return array
* @param string $type The Schema type to look for.
* Returns an array of DMRecord IDs that are of the Schema type $type.
*/
function getRecordIDsByType($type)
{
// we're going to get all the IDs that match a given type.
$query = new SelectQuery();
$query->addTable("dm_record");
$query->addTable("dm_schema", INNER_JOIN, "dm_schema.id=dm_record.fk_schema");
$query->addColumn("id", "", "dm_record");
$query->setWhere("dm_schema.id='" . addslashes($type) . "'");
$dbHandler = Services::getService("DatabaseManager");
$result = $dbHandler->query($query, DATAMANAGER_DBID);
if (!$result) {
throwError(new UnknownDBError("RecordManager"));
return false;
}
$array = array();
while ($result->hasMoreRows()) {
$array[] = $result->field(0);
$result->advanceRow();
}
$result->free();
return $array;
}
示例14: test
/**
* Tests the generateSQLQuery() without WHERE clause.
*/
function test()
{
// insert one row
$query = new InsertQuery();
$query->setTable("test1");
$query->setColumns(array("value"));
$query->addRowOfValues(array("'Spaceboy'"));
$query->setAutoIncrementColumn("id", "test1_id_seq");
$result = $this->db->query($query);
$lastId = $result->getLastAutoIncrementValue();
// insert it again, the id must have increased by one
$result = $this->db->query($query);
$this->assertIdentical($result->getNumberOfRows(), 1);
$this->assertIdentical($result->getLastAutoIncrementValue(), $lastId + 1);
// add several rows at the same time
$query->addRowOfValues(array("'Astrogirl'"));
$result = $this->db->query($query);
$this->assertIdentical($result->getLastAutoIncrementValue(), $lastId + 3);
// now insert in the other test table
$query = new InsertQuery();
$query->setTable("test");
$query->setColumns(array("FK", "value"));
$query->addRowOfValues(array($lastId, "'Ziggy'"));
$query->addRowOfValues(array($lastId + 1, "'Lost in the Stars'"));
$query->addRowOfValues(array($lastId + 2, "'Headstar'"));
$query->addRowOfValues(array($lastId + 3, "'Stardust'"));
$query->setAutoIncrementColumn("id", "test1_id_seq");
$result = $this->db->query($query);
// join the inserted rows
$query = new SelectQuery();
$query->addTable("test1");
$query->addTable("test", INNER_JOIN, "test.FK = test1.id");
$query->addColumn("id", "dm86_id", "test");
$query->addColumn("FK", "dm86_fk", "test");
$query->addColumn("value", "dm86_value", "test");
$query->addColumn("id", "dm98_id", "test1");
$query->addColumn("value", "dm98_value", "test1");
$query->addWhere("test1.id >= " . $lastId);
$result = $this->db->query($query);
$this->assertIdentical($result->getNumberOfRows(), 4);
$this->assertIdentical((int) $result->field("dm86_fk"), $lastId);
$this->assertIdentical($result->field("dm86_value"), "Ziggy");
$this->assertIdentical((int) $result->field("dm98_id"), $lastId);
$this->assertIdentical($result->field("dm98_value"), "Spaceboy");
$result->advanceRow();
$this->assertIdentical((int) $result->field("dm86_fk"), $lastId + 1);
$this->assertIdentical($result->field("dm86_value"), "Lost in the Stars");
$this->assertIdentical((int) $result->field("dm98_id"), $lastId + 1);
$this->assertIdentical($result->field("dm98_value"), "Spaceboy");
$result->advanceRow();
$this->assertIdentical((int) $result->field("dm86_fk"), $lastId + 2);
$this->assertIdentical($result->field("dm86_value"), "Headstar");
$this->assertIdentical((int) $result->field("dm98_id"), $lastId + 2);
$this->assertIdentical($result->field("dm98_value"), "Spaceboy");
$result->advanceRow();
$this->assertIdentical((int) $result->field("dm86_fk"), $lastId + 3);
$this->assertIdentical($result->field("dm86_value"), "Stardust");
$this->assertIdentical((int) $result->field("dm98_id"), $lastId + 3);
$this->assertIdentical($result->field("dm98_value"), "Astrogirl");
$result->free();
$query = new UpdateQuery();
$query->setTable("test1");
$query->setColumns(array("value"));
$query->setValues(array("'I changed you MF!'"));
$query->addWhere("id = " . $lastId);
$result = $this->db->query($query);
$this->assertIdentical($result->getNumberOfRows(), 1);
$query = new SelectQuery();
$query->addTable("test1");
$query->addColumn("value");
$query->addWhere("test1.id = " . $lastId);
$result = $this->db->query($query);
$this->assertIdentical($result->getNumberOfRows(), 1);
$this->assertIdentical($result->field("value"), "I changed you MF!");
$result->free();
$query = new DeleteQuery();
$query->setTable("test1");
$query->addWhere("id = " . $lastId);
$result = $this->db->query($query);
$this->assertIdentical($result->getNumberOfRows(), 1);
$query = new SelectQuery();
$query->addTable("test1");
$query->addColumn("value");
$query->addWhere("test1.id = " . $lastId);
$result = $this->db->query($query);
$this->assertIdentical($result->getNumberOfRows(), 0);
$result->free();
}
示例15: getAllPropertyKeys
/**
* Answer an array of all of the property keys inexistance
*
* @return array
* @access public
* @since 11/1/05
*/
function getAllPropertyKeys()
{
$propertyKeys = array();
$dbHandler = Services::getService("DBHandler");
//select the propertykeys
$query = new SelectQuery();
$query->addTable("agent_properties");
$query->addColumn("DISTINCT property_key");
// $query->addTable("type", LEFT_JOIN, "agent_properties.fk_type_id=type.type_id");
// $query->addColumn("property_key");
// $query->addColumn("type_domain");
// $query->addColumn("type_authority");
// $query->addColumn("type_keyword");
// $query->addColumn("type_description");
$query->addOrderBy("property_key");
$result = $dbHandler->query($query, $this->_dbIndex);
while ($result->hasMoreRows()) {
$propertyKeys[] = $result->field('property_key');
// $propertyKeys[$result->field('property_key')] = new Type(
// $result->field('type_domain'),
// $result->field('type_authority'),
// $result->field('type_keyword'),
// $result->field('type_description'));
$result->advanceRow();
}
$result->free();
return $propertyKeys;
//return the properties
}