/
relationship_api.php
76 lines (67 loc) · 2.56 KB
/
relationship_api.php
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
75
76
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: relationship_api.php,v 1.6 2004-01-11 07:16:10 vboctor Exp $
# --------------------------------------------------------
###########################################################################
# Relationship API
###########################################################################
# --------------------
function relationship_add( $p_src_bug_id, $p_dest_bug_id, $p_relationship_type ) {
global $g_mantis_bug_relationship_table;
$query = "INSERT INTO $g_mantis_bug_relationship_table
( id, source_bug_id, destination_bug_id, relationship_type )
VALUES
( null, '$p_src_bug_id', '$p_dest_bug_id', '$p_relationship_type' )";
return db_query( $query );
}
# --------------------
function relationship_update( $p_relation_id, $p_src_bug_id, $p_dest_bug_id, $p_relationship_type ) {
global $g_mantis_bug_relationship_table;
$query = "UPDATE $g_mantis_bug_relationship_table
SET source_bug_id='$p_src_bug_id',
destination_bug_id='$p_dest_bug_id',
relationship_type='$p_relationship_type'
WHERE id='$p_relation_id'";
return db_query( $query );
}
# --------------------
function relationship_delete( $p_relation_id ) {
global $g_mantis_bug_relationship_table;
$query = "DELETE FROM $g_mantis_bug_relationship_table
WHERE id='$p_relation_id'";
return db_query( $query );
}
# --------------------
function relationship_fetch( $p_relation_id ) {
global $g_mantis_bug_relationship_table;
$query = "SELECT *
FROM $g_mantis_bug_relationship_table
WHERE id='$p_relation_id'";
$result = db_query( $query );
return db_fetch_array( $result );
}
# --------------------
function relationship_fetch_all_src( $p_src_bug_id ) {
global $g_mantis_bug_relationship_table;
$query = "SELECT *
FROM $g_mantis_bug_relationship_table
WHERE source_bug_id='$p_src_bug_id'
ORDER BY relationship_type";
return db_query( $query );
}
# --------------------
function relationship_fetch_all_dest( $p_src_bug_id ) {
global $g_mantis_bug_relationship_table;
$query = "SELECT *
FROM $g_mantis_bug_relationship_table
WHERE destination_bug_id='$p_src_bug_id'
ORDER BY relationship_type";
return db_query( $query );
}
# --------------------
?>