[pLog-svn] r1753 - plog/branches/plog-1.0.1/class/gallery/dao
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Apr 5 19:36:17 GMT 2005
Author: oscar
Date: 2005-04-05 19:36:16 +0000 (Tue, 05 Apr 2005)
New Revision: 1753
Modified:
plog/branches/plog-1.0.1/class/gallery/dao/galleryalbums.class.php
plog/branches/plog-1.0.1/class/gallery/dao/galleryresources.class.php
Log:
same optimization but this time for resources and albums
Modified: plog/branches/plog-1.0.1/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/gallery/dao/galleryalbums.class.php 2005-04-05 19:23:17 UTC (rev 1752)
+++ plog/branches/plog-1.0.1/class/gallery/dao/galleryalbums.class.php 2005-04-05 19:36:16 UTC (rev 1753)
@@ -52,7 +52,10 @@
*/
function getUserAlbums( $ownerId, $onlyShownAlbums = false, $page = DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
{
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums WHERE owner_id = $ownerId";
+ $query = "SELECT id, owner_id, description,
+ name, flags, parent_id,
+ date, properties, show_album
+ FROM ".$this->getPrefix()."gallery_albums WHERE owner_id = $ownerId";
if( $onlyShownAlbums )
$query .=" AND show_album = 1";
@@ -84,7 +87,11 @@
}
// otherwise, continue the normal process...
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums WHERE id = $id";
+ $query = "SELECT id, owner_id, description,
+ name, flags, parent_id,
+ date, properties, show_album
+ FROM ".$this->getPrefix()."gallery_albums
+ WHERE id = $id";
if( $ownerId != -1 )
$query .= " AND owner_id = $ownerId";
if( $onlyShownAlbums )
@@ -113,7 +120,11 @@
function getAlbumByName( $id, $ownerId = -1, $fetchResources = true, $onlyShownAlbums = false )
{
// otherwise, continue the normal process...
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums WHERE mangled_name = '".Db::qstr($id)."'";
+ $query = "SELECT id, owner_id, description,
+ name, flags, parent_id,
+ date, properties, show_album
+ FROM ".$this->getPrefix()."gallery_albums
+ WHERE mangled_name = '".Db::qstr($id)."'";
if( $ownerId != -1 )
$query .= " AND owner_id = $ownerId";
if( $onlyShownAlbums )
@@ -157,7 +168,10 @@
*/
function getChildAlbums( $albumId, $ownerId, $onlyShownAlbums = false )
{
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
+ $query = "SELECT id, owner_id, description,
+ name, flags, parent_id,
+ date, properties, show_album
+ FROM ".$this->getPrefix()."gallery_albums
WHERE parent_id = $albumId AND
owner_id = $ownerId";
if( $onlyShownAlbums )
@@ -354,7 +368,10 @@
function getUserAlbumsGroupedByParentId( $userId, $albumId = 0 )
{
$prefix = $this->getPrefix();
- $query = "SELECT * FROM {$prefix}gallery_albums
+ $query = "SELECT id, owner_id, description,
+ name, flags, parent_id,
+ date, properties, show_album
+ FROM {$prefix}gallery_albums
WHERE owner_id = '".Db::qstr($userId)."'
ORDER BY name ASC";
Modified: plog/branches/plog-1.0.1/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/gallery/dao/galleryresources.class.php 2005-04-05 19:23:17 UTC (rev 1752)
+++ plog/branches/plog-1.0.1/class/gallery/dao/galleryresources.class.php 2005-04-05 19:36:16 UTC (rev 1753)
@@ -92,7 +92,10 @@
*/
function getResource( $resourceId, $ownerId = -1, $albumId = -1 )
{
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_resources
+ $query = "SELECT id, owner_id, album_id, description,
+ date, flags, resource_type, file_path, file_name,
+ metadata, thumbnail_format, properties
+ FROM ".$this->getPrefix()."gallery_resources
WHERE id = $resourceId";
if( $ownerId > 0 )
$query .= " AND owner_id = $ownerId";
@@ -126,7 +129,10 @@
$prefix = $this->getPrefix();
$albumId = $resource->getAlbumId();
$date = $resource->getDate();
- $query = "SELECT * from {$prefix}gallery_resources
+ $query = "SELECT id, owner_id, album_id, description,
+ date, flags, resource_type, file_path, file_name,
+ metadata, thumbnail_format, properties
+ FROM {$prefix}gallery_resources
WHERE album_id = '$albumId' AND date > '$date'
ORDER BY date ASC LIMIT 1";
@@ -156,7 +162,10 @@
$prefix = $this->getPrefix();
$albumId = $resource->getAlbumId();
$date = $resource->getDate();
- $query = "SELECT * from {$prefix}gallery_resources
+ $query = "SELECT id, owner_id, album_id, description,
+ date, flags, resource_type, file_path, file_name,
+ metadata, thumbnail_format, properties
+ FROM {$prefix}gallery_resources
WHERE album_id = '$albumId' AND date < '$date'
ORDER BY date DESC LIMIT 1";
@@ -186,7 +195,10 @@
*/
function getUserResources( $ownerId, $albumId = GALLERY_NO_ALBUM, $resourceType = GALLEY_RESOURCE_ANY, $page = DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
{
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_resources
+ $query = "SELECT id, owner_id, album_id, description,
+ date, flags, resource_type, file_path, file_name,
+ metadata, thumbnail_format, properties
+ FROM ".$this->getPrefix()."gallery_resources
WHERE owner_id = '".Db::qstr($ownerId)."'";
if( $albumId > GALLERY_NO_ALBUM )
$query .= " AND album_id = '".Db::qstr($albumId)."'";
@@ -574,7 +586,10 @@
*/
function getResourceFile( $ownerId, $fileName, $albumId = -1 )
{
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_resources
+ $query = "SELECT id, owner_id, album_id, description,
+ date, flags, resource_type, file_path, file_name,
+ metadata, thumbnail_format, properties
+ FROM ".$this->getPrefix()."gallery_resources
WHERE owner_id = $ownerId AND
file_name = '$fileName'";
More information about the pLog-svn
mailing list