Skip to content

Commit

Permalink
converted mysql_ to db_ functions. easier to make db abstraction
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@111 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Dec 24, 2000
1 parent befca5e commit 041d3ae
Show file tree
Hide file tree
Showing 44 changed files with 137 additions and 137 deletions.
6 changes: 3 additions & 3 deletions account_delete.php3
Expand Up @@ -16,19 +16,19 @@
$query = "DELETE
FROM $g_mantis_user_table
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );

### Remove associated profiles
$query = "DELETE
FROM $g_mantis_user_profile_table
WHERE user_id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );

### Remove associated preferences
$query = "DELETE
FROM $g_mantis_user_pref_table
WHERE user_id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
} ### end if protected
?>
<? print_html_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_page.php3
Expand Up @@ -15,7 +15,7 @@
FROM $g_mantis_user_table
WHERE cookie_string='$g_string_cookie_val'";
$result = db_query( $query );
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
if ( $row ) {
extract( $row, EXTR_PREFIX_ALL, "u" );
}
Expand Down
4 changes: 2 additions & 2 deletions account_prefs_page.php3
Expand Up @@ -19,7 +19,7 @@
$result = db_query($query);

## OOPS, No entry in the database yet. Lets make one
if ( mysql_num_rows( $result )==0 ) {
if ( db_num_rows( $result )==0 ) {

### Create row
$query = "INSERT
Expand All @@ -38,7 +38,7 @@
}

### prefix data with u_
$row = mysql_fetch_array($result);
$row = db_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, "u" );
?>
<? print_html_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_prefs_reset.php3
Expand Up @@ -14,7 +14,7 @@
SET advanced_report='$g_default_advanced_report',
advanced_view='$g_default_advanced_view'
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_prefs_update.php3
Expand Up @@ -14,7 +14,7 @@
SET advanced_report='$f_advanced_report',
advanced_view='$f_advanced_view'
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_profile_add.php3
Expand Up @@ -27,7 +27,7 @@
( id, user_id, platform, os, os_build, description, default_profile )
VALUES
( null, '$f_user_id', '$f_platform', '$f_os', '$f_os_build', '$f_description', '' )";
$result = mysql_query( $query );
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_profile_delete.php3
Expand Up @@ -19,7 +19,7 @@
$query = "DELETE
FROM $g_mantis_user_profile_table
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_profile_edit_page.php3
Expand Up @@ -31,7 +31,7 @@
FROM $g_mantis_user_profile_table
WHERE id='$f_id'";
$result = db_query( $query );
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
if ( $row ) {
extract( $row, EXTR_PREFIX_ALL, "v" );
}
Expand Down
4 changes: 2 additions & 2 deletions account_profile_make_default.php3
Expand Up @@ -19,13 +19,13 @@
$query = "UPDATE $g_mantis_user_profile_table
SET default_profile=''
WHERE user_id='$f_user_id'";
$result = mysql_query( $query );
$result = db_query( $query );

### Set Default
$query = "UPDATE $g_mantis_user_profile_table
SET default_profile='on'
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion account_profile_update.php3
Expand Up @@ -26,7 +26,7 @@
SET platform='$f_platform', os='$f_os',
os_build='$f_os_build', description='$f_description'
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
4 changes: 2 additions & 2 deletions account_update.php3
Expand Up @@ -16,7 +16,7 @@
$query = "UPDATE $g_mantis_user_table
SET username='$f_username', email='$f_email'
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );

### Update password if changed and the two match and not empty
if ( !empty( $f_password ) ) {
Expand All @@ -25,7 +25,7 @@
$query = "UPDATE $g_mantis_user_table
SET password='$t_password'
WHERE id='$f_id'";
$result = mysql_query( $query );
$result = db_query( $query );
}
}
} ### end if protected
Expand Down
14 changes: 7 additions & 7 deletions bug_delete.php3
Expand Up @@ -13,36 +13,36 @@
$query = "DELETE
FROM $g_mantis_bug_table
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);

### Delete the corresponding bug text
$query = "DELETE
FROM $g_mantis_bug_text_table
WHERE id='$f_bug_text_id'";
$result = mysql_query($query);
$result = db_query($query);

### Delete the bugnote text items
$query = "SELECT bugnote_text_id
FROM $g_mantis_bugnote_table
WHERE bug_id='$f_id'";
$result = mysql_query($query);
$bugnote_count = mysql_num_rows( $result );
$result = db_query($query);
$bugnote_count = db_num_rows( $result );
for ($i=0;$i<$bugnote_count;$i++){
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
$t_bugnote_text_id = $row["bugnote_text_id"];

### Delete the corresponding bugnote texts
$query = "DELETE
FROM $g_mantis_bugnote_text_table
WHERE id='$t_bugnote_text_id'";
$result2 = mysql_query( $query );
$result2 = db_query( $query );
}

### Delete the corresponding bugnotes
$query = "DELETE
FROM $g_mantis_bugnote_table
WHERE bug_id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);

header( "Location: $g_view_bug_all_page" );
?>
Expand Down
6 changes: 3 additions & 3 deletions bug_reopen_page.php3
Expand Up @@ -13,8 +13,8 @@
$query = "SELECT date_submitted
FROM $g_mantis_bug_table
WHERE id='$f_id'";
$result = mysql_query( $query );
$t_date_submitted = mysql_result( $result, 0 );
$result = db_query( $query );
$t_date_submitted = db_result( $result, 0 );

