aboutsummaryrefslogtreecommitdiff
path: root/classes/IsisDb.php
blob: 43a51dcbe9df5e3dfd35dbc147d7652ffa15e459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php

/**
 * Generic interface for reading Isis databases.
 */
interface IsisDb {
  /**
   * Constructor.
   *
   * The implementation constructor should accept a database
   * schema definition and setup the appropriate db resource.
   *
   * @param $schema
   *   High level database schema description.
   *
   * @return
   *   Database resource or FALSE in case of error.
   *
   * @see default_schema()
   */
  public function __construct($schema);

  /**
   * Read an entry from the database.
   *
   * @param $id
   *   Database row id.
   */
  public function read($id);

  /**
   * Return number of rows in the database.
   *
   * @return
   *   Number of rows in the database.
   */
  public function rows();

  /**
   * Return an example database schema.
   *
   * The example schema should have all information the implementation
   * needs to be able to open and read a database.
   *
   * @return
   *   Array with a sample database schema.
   */
  public function example();

  /**
   * Configuration check.
   *
   * @param $schema
   *   Database schema to check.
   *
   * @param $section
   *   Configuration section.
   *
   * @return
   *   Database schema or FALSE if error.
   */
  static function check($schema, $section = NULL);
}