MythTV  master
dbaccess.cpp
Go to the documentation of this file.
1 #include <algorithm>
2 #include <vector>
3 #include <map>
4 
5 #include "mythdb.h"
6 #include "cleanup.h"
7 #include "dbaccess.h"
8 #include "mythmiscutil.h"
9 
10 namespace
11 {
12  template <typename T, typename arg_type>
13  struct call_sort
14  {
15  explicit call_sort(T &c) : m_c(c) {}
16 
17  bool operator()(const arg_type &lhs, const arg_type &rhs)
18  {
19  return m_c.sort(lhs, rhs);
20  }
21 
22  T &m_c;
23  };
24 }
25 
27 {
28  public:
30  using entry_list = std::vector<entry>;
31 
32  private:
33  using entry_map = std::map<int, QString>;
34 
35  public:
36  SingleValueImp(QString table_name, QString id_name, QString value_name)
37  : m_tableName(std::move(table_name)), m_idName(std::move(id_name)),
38  m_valueName(std::move(value_name)), m_cleanStub(this)
39  {
40  m_insertSql = QString("INSERT INTO %1 (%2) VALUES (:NAME)")
41  .arg(m_tableName).arg(m_valueName);
42  m_fillSql = QString("SELECT %1, %2 FROM %3").arg(m_idName)
43  .arg(m_valueName).arg(m_tableName);
44  m_deleteSql = QString("DELETE FROM %1 WHERE %2 = :ID")
45  .arg(m_tableName).arg(m_idName);
46  }
47 
48  virtual ~SingleValueImp() = default;
49 
50  mutable QMutex m_mutex;
51 
52  void load_data()
53  {
54  QMutexLocker locker(&m_mutex);
55  if (!m_ready)
56  {
57  fill_from_db();
58  m_ready = true;
59  }
60  }
61 
62  int add(const QString &name)
63  {
64  int id = 0;
65 
66  if (!exists(name, &id))
67  {
69  query.prepare(m_insertSql);
70  query.bindValue(":NAME", name);
71  if (query.exec())
72  {
73  if (query.exec("SELECT LAST_INSERT_ID()") && query.next())
74  {
75  id = query.value(0).toInt();
76  m_entries.insert(entry_map::value_type(id, name));
77  m_dirty = true;
78  }
79  else
80  MythDB::DBError("get last id", query);
81  }
82  }
83 
84  return id;
85  }
86 
87  bool get(int id, QString &value)
88  {
89  entry_map::const_iterator p = m_entries.find(id);
90  if (p != m_entries.end())
91  {
92  value = p->second;
93  return true;
94  }
95  return false;
96  }
97 
98  void remove(int id)
99  {
100  auto p = m_entries.find(id);
101  if (p != m_entries.end())
102  {
103  MSqlQuery query(MSqlQuery::InitCon());
104  query.prepare(m_deleteSql);
105  query.bindValue(":ID", p->first);
106  if (query.exec())
107  {
108  m_dirty = true;
109  m_entries.erase(p);
110  }
111  }
112  }
113 
114  bool exists(int id)
115  {
116  return m_entries.find(id) != m_entries.end();
117  }
118 
119  bool exists(const QString &name, int *id = nullptr)
120  {
121  entry_map::const_iterator p = find(name);
122  if (p != m_entries.end())
123  {
124  if (id)
125  *id = p->first;
126  return true;
127  }
128  return false;
129  }
130 
132  {
133  if (m_dirty)
134  {
135  m_dirty = false;
136  m_retEntries.clear();
137 
138  for (entry_map::const_iterator p = m_entries.begin();
139  p != m_entries.end(); ++p)
140  {
141  m_retEntries.push_back(entry_list::value_type(p->first,
142  p->second));
143  }
144  std::sort(m_retEntries.begin(), m_retEntries.end(),
145  call_sort<SingleValueImp, entry>(*this));
146  }
147 
148  return m_retEntries;
149  }
150 
151  virtual bool sort(const entry &lhs, const entry &rhs)
152  {
153  return naturalCompare(lhs.second, rhs.second) < 0;
154  }
155 
156  void cleanup()
157  {
158  m_ready = false;
159  m_dirty = true;
160  m_retEntries.clear();
161  m_entries.clear();
162  }
163 
164  private:
165  entry_map::iterator find(const QString &name)
166  {
167  for (auto p = m_entries.begin(); p != m_entries.end(); ++p)
168  {
169  if (p->second == name)
170  return p;
171  }
172  return m_entries.end();
173  }
174 
176  {
177  m_entries.clear();
178 
179  MSqlQuery query(MSqlQuery::InitCon());
180 
181  if (query.exec(m_fillSql))
182  {
183  while (query.next())
184  {
185  int id = query.value(0).toInt();
186  QString val = query.value(1).toString();
187  m_entries.insert(entry_map::value_type(id, val));
188  }
189  }
190  }
191 
192  private:
193  QString m_tableName;
194  QString m_idName;
195  QString m_valueName;
196 
197  QString m_insertSql;
198  QString m_fillSql;
199  QString m_deleteSql;
200 
201  bool m_ready {false};
202  bool m_dirty {true};
206 };
207 
209 
211 {
212  delete m_imp;
213 }
214 
215 int SingleValue::add(const QString &name)
216 {
217  return m_imp->add(name);
218 }
219 
220 bool SingleValue::get(int id, QString &category)
221 {
222  return m_imp->get(id, category);
223 }
224 
226 {
227  m_imp->remove(id);
228 }
229 
231 {
232  return m_imp->exists(id);
233 }
234 
235 bool SingleValue::exists(const QString &name)
236 {
237  return m_imp->exists(name);
238 }
239 
241 {
242  return m_imp->getList();
243 }
244 
246 {
247  m_imp->load_data();
248 }
249 
251 
253 {
254  public:
256 
257  private:
258  using id_map = std::map<int, entry>;
259 
260  public:
261  MultiValueImp(QString table_name, QString id_name,
262  QString value_name) : m_tableName(std::move(table_name)),
263  m_idName(std::move(id_name)), m_valueName(std::move(value_name)),
264  m_cleanStub(this)
265  {
266  m_insertSql = QString("INSERT INTO %1 (%2, %3) VALUES (:ID, :VALUE)")
267  .arg(m_tableName).arg(m_idName).arg(m_valueName);
268  m_fillSql = QString("SELECT %1, %2 FROM %3 ORDER BY %4").arg(m_idName)
269  .arg(m_valueName).arg(m_tableName).arg(m_idName);
270  }
271 
272  mutable QMutex m_mutex;
273 
274  void load_data()
275  {
276  QMutexLocker locker(&m_mutex);
277  if (!m_ready)
278  {
279  fill_from_db();
280  m_ready = true;
281  }
282  }
283 
284  void cleanup()
285  {
286  m_ready = false;
287  m_valMap.clear();
288  }
289 
290  int add(int id, int value)
291  {
292  bool db_insert = false;
293  auto p = m_valMap.find(id);
294  if (p != m_valMap.end())
295  {
296  entry::values_type &va = p->second.values;
297  auto v = std::find(va.begin(), va.end(), value);
298  if (v == va.end())
299  {
300  va.push_back(value);
301  db_insert = true;
302  }
303  }
304  else
305  {
306  entry e;
307  e.id = id;
308  e.values.push_back(value);
309  m_valMap.insert(id_map::value_type(id, e));
310  db_insert = true;
311  }
312 
313  if (db_insert)
314  {
315  MSqlQuery query(MSqlQuery::InitCon());
316  query.prepare(m_insertSql);
317  query.bindValue(":ID", id);
318  query.bindValue(":VALUE", value);
319  if (!query.exec())
320  MythDB::DBError("multi value insert", query);
321  }
322 
323  return id;
324  }
325 
326  bool get(int id, entry &values)
327  {
328  auto p = m_valMap.find(id);
329  if (p != m_valMap.end())
330  {
331  values = p->second;
332  return true;
333  }
334  return false;
335  }
336 
337  void remove(int id, int value)
338  {
339  auto p = m_valMap.find(id);
340  if (p != m_valMap.end())
341  {
342  auto vp = std::find(p->second.values.begin(),
343  p->second.values.end(), value);
344  if (vp != p->second.values.end())
345  {
346  MSqlQuery query(MSqlQuery::InitCon());
347  QString del_query = QString("DELETE FROM %1 WHERE %2 = :ID AND "
348  "%3 = :VALUE")
349  .arg(m_tableName).arg(m_idName).arg(m_valueName);
350  query.prepare(del_query);
351  query.bindValue(":ID", p->first);
352  query.bindValue(":VALUE", int(*vp));
353  if (!query.exec() || !query.isActive())
354  {
355  MythDB::DBError("multivalue remove", query);
356  }
357  p->second.values.erase(vp);
358  }
359  }
360  }
361 
362  void remove(int id)
363  {
364  auto p = m_valMap.find(id);
365  if (p != m_valMap.end())
366  {
367  MSqlQuery query(MSqlQuery::InitCon());
368  QString del_query = QString("DELETE FROM %1 WHERE %2 = :ID")
369  .arg(m_tableName).arg(m_idName);
370  query.prepare(del_query);
371  query.bindValue(":ID", p->first);
372  if (!query.exec() || !query.isActive())
373  {
374  MythDB::DBError("multivalue remove", query);
375  }
376  m_valMap.erase(p);
377  }
378  }
379 
380  bool exists(int id, int value)
381  {
382  auto p = m_valMap.find(id);
383  if (p != m_valMap.end())
384  {
385  auto vp =
386  std::find(p->second.values.begin(), p->second.values.end(),
387  value);
388  return vp != p->second.values.end();
389  }
390  return false;
391  }
392 
393  bool exists(int id)
394  {
395  return m_valMap.find(id) != m_valMap.end();
396  }
397 
398  private:
400  {
401  m_valMap.clear();
402 
403  MSqlQuery query(MSqlQuery::InitCon());
404 
405  if (query.exec(m_fillSql) && query.size() > 0)
406  {
407  auto p = m_valMap.end();
408  while (query.next())
409  {
410  int id = query.value(0).toInt();
411  int val = query.value(1).toInt();
412 
413  if (p == m_valMap.end() ||
414  (p != m_valMap.end() && p->first != id))
415  {
416  p = m_valMap.find(id);
417  if (p == m_valMap.end())
418  {
419  entry e;
420  e.id = id;
421  p = m_valMap.insert(id_map::value_type(id, e)).first;
422  }
423  }
424  p->second.values.push_back(val);
425  }
426  }
427  }
428 
429  private:
431 
432  QString m_tableName;
433  QString m_idName;
434  QString m_valueName;
435 
436  QString m_insertSql;
437  QString m_fillSql;
438  QString m_idSql;
439 
440  bool m_ready {false};
442 };
443 
445 
446 int MultiValue::add(int id, int value)
447 {
448  return m_imp->add(id, value);
449 }
450 
451 bool MultiValue::get(int id, entry &values)
452 {
453  return m_imp->get(id, values);
454 }
455 
456 void MultiValue::remove(int id, int value)
457 {
458  m_imp->remove(id, value);
459 }
460 
461 void MultiValue::remove(int id)
462 {
463  m_imp->remove(id);
464 }
465 
466 bool MultiValue::exists(int id, int value)
467 {
468  return m_imp->exists(id, value);
469 }
470 
471 bool MultiValue::exists(int id)
472 {
473  return m_imp->exists(id);
474 }
475 
477 {
478  m_imp->load_data();
479 }
480 
482 
484  SingleValue(new SingleValueImp("videocategory", "intid", "category"))
485 {
486 }
487 
489 {
490  static VideoCategory s_vc;
491  s_vc.load_data();
492  return s_vc;
493 }
494 
496 
498  SingleValue(new SingleValueImp("videocountry", "intid", "country"))
499 {
500 }
501 
503 {
504  static VideoCountry s_vc;
505  s_vc.load_data();
506  return s_vc;
507 }
508 
510 
512  SingleValue(new SingleValueImp("videogenre", "intid", "genre"))
513 {
514 }
515 
517 {
518  static VideoGenre s_vg;
519  s_vg.load_data();
520  return s_vg;
521 }
522 
524 
526  SingleValue(new SingleValueImp("videocast", "intid", "cast"))
527 {
528 }
529 
531 {
532  static VideoCast s_vc;
533  s_vc.load_data();
534  return s_vc;
535 }
536 
538 
540  MultiValue(new MultiValueImp("videometadatagenre", "idvideo", "idgenre"))
541 {
542 }
543 
545 {
546  static VideoGenreMap s_vgm;
547  s_vgm.load_data();
548  return s_vgm;
549 }
550 
552 
554  MultiValue(new MultiValueImp("videometadatacountry", "idvideo",
555  "idcountry"))
556 {
557 }
558 
560 {
561  static VideoCountryMap s_vcm;
562  s_vcm.load_data();
563  return s_vcm;
564 }
565 
567 
569  MultiValue(new MultiValueImp("videometadatacast", "idvideo",
570  "idcast"))
571 {
572 }
573 
575 {
576  static VideoCastMap s_vcm;
577  s_vcm.load_data();
578  return s_vcm;
579 }
580 
582 
584 {
585  public:
589 
590  public:
591  FileAssociationsImp() = default;
592 
594  {
595  file_association ret_fa(fa);
596 
597  file_association *existing_fa = nullptr;
598  MSqlQuery query(MSqlQuery::InitCon());
599 
600  auto p = find(ret_fa.extension);
601  if (p != m_fileAssociations.end())
602  {
603  ret_fa.id = p->id;
604  existing_fa = &(*p);
605 
606  query.prepare("UPDATE videotypes SET extension = :EXT, "
607  "playcommand = :PLAYCMD, f_ignore = :IGNORED, "
608  "use_default = :USEDEFAULT WHERE intid = :ID");
609  query.bindValue(":ID", ret_fa.id);
610  }
611  else
612  query.prepare("INSERT INTO videotypes (extension, playcommand, "
613  "f_ignore, use_default) VALUES "
614  "(:EXT, :PLAYCMD, :IGNORED, :USEDEFAULT)");
615 
616  query.bindValue(":EXT", ret_fa.extension);
617  query.bindValue(":PLAYCMD", ret_fa.playcommand);
618  query.bindValue(":IGNORED", ret_fa.ignore);
619  query.bindValue(":USEDEFAULT", ret_fa.use_default);
620 
621  if (query.exec() && query.isActive())
622  {
623  if (!existing_fa)
624  {
625  if (query.exec("SELECT LAST_INSERT_ID()") && query.next())
626  {
627  ret_fa.id = query.value(0).toUInt();
628  m_fileAssociations.push_back(ret_fa);
629  }
630  else
631  return false;
632  }
633  else
634  *existing_fa = ret_fa;
635 
636  fa = ret_fa;
637  return true;
638  }
639 
640  return false;
641  }
642 
643  bool get(unsigned int id, file_association &val) const
644  {
645  auto p = cfind(id);
646  if (p != m_fileAssociations.end())
647  {
648  val = *p;
649  return true;
650  }
651  return false;
652  }
653 
654  bool get(const QString &ext, file_association &val) const
655  {
656  auto p = cfind(ext);
657  if (p != m_fileAssociations.end())
658  {
659  val = *p;
660  return true;
661  }
662  return false;
663  }
664 
665  bool remove(unsigned int id)
666  {
667  auto p = find(id);
668  if (p != m_fileAssociations.end())
669  {
670  MSqlQuery query(MSqlQuery::InitCon());
671  query.prepare("DELETE FROM videotypes WHERE intid = :ID");
672  query.bindValue(":ID", p->id);
673  if (query.exec())
674  {
675  m_fileAssociations.erase(p);
676  return true;
677  }
678  }
679  return false;
680  }
681 
682  const association_list &getList() const
683  {
684  return m_fileAssociations;
685  }
686 
687  void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
688  {
689  for (auto p = m_fileAssociations.cbegin();
690  p != m_fileAssociations.cend(); ++p)
691  {
692  ext_ignore.push_back(std::make_pair(p->extension, p->ignore));
693  }
694  }
695 
696  mutable QMutex m_mutex;
697 
698  void load_data()
699  {
700  QMutexLocker locker(&m_mutex);
701  if (!m_ready)
702  {
703  fill_from_db();
704  m_ready = true;
705  }
706  }
707 
708  void cleanup()
709  {
710  m_ready = false;
711  m_fileAssociations.clear();
712  }
713 
714  private:
716  {
717  MSqlQuery query(MSqlQuery::InitCon());
718  if (query.exec("SELECT intid, extension, playcommand, f_ignore, "
719  "use_default FROM videotypes"))
720  {
721  while (query.next())
722  {
723  file_association fa(query.value(0).toUInt(),
724  query.value(1).toString(),
725  query.value(2).toString(),
726  query.value(3).toBool(),
727  query.value(4).toBool());
728  m_fileAssociations.push_back(fa);
729  }
730  }
731  }
732 
733  association_list::iterator find(const QString &ext)
734  {
735  for (auto p = m_fileAssociations.begin();
736  p != m_fileAssociations.end(); ++p)
737  {
738  if (p->extension.length() == ext.length() &&
739  ext.indexOf(p->extension) == 0)
740  {
741  return p;
742  }
743  }
744  return m_fileAssociations.end();
745  }
746 
747  association_list::iterator find(unsigned int id)
748  {
749  for (auto p = m_fileAssociations.begin();
750  p != m_fileAssociations.end(); ++p)
751  {
752  if (p->id == id) return p;
753  }
754  return m_fileAssociations.end();
755  }
756 
757  association_list::const_iterator cfind(const QString &ext) const
758  {
759  for (auto p = m_fileAssociations.cbegin();
760  p != m_fileAssociations.cend(); ++p)
761  {
762  if (p->extension.length() == ext.length() &&
763  ext.indexOf(p->extension) == 0)
764  {
765  return p;
766  }
767  }
768  return m_fileAssociations.cend();
769  }
770 
771  association_list::const_iterator cfind(unsigned int id) const
772  {
773  for (auto p = m_fileAssociations.cbegin();
774  p != m_fileAssociations.cend(); ++p)
775  {
776  if (p->id == id) return p;
777  }
778  return m_fileAssociations.cend();
779  }
780 
781  private:
783  bool m_ready {false};
784 };
785 
786 
788 {
789  return m_imp->add(fa);
790 }
791 
792 bool FileAssociations::get(unsigned int id, file_association &val) const
793 {
794  return m_imp->get(id, val);
795 }
796 
797 bool FileAssociations::get(const QString &ext, file_association &val) const
798 {
799  return m_imp->get(ext, val);
800 }
801 
802 bool FileAssociations::remove(unsigned int id)
803 {
804  return m_imp->remove(id);
805 }
806 
808 {
809  return m_imp->getList();
810 }
811 
813 {
814  return m_imp->getExtensionIgnoreList(ext_ignore);
815 }
816 
818 {
819  m_imp->load_data();
820 }
821 
823 {
825 }
826 
828 {
829  delete m_imp;
830 }
831 
833 {
834  static FileAssociations s_fa;
835  s_fa.load_data();
836  return s_fa;
837 }
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:781
bool get(const QString &ext, file_association &val) const
Definition: dbaccess.cpp:654
void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
Definition: dbaccess.cpp:687
association_list::iterator find(const QString &ext)
Definition: dbaccess.cpp:733
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:862
association_list::iterator find(unsigned int id)
Definition: dbaccess.cpp:747
QString m_tableName
Definition: dbaccess.cpp:193
bool exists(int id, int value)
Definition: dbaccess.cpp:380
QString m_idName
Definition: dbaccess.cpp:194
static VideoCastMap & getCastMap()
Definition: dbaccess.cpp:574
bool get(int id, QString &category)
Definition: dbaccess.cpp:220
association_list::const_iterator cfind(const QString &ext) const
Definition: dbaccess.cpp:757
MultiValueImp(QString table_name, QString id_name, QString value_name)
Definition: dbaccess.cpp:261
int add(int id, int value)
Definition: dbaccess.cpp:446
void fill_from_db()
Definition: dbaccess.cpp:399
const association_list & getList() const
Definition: dbaccess.cpp:807
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
int size(void) const
Definition: mythdbcon.h:203
void load_data()
Definition: dbaccess.cpp:52
int add(const QString &name)
Definition: dbaccess.cpp:215
std::vector< file_association > association_list
Definition: dbaccess.h:153
void load_data()
Definition: dbaccess.cpp:274
static VideoCategory & GetCategory()
Definition: dbaccess.cpp:488
FileAssociations::association_list association_list
Definition: dbaccess.cpp:587
std::map< int, entry > id_map
Definition: dbaccess.cpp:258
static VideoCountryMap & getCountryMap()
Definition: dbaccess.cpp:559
QString m_fillSql
Definition: dbaccess.cpp:437
QString m_insertSql
Definition: dbaccess.cpp:197
QMutex m_mutex
Definition: dbaccess.cpp:272
void remove(int id)
Definition: dbaccess.cpp:225
QString m_insertSql
Definition: dbaccess.cpp:436
SimpleCleanup< MultiValueImp > m_cleanStub
Definition: dbaccess.cpp:441
bool get(unsigned int id, file_association &val) const
Definition: dbaccess.cpp:643
void load_data()
Definition: dbaccess.cpp:476
QString m_deleteSql
Definition: dbaccess.cpp:199
QVariant value(int i) const
Definition: mythdbcon.h:198
bool get(int id, entry &values)
Definition: dbaccess.cpp:326
static VideoCountry & getCountry()
Definition: dbaccess.cpp:502
entry_map m_entries
Definition: dbaccess.cpp:204
values_type values
Definition: dbaccess.h:43
bool exists(const QString &name, int *id=nullptr)
Definition: dbaccess.cpp:119
bool remove(unsigned int id)
Definition: dbaccess.cpp:802
class FileAssociationsImp * m_imp
Definition: dbaccess.h:176
SingleValue::entry entry
Definition: dbaccess.cpp:29
SingleValueImp(QString table_name, QString id_name, QString value_name)
Definition: dbaccess.cpp:36
entry_map::iterator find(const QString &name)
Definition: dbaccess.cpp:165
QString m_valueName
Definition: dbaccess.cpp:195
bool isActive(void) const
Definition: mythdbcon.h:204
void remove(int id, int value)
Definition: dbaccess.cpp:337
static MSqlQueryInfo InitCon(ConnectionReuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:534
int add(const QString &name)
Definition: dbaccess.cpp:62
std::pair< int, QString > entry
Definition: dbaccess.h:14
std::vector< entry > entry_list
Definition: dbaccess.cpp:30
FileAssociationsImp()=default
static VideoCast & GetCast()
Definition: dbaccess.cpp:530
void cleanup()
Definition: dbaccess.cpp:156
static FileAssociations & getFileAssociation()
Definition: dbaccess.cpp:832
entry_list m_retEntries
Definition: dbaccess.cpp:203
virtual bool sort(const entry &lhs, const entry &rhs)
Definition: dbaccess.cpp:151
void remove(int id)
Definition: dbaccess.cpp:98
void remove(int id, int value)
Definition: dbaccess.cpp:456
void cleanup()
Definition: dbaccess.cpp:284
association_list::const_iterator cfind(unsigned int id) const
Definition: dbaccess.cpp:771
std::vector< std::pair< QString, bool > > ext_ignore_list
Definition: dbaccess.h:154
std::vector< long > values_type
Definition: dbaccess.h:42
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:806
SingleValueImp * m_imp
Definition: dbaccess.h:32
bool exists(int id)
Definition: dbaccess.cpp:393
static VideoGenreMap & getGenreMap()
Definition: dbaccess.cpp:544
bool get(unsigned int id, file_association &val) const
Definition: dbaccess.cpp:792
bool exists(int id)
Definition: dbaccess.cpp:230
association_list m_fileAssociations
Definition: dbaccess.cpp:782
QString m_tableName
Definition: dbaccess.cpp:432
FileAssociations::ext_ignore_list ext_ignore_list
Definition: dbaccess.cpp:588
bool add(file_association &fa)
Definition: dbaccess.cpp:787
void fill_from_db()
Definition: dbaccess.cpp:175
const entry_list & getList()
Definition: dbaccess.cpp:240
static VideoGenre & getGenre()
Definition: dbaccess.cpp:516
QString m_fillSql
Definition: dbaccess.cpp:198
bool exists(int id, int value)
Definition: dbaccess.cpp:466
QMutex m_mutex
Definition: dbaccess.cpp:50
std::vector< entry > entry_list
Definition: dbaccess.h:15
QString m_idSql
Definition: dbaccess.cpp:438
id_map m_valMap
Definition: dbaccess.cpp:430
bool exists(int id)
Definition: dbaccess.cpp:114
void load_data()
Definition: dbaccess.cpp:245
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:602
SimpleCleanup< SingleValueImp > m_cleanStub
Definition: dbaccess.cpp:205
virtual ~SingleValueImp()=default
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:179
const association_list & getList() const
Definition: dbaccess.cpp:682
bool add(file_association &fa)
Definition: dbaccess.cpp:593
MultiValueImp * m_imp
Definition: dbaccess.h:62
bool get(int id, entry &values)
Definition: dbaccess.cpp:451
bool remove(unsigned int id)
Definition: dbaccess.cpp:665
QString m_valueName
Definition: dbaccess.cpp:434
int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity)
std::map< int, QString > entry_map
Definition: dbaccess.cpp:33
bool get(int id, QString &value)
Definition: dbaccess.cpp:87
const entry_list & getList()
Definition: dbaccess.cpp:131
void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
Definition: dbaccess.cpp:812
void remove(int id)
Definition: dbaccess.cpp:362
QString m_idName
Definition: dbaccess.cpp:433
virtual ~SingleValue()
Definition: dbaccess.cpp:210
int add(int id, int value)
Definition: dbaccess.cpp:290