Page MenuHomePhorge

abstract class LiskDAO
Phorge Technical Documentation (Storage)

Simple object-authoritative data access object that makes it easy to build stuff that you need to save to a database. Basically, it means that the amount of boilerplate code (and, particularly, boilerplate SQL) you need to write is greatly reduced.

Lisk makes it fairly easy to build something quickly and end up with reasonably high-quality code when you're done (e.g., getters and setters, objects, transactions, reasonably structured OO code). It's also very thin: you can break past it and use MySQL and other lower-level tools when you need to in those couple of cases where it doesn't handle your workflow gracefully.

However, Lisk won't scale past one database and lacks many of the features of modern DAOs like Hibernate: for instance, it does not support joins or polymorphic storage.

This means that Lisk is well-suited for tools like Differential, but often a poor choice elsewhere. And it is strictly unsuitable for many projects.

Lisk's model is object-authoritative: the PHP class definition is the master authority for what the object looks like.

Building New Objects

To create new Lisk objects, extend LiskDAO and implement establishLiveConnection(). It should return an AphrontDatabaseConnection; this will tell Lisk where to save your objects.

class Dog extends LiskDAO {

  protected $name;
  protected $breed;

  public function establishLiveConnection() {
    return $some_connection_object;
  }
}

Now, you should create your table:

CREATE TABLE dog (
  id int unsigned not null auto_increment primary key,
  name varchar(32) not null,
  breed varchar(32) not null,
  dateCreated int unsigned not null,
  dateModified int unsigned not null
);

For each property in your class, add a column with the same name to the table (see getConfiguration() for information about changing this mapping). Additionally, you should create the three columns id, dateCreated and dateModified. Lisk will automatically manage these, using them to implement autoincrement IDs and timestamps. If you do not want to use these features, see getConfiguration() for information on disabling them. At a bare minimum, you must normally have an id column which is a primary or unique key with a numeric type, although you can change its name by overriding getIDKey() or disable it entirely by overriding getIDKey() to return null. Note that many methods rely on a single-part primary key and will no longer work (they will throw) if you disable it.

As you add more properties to your class in the future, remember to add them to the database table as well.

Lisk will now automatically handle these operations: getting and setting properties, saving objects, loading individual objects, loading groups of objects, updating objects, managing IDs, updating timestamps whenever an object is created or modified, and some additional specialized operations.

Creating, Retrieving, Updating, and Deleting

To create and persist a Lisk object, use save():

$dog = id(new Dog())
  ->setName('Sawyer')
  ->setBreed('Pug')
  ->save();

Note that Lisk automatically builds getters and setters for all of your object's protected properties via __call(). If you want to add custom behavior to your getters or setters, you can do so by overriding the readField() and writeField() methods.

Calling save() will persist the object to the database. After calling save(), you can call getID() to retrieve the object's ID.

To load objects by ID, use the load() method:

$dog = id(new Dog())->load($id);

This will load the Dog record with ID $id into $dog, or null if no such record exists (load() is an instance method rather than a static method because PHP does not support late static binding, at least until PHP 5.3).

To update an object, change its properties and save it:

$dog->setBreed('Lab')->save();

To delete an object, call delete():

$dog->delete();

That's Lisk CRUD in a nutshell.

Queries

Often, you want to load a bunch of objects, or execute a more specialized query. Use loadAllWhere() or loadOneWhere() to do this:

$pugs = $dog->loadAllWhere('breed = %s', 'Pug');
$sawyer = $dog->loadOneWhere('name = %s', 'Sawyer');

These methods work like queryfx(), but only take half of a query (the part after the WHERE keyword). Lisk will handle the connection, columns, and object construction; you are responsible for the rest of it. loadAllWhere() returns a list of objects, while loadOneWhere() returns a single object (or null).

There's also a loadRelatives() method which helps to prevent the 1+N queries problem.

Managing Transactions

Lisk uses a transaction stack, so code does not generally need to be aware of the transactional state of objects to implement correct transaction semantics:

$obj->openTransaction();
  $obj->save();
  $other->save();
  // ...
  $other->openTransaction();
    $other->save();
    $another->save();
  if ($some_condition) {
    $other->saveTransaction();
  } else {
    $other->killTransaction();
  }
  // ...
$obj->saveTransaction();

Assuming $obj, $other and $another live on the same database, this code will work correctly by establishing savepoints.

Selects whose data are used later in the transaction should be included in beginReadLocking() or beginWriteLocking() block.

