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