else
{
$result = $this->db->db_query("
- SELECT id,name
+ SELECT id as id,name as name
FROM tags
ORDER BY sort_priority ASC
");
/* ~ F-Spot version 0.3.x */
if($this->dbver < 9) {
$query_str = "
- SELECT p.id, p.name, p.time, p.directory_path, p.description
- FROM photos p
+ SELECT
+ p.id as id,
+ p.name as name,
+ p.time as time,
+ p.directory_path as directory_path,
+ p.description as description
+ FROM
+ photos p
";
}
else {
/* till F-Spot version 0.4.1 */
if($this->dbver < 11) {
$query_str = "
- SELECT p.id, p.uri, p.time, p.description
- FROM photos p
+ SELECT
+ p.id as id,
+ p.uri as uri,
+ p.time as time,
+ p.description as description
+ FROM
+ photos p
";
}
else {
/* rating value got introduced */
$query_str = "
- SELECT p.id, p.uri, p.time, p.description, p.rating
- FROM photos p
+ SELECT
+ p.id as id,
+ p.uri as uri,
+ p.time as time,
+ p.description as description,
+ p.rating as rating
+ FROM
+ photos p
";
}
}
* @return array
*/
public function getPhotoSelection()
- {
+ {
$matched_photos = Array();
$additional_where_cond = "";
/* return a search result */
if(isset($_SESSION['searchfor_tag']) && $_SESSION['searchfor_tag'] != '') {
$query_str = "
- SELECT DISTINCT pt1.photo_id
- FROM photo_tags pt1
+ SELECT DISTINCT
+ pt1.photo_id as photo_id
+ FROM
+ photo_tags pt1
INNER JOIN photo_tags pt2
ON pt1.photo_id=pt2.photo_id
INNER JOIN tags t
/* photo has to match at least on of the selected tags */
if($_SESSION['tag_condition'] == 'or') {
$query_str = "
- SELECT DISTINCT pt1.photo_id
- FROM photo_tags pt1
+ SELECT DISTINCT
+ pt1.photo_id as photo_id
+ FROM
+ photo_tags pt1
INNER JOIN photo_tags pt2
ON pt1.photo_id=pt2.photo_id
INNER JOIN tags t
*/
$query_str = "
- SELECT DISTINCT pt1.photo_id
- FROM photo_tags pt1
+ SELECT DISTINCT
+ pt1.photo_id as photo_id
+ FROM
+ photo_tags pt1
";
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
/* return all available photos */
$query_str = "
- SELECT DISTINCT p.id
- FROM photos p
+ SELECT DISTINCT
+ p.id as id
+ FROM
+ photos p
LEFT JOIN photo_tags pt
ON p.id=pt.photo_id
LEFT JOIN tags t
private function get_photo_tags($idx)
{
$result = $this->db->db_query("
- SELECT t.id, t.name
+ SELECT t.id as id, t.name as name
FROM tags t
INNER JOIN photo_tags pt
ON t.id=pt.tag_id
$all = Array();
$query_str = "
- SELECT p.id
+ SELECT p.id as id
FROM photos p
";
else {
$query_str = "
SELECT
- p.id
+ p.id as id
FROM
photos p
INNER JOIN photo_tags pt
$to_delete = Array();
$result = $this->cfg_db->db_query("
- SELECT img_idx
+ SELECT img_idx as img_idx
FROM images
ORDER BY img_idx ASC
");
while($row = $this->cfg_db->db_fetch_object($result)) {
if(!$this->db->db_fetchSingleRow("
- SELECT id
+ SELECT id as id
FROM photos
WHERE id='". $row['img_idx'] ."'")) {
public function get_tag_name($idx)
{
if($result = $this->db->db_fetchSingleRow("
- SELECT name
+ SELECT name as name
FROM tags
WHERE
id LIKE '". $idx ."'")) {
public function get_db_version()
{
if($row = $this->cfg_db->db_fetchSingleRow("
- SELECT meta_value
+ SELECT meta_value as meta_value
FROM
meta
WHERE