Tasks

Managing Connections

  • abstract protected function establishLiveConnection($mode) — Establish a live connection to a database service. This method should return a new connection. Lisk handles connection caching and management; do not perform caching deeper in the stack.
  • protected function getConnectionNamespace() — Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.
  • protected function getEstablishedConnection($mode) — Get an existing, cached connection for this object.
  • protected function setEstablishedConnection($mode, $connection, $force_unique) — Store a connection in the connection cache.
  • public function setForcedConnection($connection) — Force an object to use a specific connection.

Configuring Lisk

  • protected function getConfiguration() — Change Lisk behaviors, like ID configuration and timestamps. If you want to change these behaviors, you should override this method in your child class and change the options you're interested in. For example:
  • public function getConfigOption($option_name) — Determine the setting of a configuration option for this class of objects.

Loading Objects

  • public function load($id) — Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:
  • public function loadAll() — Loads all of the objects, unconditionally.
  • public function loadAllWhere($pattern, ...) — Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:
  • public function loadOneWhere($pattern, ...) — Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.
  • public function reload() — Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.
  • public function loadFromArray($row) — Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via @{method:queryData}) and then load from an array representation.
  • public function loadAllFromArray($rows) — Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with @{method:loadAllWhere}, but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:

Examining Objects

  • public function getID() — Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.
  • public function hasProperty($property) — Test if a property exists.
  • protected function getAllLiskProperties() — Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.
  • protected function checkProperty($property) — Check if a property exists on this object.
  • public function establishConnection($mode, $force_new) — Get or build the database connection for this object.
  • protected function getAllLiskPropertyValues() — Convert this object into a property dictionary. This dictionary can be restored into an object by using @{method:loadFromArray} (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).

Writing Objects

  • public function setID($id) — Set unique ID identifying this object. You normally don't need to call this method unless with `IDS_MANUAL`.
  • public function save() — Persist this object to the database. In most cases, this is the only method you need to call to do writes. If the object has not yet been inserted this will do an insert; if it has, it will do an update.
  • public function replace() — Save this object, forcing the query to use REPLACE regardless of object state.
  • public function insert() — Save this object, forcing the query to use INSERT regardless of object state.
  • public function update() — Save this object, forcing the query to use UPDATE regardless of object state.
  • public function delete() — Delete this object, permanently.
  • protected function insertRecordIntoDatabase($mode) — Internal implementation of INSERT and REPLACE.

Hooks and Callbacks

  • public function getTableName() — Retrieve the database table name. By default, this is the class name.
  • public function getIDKey() — Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.
  • public function generatePHID() — Generate a new PHID, used by CONFIG_AUX_PHID.
  • protected function willWriteData(&$data) — Hook to apply serialization or validation to data before it is written to the database. See also @{method:willReadData}.
  • protected function didWriteData() — Hook to perform actions after data has been written to the database.
  • protected function willSaveObject() — Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.
  • protected function willReadData(&$data) — Hook to apply serialization or validation to data as it is read from the database. See also @{method:willWriteData}.
  • protected function didReadData() — Hook to perform an action on data after it is read from the database.
  • protected function willDelete() — Hook to perform an action before the deletion of an object.
  • protected function didDelete() — Hook to perform an action after the deletion of an object.
  • protected function readField($field) — Reads the value from a field. Override this method for custom behavior of @{method:getField} instead of overriding getField directly.
  • protected function writeField($field, $value) — Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.

Utilities

  • public function __set($name, $value) — Warns against writing to undeclared property.
  • protected function applyLiskDataSerialization(&$data, $deserialize) — Applies configured serialization to a dictionary of values.
  • public function __call($method, $args) — Black magic. Builds implied get*() and set*() for all properties.
  • public static function loadNextCounterValue($conn_w, $counter_name) — Increments a named counter and returns the next value.
  • public static function loadCurrentCounterValue($conn_r, $counter_name) — Returns the current value of a named counter.
  • public static function overwriteCounterValue($conn_w, $counter_name, $counter_value) — Overwrite a named counter, forcing it to a specific value.

Managing Transactions

  • public function beginReadLocking() — Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call @{method:endReadLocking}. For example:
  • public function endReadLocking() — Ends read-locking that began at an earlier @{method:beginReadLocking} call.
  • public function beginWriteLocking() — Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call @{method:endWriteLocking}.
  • public function endWriteLocking() — Ends write-locking that began at an earlier @{method:beginWriteLocking} call.

