Mnemo_Driver_Sql
extends Mnemo_Driver
in package
Mnemo storage implementation for Horde's Horde_Db database abstraction layer.
Copyright 2001-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (ASL). If you did not receive this file, see http://www.horde.org/licenses/apache.
Tags
Table of Contents
- $_charset : string
- Charset
- $_column : Horde_Db_Adapter_Base_Column
- Column definition of body column.
- $_db : Horde_Db_Adapter
- The database connection object.
- $_memos : array<string|int, mixed>
- Array holding the current memo list. Each array entry is a hash describing a memo. The array is indexed numerically by memo ID.
- $_notepad : string
- String containing the current notepad name.
- $_pgp : Horde_Crypt_pgp
- Crypting processor.
- __construct() : mixed
- Construct a new SQL storage object.
- add() : string
- Adds a note to the backend storage.
- delete() : mixed
- Deletes a note permanently.
- deleteAll() : mixed
- Deletes all notes from the current notepad.
- encryptionSupported() : bool
- Returns whether note encryption is supported.
- fromiCalendar() : array<string|int, mixed>
- Create a memo (hash array) from a Horde_Icalendar_Vnote object.
- get() : array<string|int, mixed>
- Retrieves one note from the backend.
- getByUID() : array<string|int, mixed>
- Retrieves one note from the backend by UID.
- getMemoDescription() : mixed
- Update the description (short summary) of a memo.
- listMemos() : array<string|int, mixed>
- Lists memos based on the given criteria. All memos will be returned by default.
- modify() : mixed
- Modifies an existing note.
- move() : mixed
- Moves a note to a new notepad.
- retrieve() : mixed
- Retrieves all of the notes of the current notepad from the backend.
- synchronize() : mixed
- Perform any synchronization with backend data handlers that may be necessary for the driver.
- toASNote() : Horde_ActiveSync_Message_Note
- Create an AS memo from this task
- toiCalendar() : Horde_Icalendar_Vnote
- Export this memo in iCalendar format.
- _add() : string
- Adds a note to the backend storage.
- _buildNote() : array<string|int, mixed>
- _decrypt() : string
- Decrypts a note.
- _decryptBody() : bool
- Tries to decrypt the note body.
- _delete() : string
- Deletes a note permanently.
- _deleteAll() : array<string|int, mixed>
- Deletes all notes from the current notepad.
- _encrypt() : string
- Encrypts a note.
- _generateId() : string
- Generates a local note ID.
- _loadPGP() : mixed
- Loads the PGP encryption driver.
- _modify() : string
- Modifies an existing note.
- _move() : string
- Moves a note to a new notepad.
Properties
$_charset
Charset
protected
string
$_charset
$_column
Column definition of body column.
protected
Horde_Db_Adapter_Base_Column
$_column
$_db
The database connection object.
protected
Horde_Db_Adapter
$_db
$_memos
Array holding the current memo list. Each array entry is a hash describing a memo. The array is indexed numerically by memo ID.
protected
array<string|int, mixed>
$_memos
= array()
$_notepad
String containing the current notepad name.
protected
string
$_notepad
= ''
$_pgp
Crypting processor.
protected
Horde_Crypt_pgp
$_pgp
Methods
__construct()
Construct a new SQL storage object.
public
__construct(string $notepad[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $notepad : string
-
The name of the notepad to load/save notes from.
- $params : array<string|int, mixed> = array()
-
The connection parameters
Tags
Return values
mixed —add()
Adds a note to the backend storage.
public
add(string $desc, string $body[, array<string|int, mixed>|string $tags = '' ][, string $passphrase = null ][, string $uid = null ]) : string
Parameters
- $desc : string
-
The first line of the note.
- $body : string
-
The whole note body.
- $tags : array<string|int, mixed>|string = ''
-
The tags of the note.
- $passphrase : string = null
-
The passphrase to encrypt the note with.
- $uid : string = null
-
The note's UID.
Tags
Return values
string —The ID of the new note.
delete()
Deletes a note permanently.
public
delete(string $noteId) : mixed
Parameters
- $noteId : string
-
The note to delete.
Tags
Return values
mixed —deleteAll()
Deletes all notes from the current notepad.
public
deleteAll() : mixed
Tags
Return values
mixed —encryptionSupported()
Returns whether note encryption is supported.
public
encryptionSupported() : bool
Checks if PGP support could be loaded, if it supports symmetric encryption, and if we have a secure connection.
Return values
bool —Whether encryption is suppoted.
fromiCalendar()
Create a memo (hash array) from a Horde_Icalendar_Vnote object.
public
fromiCalendar(Horde_Icalendar_Vnote $vNote) : array<string|int, mixed>
Parameters
- $vNote : Horde_Icalendar_Vnote
Return values
array<string|int, mixed> —Memo (hash array) created from the vNote.
get()
Retrieves one note from the backend.
public
get(string $noteId[, string $passphrase = null ]) : array<string|int, mixed>
Parameters
- $noteId : string
-
The ID of the note to retrieve.
- $passphrase : string = null
-
A passphrase with which this note was supposed to be encrypted.
Tags
Return values
array<string|int, mixed> —The array of note attributes.
getByUID()
Retrieves one note from the backend by UID.
public
getByUID(string $uid[, string $passphrase = null ]) : array<string|int, mixed>
Parameters
- $uid : string
-
The UID of the note to retrieve.
- $passphrase : string = null
-
A passphrase with which this note was supposed to be encrypted.
Tags
Return values
array<string|int, mixed> —The array of note attributes.
getMemoDescription()
Update the description (short summary) of a memo.
public
getMemoDescription(mixed $body) : mixed
Parameters
- $body : mixed
Return values
mixed —listMemos()
Lists memos based on the given criteria. All memos will be returned by default.
public
listMemos() : array<string|int, mixed>
Return values
array<string|int, mixed> —Returns a list of the requested memos.
modify()
Modifies an existing note.
public
modify(string $noteId, string $desc, string $body[, string $tags = '' ][, string $passphrase = null ]) : mixed
Parameters
- $noteId : string
-
The note to modify.
- $desc : string
-
The first line of the note.
- $body : string
-
The whole note body.
- $tags : string = ''
-
The tags of the note.
- $passphrase : string = null
-
The passphrase to encrypt the note with.
Tags
Return values
mixed —move()
Moves a note to a new notepad.
public
move(string $noteId, string $newNotepad) : mixed
Parameters
- $noteId : string
-
The note to move.
- $newNotepad : string
-
The new notepad.
Tags
Return values
mixed —retrieve()
Retrieves all of the notes of the current notepad from the backend.
public
retrieve([bool $raw = false ]) : mixed
Parameters
- $raw : bool = false
-
Return the raw bodies, don't try to decrypt.
Tags
Return values
mixed —synchronize()
Perform any synchronization with backend data handlers that may be necessary for the driver.
public
synchronize([mixed $token = false ]) : mixed
Parameters
- $token : mixed = false
-
A value indicating the last synchronization point, if available.
Return values
mixed —toASNote()
Create an AS memo from this task
public
toASNote(array<string|int, mixed> $memo[, array<string|int, mixed> $options = array() ]) : Horde_ActiveSync_Message_Note
Parameters
- $memo : array<string|int, mixed>
-
A memo array.
- $options : array<string|int, mixed> = array()
Return values
Horde_ActiveSync_Message_Note —toiCalendar()
Export this memo in iCalendar format.
public
toiCalendar(mixed $memo, mixed $calendar) : Horde_Icalendar_Vnote
Parameters
- $memo : mixed
- $calendar : mixed
Return values
Horde_Icalendar_Vnote —object for this event.
_add()
Adds a note to the backend storage.
protected
_add(string $noteId, string $desc, string $body, array<string|int, mixed>|string $tags, string $uid) : string
Parameters
- $noteId : string
-
The ID of the new note.
- $desc : string
-
The first line of the note.
- $body : string
-
The whole note body.
- $tags : array<string|int, mixed>|string
-
The tags of the note.
- $uid : string
-
The note's UID.
Tags
Return values
string —The unique ID of the new note.
_buildNote()
protected
_buildNote(array<string|int, mixed> $row[, string $passphrase = null ][, bool $raw = false ]) : array<string|int, mixed>
Parameters
- $row : array<string|int, mixed>
-
Hash of the note data, db keys.
- $passphrase : string = null
-
The encryption passphrase.
- $raw : bool = false
-
Return the raw body, don't try to decrypt.
Tags
Return values
array<string|int, mixed> —a Note hash.
_decrypt()
Decrypts a note.
protected
_decrypt(string $note, string $passphrase) : string
Parameters
- $note : string
-
The encrypted note text.
- $passphrase : string
-
The passphrase to decrypt the note with.
Tags
Return values
string —The decrypted text.
_decryptBody()
Tries to decrypt the note body.
protected
_decryptBody(string &$body, string $id, string $passphrase) : bool
Parameters
- $body : string
-
The note body. Will be decrypted if possible, or set to an exception if decryption failed.
- $id : string
-
The note ID.
- $passphrase : string
-
An optional encryption password.
Return values
bool —Whether this was an encrypted note.
_delete()
Deletes a note permanently.
protected
_delete(mixed $noteId) : string
Parameters
- $noteId : mixed
Tags
Return values
string —The note's UID.
_deleteAll()
Deletes all notes from the current notepad.
protected
_deleteAll() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of uids that have been removed.
_encrypt()
Encrypts a note.
protected
_encrypt(string $note, string $passphrase) : string
Parameters
- $note : string
-
The note text.
- $passphrase : string
-
The passphrase to encrypt the note with.
Return values
string —The encrypted text.
_generateId()
Generates a local note ID.
protected
_generateId() : string
Return values
string —A new note ID.
_loadPGP()
Loads the PGP encryption driver.
protected
_loadPGP() : mixed
Tags
Return values
mixed —_modify()
Modifies an existing note.
protected
_modify(string $noteId, string $desc, string $body, string $tags) : string
Parameters
- $noteId : string
-
The note to modify.
- $desc : string
-
The first line of the note.
- $body : string
-
The whole note body.
- $tags : string
-
The tags of the note.
Tags
Return values
string —The note's UID.
_move()
Moves a note to a new notepad.
protected
_move(string $noteId, string $newNotepad) : string
Parameters
- $noteId : string
-
The note to move.
- $newNotepad : string
-
The new notepad.
Tags
Return values
string —The note's UID.