本文整理汇总了PHP中Dba::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Dba::query方法的具体用法?PHP Dba::query怎么用?PHP Dba::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dba
的用法示例。
在下文中一共展示了Dba::query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
/**
* uninstall
* This removes the remote catalog
*/
public function uninstall()
{
$sql = "DELETE FROM `catalog` WHERE `catalog_type` = ?";
Dba::query($sql, array($this->get_type()));
$sql = "DROP TABLE `catalog_" . $this->get_type() . "`";
Dba::query($sql);
return true;
}
示例2: get_instance
/**
* get_instance
* This returns a single instance and all it's variables
*/
public function get_instance($instance = '')
{
$instance = $instance ? $instance : AmpConfig::get('vlc_active');
$sql = "SELECT * FROM `localplay_vlc` WHERE `id` = ?";
$db_results = Dba::query($sql, array($instance));
$row = Dba::fetch_assoc($db_results);
return $row;
}
示例3: install
/**
* install
* This function installs the local catalog
*/
public function install()
{
$sql = "CREATE TABLE `catalog_local` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , " . "`path` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`catalog_id` INT( 11 ) NOT NULL" . ") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
return true;
}
示例4: sort_tracks
/**
* Sort the tracks and save the new position
*/
public function sort_tracks()
{
/* First get all of the songs in order of their tracks */
$sql = "SELECT A.`id`\n FROM `playlist_data` AS A\n LEFT JOIN `song` AS B ON A.object_id = B.id\n LEFT JOIN `artist` AS C ON B.artist = C.id\n LEFT JOIN `album` AS D ON B.album = D.id\n WHERE A.`playlist` = ?\n ORDER BY C.`name` ASC,\n B.`title` ASC,\n D.`year` ASC,\n D.`name` ASC,\n B.`track` ASC";
$db_results = Dba::query($sql, array($this->id));
$i = 1;
$results = array();
while ($r = Dba::fetch_assoc($db_results)) {
$new_data = array();
$new_data['id'] = $r['id'];
$new_data['track'] = $i;
$results[] = $new_data;
$i++;
}
// end while results
foreach ($results as $data) {
$sql = "UPDATE `playlist_data` SET `track` = ? WHERE `id` = ?";
Dba::write($sql, array($data['track'], $data['id']));
}
// foreach re-ordered results
return true;
}
示例5: install
/**
* install
* This function installs the remote catalog
*/
public function install()
{
$sql = "CREATE TABLE `catalog_dropbox` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , " . "`apikey` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`secret` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`path` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`authtoken` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`getchunk` TINYINT(1) NOT NULL, " . "`catalog_id` INT( 11 ) NOT NULL" . ") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
return true;
}