Class Nag_Driver_sql

Description

Nag storage implementation for PHP's PEAR database abstraction layer.

Required parameters:

   'phptype'      The database type (e.g. 'pgsql', 'mysql', etc.).
   'charset'      The database's internal charset.

Required by some database implementations:

   'hostspec'     The hostname of the database server.
   'protocol'     The communication protocol ('tcp', 'unix', etc.).
   'database'     The name of the database.
   'username'     The username with which to connect to the database.
   'password'     The password associated with 'username'.
   'options'      Additional options to pass to the database.
   'tty'          The TTY on which to connect to the database.
   'port'         The port on which to connect to the database.

Optional values when using separate reading and writing servers, for example in replication settings:

   'splitread'   Boolean, whether to implement the separation or not.
   'read'        Array containing the parameters which are different for
                 the read database connection, currently supported
                 only 'hostspec' and 'port' parameters.

Optional parameters:

   'table'     The name of the tasks table in 'database'.  Default is
               'nag_tasks'.

The table structure can be created by the scripts/sql/nag.sql script.

$Horde: nag/lib/Driver/sql.php,v 1.60.2.24 2009/10/22 14:24:20 jan Exp $

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.fsf.org/copyleft/gpl.html.

Located in /lib/Driver/sql.php (line 41)

Nag_Driver
   |
   --Nag_Driver_sql
Variable Summary
Method Summary
 Nag_Driver_sql Nag_Driver_sql (string $tasklist, [array $params = array()])
 mixed deleteAll ()
 Nag_Task get (string $taskId)
 Nag_Task getByUID (string $uid)
 array getChildren (string $parentId)
 boolean initialize ()
 array listAlarms (integer $date)
 mixed retrieve ([integer $completed = 1])
 string _add (string $name, string $desc, [integer $start = 0], [integer $due = 0], [integer $priority = 0], [float $estimate = 0.0], [integer $completed = 0], [string $category = ''], [ $alarm = 0], [string $uid = null], [string $parent = ''], [boolean $private = false], [string $owner = null], [string $assignee = null])
 void _buildTask ( $row)
 void _delete (string $taskId)
 void _modify (string $taskId, string $name, string $desc, [integer $start = 0], [integer $due = 0], [integer $priority = 0], [float $estimate = 0.0], [integer $completed = 0], [string $category = ''], [integer $alarm = 0], [string $parent = ''], [boolean $private = false], [string $owner = null], [string $assignee = null], [integer $completed_date = null])
 void _move (string $taskId, string $newTasklist)
Variables
DB $_db (line 48)

Handle for the current database connection.

DB $_write_db (line 56)

Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.

Inherited Variables

Inherited from Nag_Driver

Nag_Driver::$tasks
Nag_Driver::$_errormsg
Nag_Driver::$_params
Nag_Driver::$_tasklist
Methods
Constructor Nag_Driver_sql (line 64)

Constructs a new SQL storage object.

Nag_Driver_sql Nag_Driver_sql (string $tasklist, [array $params = array()])
  • string $tasklist: The tasklist to load.
  • array $params: A hash containing connection parameters.
deleteAll (line 347)

Deletes all tasks from the backend.

  • return: True on success, PEAR_Error on failure.
mixed deleteAll ()
get (line 77)

Retrieves one task from the database.

  • return: A Nag_Task object.
Nag_Task get (string $taskId)
  • string $taskId: The id of the task to retrieve.

Redefinition of:
Nag_Driver::get()
Retrieves one task from the database.
getByUID (line 114)

Retrieves one task from the database by UID.

  • return: A Nag_Task object.
Nag_Task getByUID (string $uid)
  • string $uid: The UID of the task to retrieve.

Redefinition of:
Nag_Driver::getByUID()
Retrieves one task from the database by UID.
getChildren (line 453)

Retrieves sub-tasks from the database.

  • return: List of sub-tasks.
array getChildren (string $parentId)
  • string $parentId: The parent id for the sub-tasks to retrieve.

