Commit Graph

32 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt 65656de6ce db: Adjust the query methods to accept std::strings 2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt cf9c47149f db: Add helper for escaping strings and use it 2021-07-06 10:20:45 +02:00
Isaac Connor 76080cb857 add a stop function to dbQueue to clear out the queue before we kill log. 2021-04-23 09:25:07 -04:00
Isaac Connor 1ccc416224 Merge branch 'release-1.34' 2021-04-09 20:00:47 -04:00
Isaac Connor 4fb73505b9 backport change to not initialize db in logger which fixes small memleak. 2021-03-31 12:05:30 -04:00
Isaac Connor cbec5b2800 Implement zmDbDoUpdate which returns -mysql_errer or # of rows modified 2021-03-11 13:48:16 -05:00
Peter Keresztes Schmidt d9568a98c0 Drop zm_thread which has been replaced by STL implementations 2021-03-04 10:55:46 +01:00
Peter Keresztes Schmidt 3dd52a92eb db: Make sure to bind only rvalues when pushing to zmDbQueue
With this we can ensure that no copy-construction of the SQL string takes place.
Regarding calling semantics: The pushed SQL string will be moved and cannot be reused.
2021-02-25 23:08:43 +01:00
Isaac Connor 8aeb4ab758 Switch db_mutex to a std::mutex. Use modern locking with it. Use zmDbDo or dbQueue.push where appropriate. code cleanup. 2021-02-25 12:26:26 -05:00
Isaac Connor fdf515ca10 rough in a db queue thread. Use it in zm_logger so that we don't have to aquire the db lock 2021-02-24 19:59:55 -05:00
Isaac Connor 63a45888a0 Introduce utility functions zmDbDo and zmDbDoInsert. 2021-02-18 16:01:30 -05:00
Isaac Connor 991e8dc860 Include mysqld_error.h so we can test for specific errors 2021-02-10 13:54:20 -05:00
Peter Keresztes Schmidt aec4dbc6ff DB: Make connection initialization more predictable and avoid double-initialization
Remove calls to zmDBConnect from various places to avoid possible side-effects/double initialization.
The function should be called once from the main thread of the daemon.

Also split config loading into 2 steps: static and DB config loading. Load the static config before zmDBConnect is called so it has a chance to succeed.
2021-02-07 13:44:41 +01:00
Peter Keresztes Schmidt 0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Isaac Connor 74972be9b5 spacing, code style. Set row=nullptr to quiet valgrind 2020-11-18 13:15:52 -05:00
Isaac Connor 1257a7ea37 improvements reported by cppcheck 2020-11-01 16:11:19 -05:00
Peter Keresztes Schmidt 8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Isaac Connor 316dbb5eb8 Implement a RecursiveMutex class which is an explicit Recursive Mutex. Change the db mutex to a recursive Mutex 2018-06-01 11:27:35 -04:00
Isaac Connor d777f6104f add a method to access the underlying MYSQL_ROW 2018-03-09 07:23:14 -05:00
Isaac Connor b3d23ab233 merge zma_to_thread version of db functions, which include a mutex lock 2018-03-01 19:20:29 -08:00
Isaac Connor 5ae34a7561 Merge branch 'master' into storageareas 2017-01-02 09:39:10 -05:00
Andy Bauer 254fcbcef7 update gpl 2 mailing address in source files 2016-12-26 09:23:16 -06:00
Isaac Connor 44f32f46b7 deprecate zmdbFetchOne in favor of zmDbRow 2016-04-20 11:56:58 -04:00
Isaac Connor 60410c98d6 use new db functions in zm_config.cpp 2015-07-16 16:44:09 -04:00
Isaac Connor 48fa0c3d42 add some utility db functions 2015-07-16 13:04:28 -04:00
manupap1 b4732e4750 Close logger and database on exit 2014-11-14 22:17:44 +01:00
stan 6ff385e407 git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3459 e3e1d417-86f3-4887-817a-d78f3d33393f 2011-06-21 09:19:10 +00:00
stan e6041e24a7 Uppdated copyright headers
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2611 e3e1d417-86f3-4887-817a-d78f3d33393f
2008-07-25 09:33:23 +00:00
stan 235dde1a80 Updated copyright statement.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1829 e3e1d417-86f3-4887-817a-d78f3d33393f
2006-01-17 10:56:30 +00:00
stan 264c23d687 Updated copyright statement
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1360 e3e1d417-86f3-4887-817a-d78f3d33393f
2005-02-24 14:40:14 +00:00
stan 2ba1ee4eb8 Removed secondary DB user.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1171 e3e1d417-86f3-4887-817a-d78f3d33393f
2004-12-28 17:01:25 +00:00
stan a6f405b4ac New files created as a result of breaking out the classes to support
the use of remote cameras.


git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@414 e3e1d417-86f3-4887-817a-d78f3d33393f
2003-03-26 12:03:37 +00:00