/
database.php3
74 lines (67 loc) · 3 KB
/
database.php3
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
64
65
66
67
68
69
70
71
72
73
74
<html>
<head>
<style>
body { background-color:#ffffff; font-family:Verdana, Arial; font-size=10pt }
td { font-family:Verdana, Arial; font-size=10pt }
p { font-family:Verdana, Arial; font-size=10pt }
</style>
<title>Mantis</title>
</head>
<body>
<p>
<div align=center>
<h2>Mantis</h2>
Last modified: <? echo date( "M d, Y - H:m", getlastmod() )?>
</div>
<p>
<div align=center>
<table width=100%>
<tr valign=top>
<? include("side_menu.php3") ?>
<td>
<p>
<b><font size=+1>Database Schema</font></b>
<p>
This is a basic view of the database schema used in Mantis. In my defense it was my first try at a decently sized project and the project has grown out of its original design. It should and will be re-normalized 'soon'. The schemas are a bit rough right now. I should add indicators for index, primary keys, 'foreign keys' (mysql doesn't support these, you have to fake them), unique fields, and relationships (1 to 1, 1 to many, etc).
<p>
<ul>
<li><a href="images/mantis-0.14.0.gif">version 0.14.1</a> <? echo round(filesize("images/mantis-0.14.0.gif") / 1024) ?>KB
<li><a href="images/mantis-0.13.0.gif">version 0.9.0 to 0.13.1</a> <? echo round(filesize("images/mantis-0.13.0.gif") / 1024) ?>KB
</ul>
<p>
Any database experts who'd like to offer their insights can email me.
<p>
<b><font size=+1>Porting</font></b>
<p>
This project has a stated goal of database independence. The following provide some information to aid in this goal.
<p>
The core package has been developed with mysql. As a true database mysql is severly lacking in core features, however, in our case it is sufficient. Just remember to backup your database every few days.
<p>
One of the unforseen 'benefits' of using mysql is that most of the SQL is very simple. There are no SUB-SELECTS, no foreign keys, no stored procedures. Porting efforts should be relatively simple. Here are some of the key points that require attention in porting efforts.
<p>
<b>Basic database functions:</b>
<ul>
<li>db_connect()
<li>db_select_db()
<li>db_query()
<li>db_result()
<li>db_num_rows()
<li>db_fetch_array()
<li>db_insert_id()
<li>db_close()
</ul>
<b>Some notes:</b>
<ul>
<li>AUTO_INCREMENT - There must be a method for generating a unique id for every entry in a table. I believe Oracle uses SEQUENCES.
<li>LAST_INSERT_ID() - There needs to be a database mechanism to retrieve the ID of the record that was just inserted. There are several places in Mantis where multiple inserts take place in one script and each script needs the ID of the previously inserted record. I had some feedback that MSSQL uses something like "SELECT @@IDENTITY AS 'id'" to accomplish this.
<li>count returned rows - There should be a way to count the number of returned rows. Mantis uses mysql_num_rows() to get this number. An alternative is to return a COUNT() in a SQL query.
</ul>
</td>
</tr>
</table>
<p>
<div align=right>
<a href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=14963" width="88" height="31" border="0" alt="SourceForge Logo"></A>
</div>
</body>
</html>