Constructs a new SQL storage object.
Klutz_Driver_sql
Klutz_Driver_sql
([array $params = array()])
-
array
$params: A hash containing connection parameters.
Add a unique identifier for a given image.
boolean|PEAR_Error
addSum
(string $index, timestamp $date, string $data)
-
string
$index: The index for the comic
-
timestamp
$date: The date of the comic
-
string
$data: The md5 of the raw (binary) image data
Find out if we already have a local copy of this image.
boolean
imageExists
(string $index, [timestamp $date = null])
-
string
$index: The index of the comic to check
-
timestamp
$date: The date of the comic to check (default today)
Redefinition of:
- Klutz_Driver::imageExists()
- Find out if we already have a local copy of this image.
Get the image dimensions for the requested image.
string
imageSize
(string $index, [timestamp $date = null])
-
string
$index: The index of the comic to check
-
timestamp
$date: The date of the comic to check (default today)
Redefinition of:
- Klutz_Driver::imageSize()
- Get the image dimensions for the requested image.
Determine if the image passed is a unique image (one we don't already have).
This allows for $days = random, etc., but keeps us from getting the same comic day after day.
Get a list of the dates for which we have comics between $oldest and $newest. Only returns dates we have at least one comic for.
mixed
listDates
([timestamp $date = null], [timestamp $oldest = null], [timestamp $newest = null])
-
timestamp
$date: The reference date (default today)
-
timestamp
$oldest: The earliest possible date to return (default first of the month)
-
timestamp
$newest: The latest possible date to return (default last date of the month)
Redefinition of:
- Klutz_Driver::listDates()
- Gets a list of the dates for which we have comics between $oldest and $newest. In the default driver (no backend) this is just a list of all dates between $oldest and $newest.
We do nothing in this function for the SQL driver since we grab the info on demand from the database. We keep the function here, however to honor our 'interface' since we call this function from various places in the client code.
void
loadSums
()
Rebuild the table of unique identifiers.
void
rebuildSums
()
Remove all images from the storage system (including unique IDs) for a given date.
boolean
removeDate
([timestamp $date = null])
-
timestamp
$date: The date to remove comics for (default today)
Remove an image from the storage system (including its unique ID).
boolean
removeImage
(string $index, [timestamp $date = null])
-
string
$index: The index of the comic to remove
-
timestamp
$date: The date of the comic to remove (default today)
Remove the unique identifier for the given comic and/or
date. If both are passed, removes the uid for that comic and date. If only a comic is passed, removes all uids for that comic. If only a date is passed removes uids for all comics on that date. If neither is passed, all uids are wiped out.
int|PEAR_Error
removeSum
([string $index = null], [timestamp $date = null])
-
string
$index: Index for the comic to delete. If left out all comics will be assumed.
-
timestamp
$date: Date to remove. If left out, assumes all dates.
Retrieve an image from storage. Make sure the image exists first with imageExists().
mixed
retrieveImage
(string $index, [timestamp $date = null])
-
string
$index: The index of the comic to retrieve
-
timestamp
$date: The date for which we want $comic
Redefinition of:
- Klutz_Driver::retrieveImage()
- Retrieve an image from storage. Since there is no local storage this will actually call for the fetching.
Store an image for later retrieval.
boolean
storeImage
(string $index, string $image, [ $date = null], timestamp $data)
-
string
$index: The index of the comic to retrieve
-
string
$image: Raw (binary) image data to store
-
timestamp
$data: Date to store it under (default today)
-
$date
Redefinition of:
- Klutz_Driver::storeImage()
- Store an image for later retrieval
Inherited Methods
Inherited From Klutz_Driver
Klutz_Driver::Klutz_Driver()
Klutz_Driver::factory()
Klutz_Driver::imageExists()
Klutz_Driver::imageSize()
Klutz_Driver::listDates()
Klutz_Driver::retrieveImage()
Klutz_Driver::singleton()
Klutz_Driver::storeImage()