]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - DBLIB.txt
The to-do list.
[SourceForge/phpwiki.git] / DBLIB.txt
1 $Id: DBLIB.txt,v 1.2 2000-06-09 10:17:42 ahollosi Exp $
2
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.
6
7 A few notes: 
8
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.
14
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.
20
21
22       OpenDataBase($dbname)
23       takes:   a string, the name of the database
24       returns: a reference to the database (a handle)
25
26
27       CloseDataBase($dbi)
28       takes:   a reference to the database (handle)
29       returns: the value of the close
30
31
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, author, etc)
36
37
38       InsertPage($dbi, $pagename, $pagehash)
39       takes:   db reference, page name (string), associative array
40                of all page data
41       returns: nothing (hmm. It should probably return true/false)
42
43
44       IsWikiPage($dbi, $pagename)
45       takes:   db reference, string containing page name
46       returns: true or false, if the page already exists
47
48
49       InitTitleSearch($dbi, $search)
50       takes:   db reference, search string
51       returns: a handle to identify the query and the current position
52                within the result set.
53
54
55       TitleSearchNextMatch($dbi, &$pos)
56       takes:   db reference, reference to a hash created by
57                InitTitleSearch
58       returns: the next page name that contains a match to the search term
59                (advances $pos to next result field as well)
60
61
62       InitFullSearch($dbi, $search)
63       takes:   db reference, string containing search term
64       returns: similar to InitTitleSearch: a handle to identify the
65                query and the current position within the result set.
66
67
68       FullSearchNextMatch($dbi, &$pos)
69       takes:   db reference, reference to a hash created by
70                InitFullSearch
71       returns: an associative array, where:
72                   'name' -- contains the page name
73                   'hash' -- contains the hash of the page data
74                (advances $pos to next result field as well)