1 $Id: DBLIB.txt,v 1.1 2000-06-05 20:54:42 wainstead Exp $
3 This is a description of the database interface for PhpWiki. Regardless
4 of what kind of data store is used (RDBMS, DBM files, flat text files)
5 you should be able to write a library that supports that data store.
9 * While most functions specify a "db reference" as the first value
10 passed in, this can be any kind of data type that your functions
11 know about. For example, in the DBM implementation this is an
12 integer that refers to an open database handle, but in the MySQL
13 version it's an associative array that contains the DB information.
15 * Functions that return the page data must return a hash (associative
16 array) of all the data, where 'text' == the text of the page in Wiki
17 markup, 'version' is an integer representing the version, 'author'
18 the IP address or host name of the previous author and so on. See
19 the source code for the full listing.
23 takes: a string, the name of the database
24 returns: a reference to the database (a handle)
28 takes: a reference to the database (handle)
29 returns: the value of the close
32 RetrievePage($dbi, $pagename)
33 takes: db reference, string which is the name of a page
34 returns: a PHP associative array containing the page data
35 (text, version, prvious author, etc)
38 InsertPage($dbi, $pagename, $pagehash)
39 takes: db reference, page name (string), associative array
41 returns: nothing (hmm. It should probably return true/false)
44 IsWikiPage($dbi, $pagename)
45 takes: db reference, string containing page name
46 returns: true or false, if the page already exists
49 InitTitleSearch($dbi, $search)
50 takes: db reference, search string
51 returns: a hash with two keys:
52 'search' -- the search string passed in
53 'key' -- the first page name returned from the database
56 TitleSearchNextMatch($dbi, &$pos)
57 takes: db reference, reference to a hash created by
59 returns: the next page name that contains a match to the search term
62 InitFullSearch($dbi, $search)
63 takes: db reference, string containing search term
64 returns: this calls InitTitleSearch and returns that result
67 FullSearchNextMatch($dbi, &$pos)
68 takes: db reference, reference to a hash created by
70 returns: an associative array, where:
71 'name' -- contains the page name
72 'hash' -- contains the hash of the page data