Redefinition of:
Nag_Driver::getChildren()
Retrieves sub-tasks from the database.
initialize (line 573)

Attempts to open a connection to the SQL server.

  • return: True on success, PEAR_Error on failure.
boolean initialize ()
listAlarms (line 502)

Lists all alarms near $date.

  • return: An array of tasks that have alarms that match.
array listAlarms (integer $date)
  • integer $date: The unix epoch time to check for alarms.

Redefinition of:
Nag_Driver::listAlarms()
List all alarms near $date.
retrieve (line 373)

Retrieves tasks from the database.

  • return: True on success, PEAR_Error on failure.
mixed retrieve ([integer $completed = 1])
  • integer $completed: Which tasks to retrieve (1 = all tasks,
    1. = incomplete tasks, 2 = complete tasks,
    3 = future tasks, 4 = future and incomplete tasks).

Redefinition of:
Nag_Driver::retrieve()
Retrieves tasks from the database.
_add (line 164)

Adds a task to the backend storage.

  • return: The Nag ID of the new task.
string _add (string $name, string $desc, [integer $start = 0], [integer $due = 0], [integer $priority = 0], [float $estimate = 0.0], [integer $completed = 0], [string $category = ''], [ $alarm = 0], [string $uid = null], [string $parent = ''], [boolean $private = false], [string $owner = null], [string $assignee = null])
  • string $name: The name (short) of the task.
  • string $desc: The description (long) of the task.
  • integer $start: The start date of the task.
  • integer $due: The due date of the task.
  • integer $priority: The priority of the task.
  • float $estimate: The estimated time to complete the task.
  • integer $completed: The alarm associated with the task.
  • string $category: The category of the task.
  • string $uid: A Unique Identifier for the task.
  • string $parent: The parent task id.
  • boolean $private: Whether the task is private.
  • string $owner: The owner of the event.
  • string $assignee: The assignee of the event.
  • $alarm
_buildTask (line 531)
void _buildTask ( $row)
  • $row
_delete (line 318)

Deletes a task from the backend.

void _delete (string $taskId)
  • string $taskId: The task to delete.
_modify (line 233)

Modifies an existing task.

void _modify (string $taskId, string $name, string $desc, [integer $start = 0], [integer $due = 0], [integer $priority = 0], [float $estimate = 0.0], [integer $completed = 0], [string $category = ''], [integer $alarm = 0], [string $parent = ''], [boolean $private = false], [string $owner = null], [string $assignee = null], [integer $completed_date = null])
  • string $taskId: The task to modify.
  • string $name: The name (short) of the task.
  • string $desc: The description (long) of the task.
  • integer $start: The start date of the task.
  • integer $due: The due date of the task.
  • integer $priority: The priority of the task.
  • float $estimate: The estimated time to complete the task.
  • integer $completed: The completion state of the task.
  • string $category: The category of the task.
  • integer $alarm: The alarm associated with the task.
  • string $parent: The parent task id.
  • boolean $private: Whether the task is private.
  • string $owner: The owner of the event.
  • string $assignee: The assignee of the event.
  • integer $completed_date: The task's completion date.
_move (line 293)

Moves a task to a different tasklist.

void _move (string $taskId, string $newTasklist)
  • string $taskId: The task to move.
  • string $newTasklist: The new tasklist.

Inherited Methods

Inherited From Nag_Driver

 Nag_Driver::Nag_Driver()
 Nag_Driver::add()
 Nag_Driver::delete()
 Nag_Driver::factory()
 Nag_Driver::generateUID()
 Nag_Driver::get()
 Nag_Driver::getByUID()
 Nag_Driver::getChildren()
 Nag_Driver::listAlarms()
 Nag_Driver::modify()
 Nag_Driver::retrieve()
 Nag_Driver::singleton()

Documentation generated on Sun, 30 Jan 2011 05:35:04 +0000 by phpDocumentor 1.4.3