libdballe  6.8
db/v5/station.h
Go to the documentation of this file.
1 /*
2  * db/station - station table management
3  *
4  * Copyright (C) 2005--2013 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef DBALLE_DB_V5_STATION_H
23 #define DBALLE_DB_V5_STATION_H
24 
32 #include <sqltypes.h>
33 #include <cstdio>
34 
35 namespace dballe {
36 namespace db {
37 struct Connection;
38 struct Statement;
39 struct Sequence;
40 
41 namespace v5 {
42 
46 struct Station
47 {
52 
55 
68 
70  DBALLE_SQL_C_SINT_TYPE id;
72  DBALLE_SQL_C_SINT_TYPE lat;
74  DBALLE_SQL_C_SINT_TYPE lon;
76  char ident[64];
78  SQLLEN ident_ind;
79 
80  Station(db::Connection& conn);
81  ~Station();
82 
89  void set_ident(const char* ident);
90 
97  int get_id();
98 
105  void get_data(int id);
106 
113  int insert();
114 
118  void update();
119 
123  void remove();
124 
128  void dump(FILE* out);
129 
133  static void reset_db(db::Connection& conn);
134 
135 private:
136  // disallow copy
137  Station(const Station&);
138  Station& operator=(const Station&);
139 };
140 
141 #if 0
142 
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif
149 
150 } // namespace v5
151 } // namespace db
152 } // namespace dballe
153 
154 /* vim:set ts=4 sw=4: */
155 #endif
static void reset_db(db::Connection &conn)
Clear (if applicable) and recreate the table structure in the database.
db::Statement * sfstm
Precompiled select fixed station query.
Definition: db/v5/station.h:57
void dump(FILE *out)
Dump the entire contents of the table to an output stream.
Database connection.
Definition: internals.h:124
The ODBC specification is imperfect with regards to integer sizes on 64bit platforms, and different ODBC drivers are currently interpreting it differently.
Definition: cmdline.h:34
DBALLE_SQL_C_SINT_TYPE id
Station ID SQL parameter.
Definition: db/v5/station.h:70
int get_id()
Get the station ID given latitude, longitude and mobile identifier.
db::Statement * istm
Precompiled insert query.
Definition: db/v5/station.h:63
Precompiled queries to manipulate the station table.
Definition: db/v5/station.h:46
int insert()
Insert a new station entry.
db::Statement * smstm
Precompiled select mobile station query.
Definition: db/v5/station.h:59
db::Statement * ustm
Precompiled update query.
Definition: db/v5/station.h:65
ODBC statement.
Definition: internals.h:220
db::Sequence * seq_station
Station ID sequence, when the DB requires it.
Definition: db/v5/station.h:54
void get_data(int id)
Get station information given a station ID.
db::Statement * dstm
Precompiled delete query.
Definition: db/v5/station.h:67
ODBC statement to read a sequence.
Definition: internals.h:299
void set_ident(const char *ident)
Set the mobile station identifier input value for this ::dba_db_station.
db::Connection & conn
DB connection.
Definition: db/v5/station.h:51
db::Statement * sstm
Precompiled select data by station id query.
Definition: db/v5/station.h:61
DBALLE_SQL_C_SINT_TYPE lon
Station longitude SQL parameter.
Definition: db/v5/station.h:74
SQLLEN ident_ind
Mobile station identifier indicator.
Definition: db/v5/station.h:78
DBALLE_SQL_C_SINT_TYPE lat
Station latitude SQL parameter.
Definition: db/v5/station.h:72
char ident[64]
Mobile station identifier SQL parameter.
Definition: db/v5/station.h:76
void update()
Update the information about a station entry.