]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - DBLIB.txt
This is still in transition. Do not use in a production setting.
[SourceForge/phpwiki.git] / DBLIB.txt
1 $Id: DBLIB.txt,v 1.4 2000-06-20 03:41:43 wainstead 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 * The data structure. This is commonly named $pagehash in the source
22   code; it's an associative array with values that are integers,
23   strings and arrays (i.e. a heterogenous data structure). Here's a
24   current description:
25
26   $pagehash = {
27      author       => string,
28      content      => array (where each element is a line of the page),
29      created      => integer (a number in Unix time since the Epoch),
30      flags        => integer,
31      lastmodified => integer (Unix time),
32      pagename     => string,
33      version      => integer,
34      refs         => array (where each element is a reference)
35   };
36
37       OpenDataBase($dbname)
38       takes:   a string, the name of the database
39       returns: a reference to the database (a handle)
40
41
42       CloseDataBase($dbi)
43       takes:   a reference to the database (handle)
44       returns: the value of the close
45
46
47       RetrievePage($dbi, $pagename)
48       takes:   db reference, string which is the name of a page
49       returns: a PHP associative array containing the page data
50                (text, version, author, etc)
51
52
53       InsertPage($dbi, $pagename, $pagehash)
54       takes:   db reference, page name (string), associative array
55                of all page data
56       returns: nothing (hmm. It should probably return true/false)
57
58
59       IsWikiPage($dbi, $pagename)
60       takes:   db reference, string containing page name
61       returns: true or false, if the page already exists
62
63
64       InitTitleSearch($dbi, $search)
65       takes:   db reference, search string
66       returns: a handle to identify the query and the current position
67                within the result set.
68
69
70       TitleSearchNextMatch($dbi, &$pos)
71       takes:   db reference, reference to a hash created by
72                InitTitleSearch
73       returns: the next page name that contains a match to the search term
74                (advances $pos to next result field as well)
75
76
77       InitFullSearch($dbi, $search)
78       takes:   db reference, string containing search term
79       returns: similar to InitTitleSearch: a handle to identify the
80                query and the current position within the result set.
81
82
83       FullSearchNextMatch($dbi, &$pos)
84       takes:   db reference, reference to a hash created by
85                InitFullSearch
86       returns: an associative array, where:
87                   'name' -- contains the page name
88                   'hash' -- contains the hash of the page data
89                (advances $pos to next result field as well)