forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_db_static.php
117 lines (104 loc) · 2.95 KB
/
_db_static.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
require_once('db.inc.php');
//////////////////////////////////////////////////////////////////////////////////////////
// Static Data stubs/functs
//////////////////////////////////////////////////////////////////////////////////////////
// 00:47 24/04/2013
function static_addnewachievement( $id )
{
$query = "UPDATE StaticData AS sd ";
$query.= "SET sd.NumAchievements=sd.NumAchievements+1, sd.LastCreatedAchievementID='$id'";
log_sql( $query );
$dbResult = s_mysql_query( $query );
if( $dbResult == FALSE )
{
// ONLY if it goes wrong, report an error.
error_log( __FUNCTION__ );
error_log( $query );
}
}
// 00:47 24/04/2013
function static_addnewgame( $id )
{
$query = "UPDATE StaticData AS sd ";
$query.= "SET sd.NumGames = sd.NumGames+1, sd.LastCreatedGameID = '$id'";
log_sql( $query );
$dbResult = s_mysql_query( $query );
if( $dbResult == FALSE )
{
// ONLY if it goes wrong, report an error.
error_log( __FUNCTION__ );
error_log( $query );
}
}
// 00:47 24/04/2013
function static_addnewregistereduser( $user )
{
$query = "UPDATE StaticData AS sd ";
$query.= "SET sd.NumRegisteredUsers = sd.NumRegisteredUsers+1, sd.LastRegisteredUser = '$user', sd.LastRegisteredUserAt = NOW()";
log_sql( $query );
$dbResult = s_mysql_query( $query );
if( $dbResult == FALSE )
{
// ONLY if it goes wrong, report an error.
error_log( __FUNCTION__ );
error_log( $query );
}
}
// 00:47 24/04/2013
function static_setlastearnedachievement( $id, $user, $points )
{
$query = "UPDATE StaticData AS sd ";
$query.= "SET sd.NumAwarded = sd.NumAwarded+1, sd.LastAchievementEarnedID = '$id', sd.LastAchievementEarnedByUser = '$user', sd.LastAchievementEarnedAt = NOW(), sd.TotalPointsEarned=sd.TotalPointsEarned+$points";
log_sql( $query );
$dbResult = s_mysql_query( $query );
if( $dbResult == FALSE )
{
// ONLY if it goes wrong, report an error.
error_log( __FUNCTION__ );
error_log( $query );
}
}
// 00:47 24/04/2013
function static_setlastupdatedgame( $id )
{
$query = "UPDATE StaticData AS sd ";
$query.= "SET sd.LastUpdatedGameID = '$id'";
log_sql( $query );
$dbResult = s_mysql_query( $query );
if( $dbResult == FALSE )
{
// ONLY if it goes wrong, report an error.
error_log( __FUNCTION__ );
error_log( $query );
}
}
// 00:49 24/04/2013
function static_setlastupdatedachievement( $id )
{
$query = "UPDATE StaticData AS sd ";
$query.= "SET sd.LastUpdatedAchievementID = '$id'";
log_sql( $query );
$dbResult = s_mysql_query( $query );
if( $dbResult == FALSE )
{
// ONLY if it goes wrong, report an error.
error_log( __FUNCTION__ );
error_log( $query );
}
}
function static_setnextgametoscan( $gameID )
{
$query = "UPDATE StaticData AS sd
SET sd.NextGameToScan = '$gameID'";
$dbResult = s_mysql_query( $query );
SQL_ASSERT( $dbResult );
}
function static_setnextusertoscan( $userID )
{
$query = "UPDATE StaticData AS sd
SET sd.NextUserIDToScan = '$userID'";
$dbResult = s_mysql_query( $query );
SQL_ASSERT( $dbResult );
}
?>