Isolation for Unit Testing

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)

Warns against writing to undeclared property.

Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function __construct()

Build an empty object.

Return
this//Implicit.//

abstract protected function establishLiveConnection($mode)

Establish a live connection to a database service. This method should return a new connection. Lisk handles connection caching and management; do not perform caching deeper in the stack.

Parameters
string$modeMode, either 'r' (reading) or 'w' (reading and writing).
Return
AphrontDatabaseConnectionNew database connection.

protected function getConnectionNamespace()

Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.

Return
stringConnection namespace for cache

abstract protected function getDatabaseName()

This method is not documented.
Return
wild

protected function getEstablishedConnection($mode)

Get an existing, cached connection for this object.

Parameters
mode$modeConnection mode.
Return
AphrontDatabaseConnection|nullConnection, if it exists in cache.

protected function setEstablishedConnection($mode, $connection, $force_unique)

Store a connection in the connection cache.

Parameters
mode$modeConnection mode.
AphrontDatabaseConnection$connectionConnection to cache.
$force_unique
Return
this

public function setForcedConnection($connection)

Force an object to use a specific connection.

This overrides all connection management and forces the object to use a specific connection when interacting with the database.

Parameters
AphrontDatabaseConnection$connectionConnection to force this object to use.
Return
wild

protected function getConfiguration()

Change Lisk behaviors, like ID configuration and timestamps. If you want to change these behaviors, you should override this method in your child class and change the options you're interested in. For example:

protected function getConfiguration() {
  return array(
    Lisk_DataAccessObject::CONFIG_EXAMPLE => true,
  ) + parent::getConfiguration();
}

The available options are:

CONFIG_IDS Lisk objects need to have a unique identifying ID. The three mechanisms available for generating this ID are IDS_AUTOINCREMENT (default, assumes the ID column is an autoincrement primary key), IDS_MANUAL (you are taking full responsibility for ID management), or IDS_COUNTER (see below).

InnoDB does not persist the value of auto_increment across restarts, and instead initializes it to MAX(id) + 1 during startup. This means it may reissue the same autoincrement ID more than once, if the row is deleted and then the database is restarted. To avoid this, you can set an object to use a counter table with IDS_COUNTER. This will generally behave like IDS_AUTOINCREMENT, except that the counter value will persist across restarts and inserts will be slightly slower. If a database stores any DAOs which use this mechanism, you must create a table there with this schema:

