experimental_ADatabase.3 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. .TH "experimental::ADatabase" 3 "Sun Dec 27 2020" "openPilotLog" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. experimental::ADatabase \- The DB class encapsulates the SQL database by providing fast access to hot database data\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <adatabase\&.h>\fP
  11. .PP
  12. Inherits QObject\&.
  13. .SS "Signals"
  14. .in +1c
  15. .ti -1c
  16. .RI "void \fBdataBaseUpdated\fP ()"
  17. .br
  18. .RI "updated is emitted whenever the database contents have been updated\&. This can be either a commit, update or remove\&. This signal should be used to trigger an update to the models of the views displaying database contents in the user interface so that a user is always presented with up-to-date information\&. "
  19. .in -1c
  20. .SS "Public Member Functions"
  21. .in +1c
  22. .ti -1c
  23. .RI "\fBADatabase\fP (const \fBADatabase\fP &)=delete"
  24. .br
  25. .ti -1c
  26. .RI "void \fBoperator=\fP (const \fBADatabase\fP &)=delete"
  27. .br
  28. .ti -1c
  29. .RI "bool \fBconnect\fP ()"
  30. .br
  31. .RI "Connect to the database and populate database information\&. "
  32. .ti -1c
  33. .RI "void \fBdisconnect\fP ()"
  34. .br
  35. .RI "closes the database connection\&. "
  36. .ti -1c
  37. .RI "QVector< QString > \fBcustomQuery\fP (QString statement, int return_values)"
  38. .br
  39. .RI "Can be used to send a complex query to the database\&. "
  40. .ti -1c
  41. .RI "bool \fBexists\fP (\fBAEntry\fP entry)"
  42. .br
  43. .RI "Checks if an entry exists in the database, based on position data\&. "
  44. .ti -1c
  45. .RI "bool \fBexists\fP (\fBDataPosition\fP data_position)"
  46. .br
  47. .ti -1c
  48. .RI "bool \fBcommit\fP (\fBAEntry\fP entry)"
  49. .br
  50. .RI "commits an entry to the database, calls either insert or update, based on position data "
  51. .ti -1c
  52. .RI "bool \fBinsert\fP (\fBAEntry\fP new_entry)"
  53. .br
  54. .RI "Create new entry in the databse based on \fBUserInput\fP\&. "
  55. .ti -1c
  56. .RI "bool \fBupdate\fP (\fBAEntry\fP updated_entry)"
  57. .br
  58. .RI "Updates entry in database from existing entry tweaked by the user\&. "
  59. .ti -1c
  60. .RI "bool \fBremove\fP (\fBAEntry\fP entry)"
  61. .br
  62. .RI "deletes an entry from the database\&. "
  63. .ti -1c
  64. .RI "bool \fBremoveMany\fP (QList< \fBDataPosition\fP >)"
  65. .br
  66. .RI "deletes a list of entries from the database\&. Optimised for speed when deleting many entries\&. "
  67. .ti -1c
  68. .RI "TableData \fBgetEntryData\fP (\fBDataPosition\fP data_position)"
  69. .br
  70. .RI "retreive entry data from the database to create an entry object "
  71. .ti -1c
  72. .RI "\fBAEntry\fP \fBgetEntry\fP (\fBDataPosition\fP data_position)"
  73. .br
  74. .RI "retreive an Entry from the database\&. "
  75. .ti -1c
  76. .RI "\fBAPilotEntry\fP \fBgetPilotEntry\fP (RowId row_id)"
  77. .br
  78. .RI "retreives a PilotEntry from the database\&. "
  79. .ti -1c
  80. .RI "\fBATailEntry\fP \fBgetTailEntry\fP (RowId row_id)"
  81. .br
  82. .RI "retreives a TailEntry from the database\&. "
  83. .ti -1c
  84. .RI "\fBAAircraftEntry\fP \fBgetAircraftEntry\fP (RowId row_id)"
  85. .br
  86. .RI "retreives a TailEntry from the database\&. "
  87. .ti -1c
  88. .RI "\fBAFlightEntry\fP \fBgetFlightEntry\fP (RowId row_id)"
  89. .br
  90. .RI "retreives a flight entry from the database\&. "
  91. .ti -1c
  92. .RI "const QStringList \fBgetCompletionList\fP (\fBADatabaseTarget\fP)"
  93. .br
  94. .RI "getCompletionList returns a QStringList of values for a QCompleter based on database values "
  95. .ti -1c
  96. .RI "const QMap< QString, int > \fBgetIdMap\fP (\fBADatabaseTarget\fP)"
  97. .br
  98. .RI "returns a QMap<QString, int> of a human-readable database value and its row id\&. Used in the Dialogs to map user input to unique database entries\&. "
  99. .ti -1c
  100. .RI "int \fBgetLastEntry\fP (\fBADatabaseTarget\fP)"
  101. .br
  102. .RI "returns the ROWID for the newest entry in the respective database\&. "
  103. .ti -1c
  104. .RI "QList< int > \fBgetForeignKeyConstraints\fP (int foreign_row_id, \fBADatabaseTarget\fP target)"
  105. .br
  106. .RI "returns a list of ROWID's in the flights table for which foreign key constraints exist\&. "
  107. .in -1c
  108. .SS "Static Public Member Functions"
  109. .in +1c
  110. .ti -1c
  111. .RI "static \fBADatabase\fP * \fBgetInstance\fP ()"
  112. .br
  113. .ti -1c
  114. .RI "static QSqlDatabase \fBdatabase\fP ()"
  115. .br
  116. .RI "Can be used to access the database connection\&. "
  117. .in -1c
  118. .SS "Public Attributes"
  119. .in +1c
  120. .ti -1c
  121. .RI "\fBADatabaseError\fP \fBlastError\fP"
  122. .br
  123. .in -1c
  124. .SH "Detailed Description"
  125. .PP
  126. The DB class encapsulates the SQL database by providing fast access to hot database data\&.
  127. .SH "Member Function Documentation"
  128. .PP
  129. .SS "QVector< QString > experimental::ADatabase::customQuery (QString statement, int return_values)"
  130. .PP
  131. Can be used to send a complex query to the database\&.
  132. .PP
  133. \fBParameters\fP
  134. .RS 4
  135. \fIquery\fP - the full sql query statement
  136. .br
  137. \fIreturnValues\fP - the number of return values
  138. .RE
  139. .PP
  140. .SS "QSqlDatabase experimental::ADatabase::database ()\fC [static]\fP"
  141. .PP
  142. Can be used to access the database connection\&.
  143. .PP
  144. \fBReturns\fP
  145. .RS 4
  146. The QSqlDatabase object pertaining to the connection\&.
  147. .RE
  148. .PP
  149. .SS "\fBAAircraftEntry\fP experimental::ADatabase::getAircraftEntry (RowId row_id)"
  150. .PP
  151. retreives a TailEntry from the database\&. This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns an \fBAAircraftEntry\fP instead of an \fBAEntry\fP\&. It allows for easy access to an aircraft entry with only the RowId required as input\&.
  152. .SS "\fBAFlightEntry\fP experimental::ADatabase::getFlightEntry (RowId row_id)"
  153. .PP
  154. retreives a flight entry from the database\&. This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns an \fBAFlightEntry\fP instead of an \fBAEntry\fP\&. It allows for easy access to a flight entry with only the RowId required as input\&.
  155. .SS "\fBAPilotEntry\fP experimental::ADatabase::getPilotEntry (RowId row_id)"
  156. .PP
  157. retreives a PilotEntry from the database\&. This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns a PilotEntry instead of an Entry\&. It allows for easy access to a pilot entry with only the RowId required as input\&.
  158. .SS "\fBATailEntry\fP experimental::ADatabase::getTailEntry (RowId row_id)"
  159. .PP
  160. retreives a TailEntry from the database\&. This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns a TailEntry instead of an Entry\&. It allows for easy access to a tail entry with only the RowId required as input\&.
  161. .SH "Author"
  162. .PP
  163. Generated automatically by Doxygen for openPilotLog from the source code\&.