1 This is a description of the database interface for PhpWiki. Regardless
2 of what kind of data store is used (RDBMS, DBM files, flat text files)
3 you should be able to write a library that supports that data store.
7 * While most functions specify a "db reference" as the first value
8 passed in, this can be any kind of data type that your functions
9 know about. For example, in the DBM implementation this is an
10 integer that refers to an open database handle, but in the MySQL
11 version it's an associative array that contains the DB information.
13 * Functions that return the page data must return a hash (associative
14 array) of all the data, where 'content' == the text of the page in Wiki
15 markup, 'version' is an integer representing the version, 'author'
16 the IP address or host name of the previous author and so on. See
17 the next paragraph for a precise description.
19 * The data structure. This is commonly named $pagehash in the source
20 code; it's an associative array with values that are integers,
21 strings and arrays (i.e. a heterogenous data structure). Here's a
26 content => array (where each element is a line of the page),
27 created => integer (a number in Unix time since the Epoch),
29 lastmodified => integer (also Unix time),
32 refs => array (where each element is a reference)
38 takes: a string, the name of the database
39 returns: a reference to the database (a handle)
43 takes: a reference to the database (handle)
44 returns: the value of the close. For databases with persistent
45 connections, this doesn't return anything.
48 RetrievePage($dbi, $pagename)
49 takes: db reference, string which is the name of a page
50 returns: a PHP associative array containing the page data
51 (text, version, author, etc)
54 InsertPage($dbi, $pagename, $pagehash)
55 takes: db reference, page name (string), associative array
57 returns: nothing (hmm. It should probably return true/false)
60 IsWikiPage($dbi, $pagename)
61 takes: db reference, string containing page name
62 returns: true or false, if the page already exists
65 InitTitleSearch($dbi, $search)
66 takes: db reference, search string
67 returns: a handle to identify the query and the current position
68 within the result set.
71 TitleSearchNextMatch($dbi, &$pos)
72 takes: db reference, reference to a hash created by
74 returns: the next page name that contains a match to the search term
75 (advances $pos to next result field as well)
78 InitFullSearch($dbi, $search)
79 takes: db reference, string containing search term
80 returns: similar to InitTitleSearch: a handle to identify the
81 query and the current position within the result set.
84 FullSearchNextMatch($dbi, &$pos)
85 takes: db reference, reference to a hash created by
87 returns: an associative array, where:
88 'name' -- contains the page name
89 'hash' -- contains the hash of the page data
90 (advances $pos to next result field as well)
93 IncreaseHitCount($dbi, $pagename)
94 takes: db reference, string (name of a page)
95 returns: nothing (MySQL implementation returns the last result
96 set but it is not used by the caller)
99 GetHitCount($dbi, $pagename)
100 takes: db reference, string (page name)
101 returns: an integer, the number of hits the page has received
104 InitMostPopular($dbi, $limit)
105 takes: a db reference and an integer, which is the limit of the
106 number of pages you want returned.
107 returns: the result set from the query
110 MostPopularNextMatch($dbi, $res)
111 takes: db reference, the result set returned by InitMostPopular
112 returns: the next row from the result set, as a PHP array type
114 GetAllWikiPageNames($dbi)
115 GetWikiPageLinks($dbi, $pagename)
116 SetWikiPageLinks($dbi, $pagename, $linklist)
118 $Id: DBLIB.txt,v 1.7 2000-10-21 04:14:02 wainstead Exp $