CREATE TABLE lisk_counter (
  counterName VARCHAR(64) COLLATE utf8_bin PRIMARY KEY,
  counterValue BIGINT UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CONFIG_TIMESTAMPS Lisk can automatically handle keeping track of a `dateCreated' and `dateModified' column, which it will update when it creates or modifies an object. If you don't want to do this, you may disable this option. By default, this option is ON.

CONFIG_AUX_PHID This option can be enabled by being set to some truthy value. The meaning of this value is defined by your PHID generation mechanism. If this option is enabled, a `phid' property will be populated with a unique PHID when an object is created (or if it is saved and does not currently have one). You need to override generatePHID() and hook it into your PHID generation mechanism for this to work. By default, this option is OFF.

CONFIG_SERIALIZATION You can optionally provide a column serialization map that will be applied to values when they are written to the database. For example:

self::CONFIG_SERIALIZATION => array(
  'complex' => self::SERIALIZATION_JSON,
)

This will cause Lisk to JSON-serialize the 'complex' field before it is written, and unserialize it when it is read.

CONFIG_BINARY You can optionally provide a map of columns to a flag indicating that they store binary data. These columns will not raise an error when handling binary writes.

CONFIG_COLUMN_SCHEMA Provide a map of columns to schema column types.

CONFIG_KEY_SCHEMA Provide a map of key names to key specifications.

CONFIG_NO_TABLE Allows you to specify that this object does not actually have a table in the database.

CONFIG_NO_MUTATE Provide a map of columns which should not be included in UPDATE statements. If you have some columns which are always written to explicitly and should never be overwritten by a save(), you can specify them here. This is an advanced, specialized feature and there are usually better approaches for most locking/contention problems.

Return
dictionaryMap of configuration options to values.

public function getConfigOption($option_name)

Determine the setting of a configuration option for this class of objects.

Parameters
const$option_nameOption name, one of the CONFIG_* constants.
Return
mixedOption value, if configured (null if unavailable).

public function load($id)

Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:

$dog = id(new Dog())->load($dog_id);
Parameters
int$idNumeric ID identifying the object to load.
Return
obj|nullIdentified object, or null if it does not exist.

public function loadAll()

Loads all of the objects, unconditionally.

Return
dictDictionary of all persisted objects of this type, keyed on object ID.

public function loadAllWhere($pattern, ...)

Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:

$old_dogs = id(new Dog())->loadAllWhere('age > %d', 7);

The pattern and arguments are as per queryfx().

Parameters
string$patternqueryfx()-style SQL WHERE clause.
...Zero or more conversions.
Return
dictDictionary of matching objects, keyed on ID.

public function loadOneWhere($pattern, ...)

Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.

Parameters
string$patternqueryfx()-style SQL WHERE clause.
...Zero or more conversions.
Return
obj|nullMatching object, or null if no object matches.

protected function loadRawDataWhere($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function reload()

Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.

Return
this

public function loadFromArray($row)

Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via queryData()) and then load from an array representation.

Parameters
dict$rowDictionary of properties, which should be equivalent to selecting a row from the table or calling @{method:getProperties}.
Return
this

public function loadAllFromArray($rows)

Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with loadAllWhere(), but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:

function loadAllWithOwner($owner) {
  $data = $this->queryData(
    'SELECT d.*
      FROM owner o
        JOIN owner_has_dog od ON o.id = od.ownerID
        JOIN dog d ON od.dogID = d.id
      WHERE o.id = %d',
    $owner);
  return $this->loadAllFromArray($data);
}

This is a lot messier than loadAllWhere(), but more flexible.

Parameters
list$rowsList of property dictionaries.
Return
dictList of constructed objects, keyed on ID.

public function setID($id)

Set unique ID identifying this object. You normally don't need to call this method unless with IDS_MANUAL.

Parameters
mixed$idUnique ID.
Return
this

public function getID()

Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.

Return
mixedUnique ID.

public function getPHID()

This method is not documented.
Return
wild

public function hasProperty($property)

Test if a property exists.

Parameters
string$propertyProperty name.
Return
boolTrue if the property exists.

protected function getAllLiskProperties()

Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.

Return
dictDictionary of normalized (lowercase) to canonical (original case) property names.

protected function checkProperty($property)

Check if a property exists on this object.

Parameters
$property
Return
string|nullCanonical property name, or null if the property does not exist.

public function establishConnection($mode, $force_new)

Get or build the database connection for this object.

Parameters
string$mode'r' for read, 'w' for read/write.
bool$force_newTrue to force a new connection. The connection will not be retrieved from or saved into the connection cache.
Return
AphrontDatabaseConnectionLisk connection object.

protected function getAllLiskPropertyValues()

Convert this object into a property dictionary. This dictionary can be restored into an object by using loadFromArray() (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).

Return
dictDictionary of object properties.

public function makeEphemeral()

Make an object read-only.

Making an object ephemeral indicates that you will be changing state in such a way that you would never ever want it to be written back to the storage.

Return
wild

private function isEphemeralCheck()

This method is not documented.
Return
wild

public function save()

Persist this object to the database. In most cases, this is the only method you need to call to do writes. If the object has not yet been inserted this will do an insert; if it has, it will do an update.

Return
this

public function replace()

Save this object, forcing the query to use REPLACE regardless of object state.

Return
this

public function insert()

Save this object, forcing the query to use INSERT regardless of object state.

Return
this

public function update()

Save this object, forcing the query to use UPDATE regardless of object state.

Return
this

public function delete()

Delete this object, permanently.

Return
this

protected function insertRecordIntoDatabase($mode)

Internal implementation of INSERT and REPLACE.

Parameters
const$modeEither "INSERT" or "REPLACE", to force the desired mode.
Return
this

protected function shouldInsertWhenSaved()

Method used to determine whether to insert or update when saving.

Return
booltrue if the record should be inserted

public function getTableName()

Retrieve the database table name. By default, this is the class name.

Return
stringTable name for object storage.

public function getIDKey()

Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.

Return
stringName of the ID column.

public function generatePHID()

Generate a new PHID, used by CONFIG_AUX_PHID.

Return
phidUnique, newly allocated PHID.

public function getPHIDType()

This method is not documented.
Return
wild

protected function willWriteData(&$data)

Hook to apply serialization or validation to data before it is written to the database. See also willReadData().

Parameters
array&$data
Return
wild

protected function didWriteData()

Hook to perform actions after data has been written to the database.

Return
wild

protected function willSaveObject()

Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.

Return
wild

protected function willReadData(&$data)

Hook to apply serialization or validation to data as it is read from the database. See also willWriteData().

Parameters
array&$data
Return
wild

protected function didReadData()

Hook to perform an action on data after it is read from the database.

Return
wild

protected function willDelete()

Hook to perform an action before the deletion of an object.

Return
wild

protected function didDelete()

Hook to perform an action after the deletion of an object.

Return
wild

protected function readField($field)

Reads the value from a field. Override this method for custom behavior of getField() instead of overriding getField directly.

Parameters
string$fieldCanonical field name
Return
mixedValue of the field

protected function writeField($field, $value)

Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.

Parameters
string$fieldCanonical field name
mixed$valueValue to write
Return
wild

public function openTransaction()

Increase transaction stack depth.

Return
this

public function saveTransaction()

Decrease transaction stack depth, saving work.

Return
this

public function killTransaction()

Decrease transaction stack depth, discarding work.

Return
this

public function beginReadLocking()

Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call endReadLocking(). For example:

$beach->openTransaction();
  $beach->beginReadLocking();

    $beach->reload();
    $beach->setGrainsOfSand($beach->getGrainsOfSand() + 1);
    $beach->save();

  $beach->endReadLocking();
$beach->saveTransaction();
Return
this

public function endReadLocking()

Ends read-locking that began at an earlier beginReadLocking() call.

Return
this

public function beginWriteLocking()

Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call endWriteLocking().

Return
this

public function endWriteLocking()

Ends write-locking that began at an earlier beginWriteLocking() call.

Return
this
This method is not documented.
Return
wild
This method is not documented.
Return
wild
This method is not documented.
Return
wild

private function establishIsolatedConnection($mode)

This method is not documented.
Parameters
$mode
Return
wild
This method is not documented.
Return
wild
This method is not documented.
Return
wild
This method is not documented.
Return
wild

public static function closeInactiveConnections($idle_window)

Close any connections with no recent activity.

Long-running processes can use this method to clean up connections which have not been used recently.

Parameters
int$idle_windowClose connections with no activity for this many seconds.
Return
void

public static function closeAllConnections()

This method is not documented.
Return
wild

public static function closeIdleConnections()

This method is not documented.
Return
wild

private static function closeConnection($key)

This method is not documented.
Parameters
$key
Return
wild

protected function applyLiskDataSerialization(&$data, $deserialize)

Applies configured serialization to a dictionary of values.

Parameters
array&$data
$deserialize
Return
wild

public function __call($method, $args)

Black magic. Builds implied get*() and set*() for all properties.

Parameters
string$methodMethod name.
list$argsArgument vector.
Return
mixedget*() methods return the property value. set*() methods return $this.

public static function loadNextCounterValue($conn_w, $counter_name)

Increments a named counter and returns the next value.

Parameters
AphrontDatabaseConnection$conn_wDatabase where the counter resides.
string$counter_nameCounter name to create or increment.
Return
intNext counter value.

public static function loadCurrentCounterValue($conn_r, $counter_name)

Returns the current value of a named counter.

Parameters
AphrontDatabaseConnection$conn_rDatabase where the counter resides.
string$counter_nameCounter name to read.
Return
int|nullCurrent value, or `null` if the counter does not exist.

public static function overwriteCounterValue($conn_w, $counter_name, $counter_value)

Overwrite a named counter, forcing it to a specific value.

If the counter does not exist, it is created.

Parameters
AphrontDatabaseConnection$conn_wDatabase where the counter resides.
string$counter_nameCounter name to create or overwrite.
$counter_value
Return
void

private function getBinaryColumns()

This method is not documented.
Return
wild

public function getSchemaColumns()

This method is not documented.
Return
wild

public function getSchemaKeys()

This method is not documented.
Return
wild

public function getColumnMaximumByteLength($column)

This method is not documented.
Parameters
$column
Return
wild

public function getSchemaPersistence()

This method is not documented.
Return
wild

public function getAphrontRefDatabaseName()

This method is not documented.
Return
wild

public function getAphrontRefTableName()

This method is not documented.
Return
wild

private function getLiskMetadata($key, $default)

This method is not documented.
Parameters
$key
$default
Return
wild

private function setLiskMetadata($key, $value)

This method is not documented.
Parameters
$key
$value
Return
wild