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