path:
/query.js
2.11 KB | plain
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 function _toSpace(_string) {
return _string.split('_').join(' ');
}
module.exports = {
//Series
getSeriesByName: function(seriesName) {
return `SELECT * FROM Series WHERE LOWER(seriesName)=LOWER('${_toSpace(seriesName)}')`
},
getSeriesBySeasonYear: function(seasonYear) {
return `SELECT * FROM Series WHERE DATE_TRUNC('year', SeriesSeason)=TO_DATE('${seasonYear}', 'YYYY')`
},
getSeriesBySeason: function(seriesName, seasonYear) {
return `SELECT * FROM Series WHERE LOWER(SeriesName)=LOWER('${_toSpace(seriesName)}') AND DATE_TRUNC('year', SeriesSeason)=TO_DATE('${seasonYear}', 'YYYY')`
},
//Match
getMatchesBySeries: function(seriesName, seasonYear) {
return '' //TODO
},
getMatchesByDate: function(matchDate) {
return '' //TODO
},
getMatchByNumber: function(seriesName, seasonYear, matchNo) {
return '' //TODO
},
//Team
getTeamsByMatch: function(seriesName, seasonYear, matchNo) {
return '' //TODO
},
getTeamByMatch: function(seriesName, seasonYear, matchNo, teamId) {
return '' //TODO
},
getTeamById: function(teamId) {
return '' //TODO
},
//Player
getPlayersByTeam: function(seriesName, seasonYear, matchNo, teamId) {
return '' //TODO
},
getPlayerById: function(playerId) {
return `SELECT * FROM Player WHERE PlayerID=${playerId}`
},
//PlayerBatting Stats
getPlayerBattingByMatch: function(seriesName, seasonYear, matchNo, teamId, playerId) {
return '' //TODO
},
getPlayerBattingBySeries: function(seriesName, playerId) {
return '' //TODO
},
getPlayerBattingBySeriesSeason: function(seriesName, seasonYear, playerId) {
return '' //TODO
},
//PlayerBowling Stats
getPlayerBowlingByMatch: function(seriesName, seasonYear, matchNo, teamId, playerId) {
return '' //TODO
},
getPlayerBowlingBySeries: function(seriesName, playerId) {
return '' //TODO
},
getPlayerBowlingBySeriesSeason: function(seriesName, seasonYear, playerId) {
return '' //TODO
}
}