### Update fields
$query = "UPDATE $g_mantis_bug_table
Expand All @@ -23,7 +23,7 @@
date_submitted='$t_date_submitted',
last_updated=NOW()
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
6 changes: 3 additions & 3 deletions bug_resolve_page2.php3
Expand Up @@ -13,8 +13,8 @@
$query = "SELECT date_submitted
FROM $g_mantis_bug_table
WHERE id='$f_id'";
$result = mysql_query( $query );
$t_date_submitted = mysql_result( $result, 0 );
$result = db_query( $query );
$t_date_submitted = db_result( $result, 0 );

$t_handler_id = get_current_user_field( "id " );

Expand All @@ -27,7 +27,7 @@
date_submitted='$t_date_submitted',
last_updated=NOW()
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
4 changes: 2 additions & 2 deletions bug_update.php3
Expand Up @@ -21,12 +21,12 @@
last_updated=NOW(), eta='$f_eta',
handler_id='$f_handler_id'
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);

$query = "UPDATE $g_mantis_bug_table
SET last_updated=NOW()
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
4 changes: 2 additions & 2 deletions bug_update_advanced_page.php3
Expand Up @@ -13,14 +13,14 @@
FROM $g_mantis_bug_table
WHERE id='$f_id'";
$result = db_query( $query );
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v" );

$query = "SELECT *
FROM $g_mantis_bug_text_table
WHERE id='$v_bug_text_id'";
$result = db_query( $query );
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v2" );

$v_summary = string_display( $v_summary );
Expand Down
4 changes: 2 additions & 2 deletions bug_update_page.php3
Expand Up @@ -13,14 +13,14 @@
FROM $g_mantis_bug_table
WHERE id='$f_id'";
$result = db_query( $query );
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v" );

$query = "SELECT *
FROM $g_mantis_bug_text_table
WHERE id='$v_bug_text_id'";
$result = db_query( $query );
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v2" );

$v_summary = string_display( $v_summary );
Expand Down
2 changes: 1 addition & 1 deletion bug_vote_add.php3
Expand Up @@ -14,7 +14,7 @@
$query = "UPDATE $g_mantis_bug_table
SET votes=$f_vote
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
14 changes: 7 additions & 7 deletions bugnote_add.php3
Expand Up @@ -19,16 +19,16 @@
( id, note )
VALUES
( null, '$f_bugnote_text' )";
$result = mysql_query( $query );
$result = db_query( $query );

### retrieve bugnote text id number
### NOTE: this is guarranteed to be the correct one.
### The value LAST_INSERT_ID is stored on a per connection basis.

$query = "select LAST_INSERT_ID()";
$result = mysql_query( $query );
$result = db_query( $query );
if ( $result ) {
$t_bugnote_text_id = mysql_result( $result, 0 );
$t_bugnote_text_id = db_result( $result, 0 );
}

### insert bugnote info
Expand All @@ -37,20 +37,20 @@
( id, bug_id, reporter_id, bugnote_text_id, date_submitted, last_modified )
VALUES
( null, '$f_bug_id', '$u_id','$t_bugnote_text_id',NOW(), NOW() )";
$result = mysql_query( $query );
$result = db_query( $query );

### get date submitted (weird bug in mysql)
$query = "SELECT date_submitted
FROM $g_mantis_bug_table
WHERE id='$f_bug_id'";
$result = mysql_query( $query );
$t_date_submitted = mysql_result( $result, 0 );
$result = db_query( $query );
$t_date_submitted = db_result( $result, 0 );

### update bug last updated
$query = "UPDATE $g_mantis_bug_table
SET date_submitted='$t_date_submitted', last_updated=NOW()
WHERE id='$f_bug_id'";
$result = mysql_query($query);
$result = db_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
8 changes: 4 additions & 4 deletions bugnote_delete.php3
Expand Up @@ -13,20 +13,20 @@
$query = "DELETE
FROM $g_mantis_bugnote_table
WHERE id='$f_bug_id'";
$result = mysql_query($query);
$result = db_query($query);

### get date submitted (weird bug in mysql)
$query = "SELECT date_submitted
FROM $g_mantis_bug_table
WHERE id='$f_id'";
$result = mysql_query( $query );
$t_date_submitted = mysql_result( $result, 0 );
$result = db_query( $query );
$t_date_submitted = db_result( $result, 0 );

### update bug last updated
$query = "UPDATE $g_mantis_bug_table
SET date_submitted='$t_date_submitted', last_updated=NOW()
WHERE id='$f_id'";
$result = mysql_query($query);
$result = db_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
6 changes: 3 additions & 3 deletions bugnote_inc.php
Expand Up @@ -16,7 +16,7 @@
WHERE bug_id='$f_id'
ORDER BY date_submitted $g_bugnote_order";
$result = db_query($query);
$num_notes = mysql_num_rows($result);
$num_notes = db_num_rows($result);
?>

<table width=100% cols=2 bgcolor=<? echo $g_primary_border_color." ".$g_primary_table_tags ?>>
Expand All @@ -42,7 +42,7 @@
<?
for($i=0; $i < $num_notes; $i++) {
### prefix all bugnote data with v3_
$row = mysql_fetch_array( $result );
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v3" );
$v3_date_submitted = date( "m-d H:i", sql_to_unix_time( $v3_date_submitted ) );

Expand All @@ -51,7 +51,7 @@
FROM $g_mantis_bugnote_text_table
WHERE id='$v3_bugnote_text_id'";
$result2 = db_query($query);
$v3_note = mysql_result( $result2, 0);
$v3_note = db_result( $result2, 0);
?>
<tr height=5 bgcolor=<? echo $g_white_color ?>>
<td colspan=2 bgcolor=<? echo $g_white_color ?>>
Expand Down

0 comments on commit 041d3ae

Please sign in to comment.