00001 #include "ld_create.h" 00002 00003 #include "ac_app_context.h" 00004 #include "application_config.h" 00005 #include "db_creation.h" 00006 #include "sa_sensor_list_log_db.h" 00007 #include "sqlite_cl2.h" 00008 #include "utils_cl2.h" // for mkdir_p 00009 00010 #include "common/assertions.h" 00011 #include "common/error_list.h" 00012 #include "common/logging.h" 00013 00014 #include <glib/gstdio.h> 00015 00016 gboolean create_log_db(GError** error) 00017 { 00018 assert_error_unset(error); 00019 00020 const char const* sql = get_create_tables_sql(); 00021 return create_database(LOGDB_DIR, 00022 LOGDB_FILE, 00023 sql, 00024 error); 00025 } 00026 00027 gboolean ensure_log_db_created(GError** error) 00028 { 00029 assert_error_unset(error); 00030 00031 #if ALWAYS_RECREATE_DB 00032 // This may be useful during testing. 00033 g_unlink(LOGDB_FILE); // no GLib OOM on POSIX 00034 #endif 00035 00036 // g_file_test: no GLib OOM on POSIX 00037 if (!g_file_test(LOGDB_FILE, G_FILE_TEST_EXISTS)) { 00038 return create_log_db(error); 00039 } 00040 00041 return TRUE; 00042 } 00043 00044 /** 00045 00046 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00047 and the authors. All rights reserved. 00048 00049 Authors: Tero Hasu <tero.hasu@hut.fi> 00050 00051 Permission is hereby granted, free of charge, to any person 00052 obtaining a copy of this software and associated documentation files 00053 (the "Software"), to deal in the Software without restriction, 00054 including without limitation the rights to use, copy, modify, merge, 00055 publish, distribute, sublicense, and/or sell copies of the Software, 00056 and to permit persons to whom the Software is furnished to do so, 00057 subject to the following conditions: 00058 00059 The above copyright notice and this permission notice shall be 00060 included in all copies or substantial portions of the Software. 00061 00062 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00063 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00064 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00065 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00066 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00067 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00068 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00069 SOFTWARE. 00070 00071 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:54 2011 by Doxygen 1.6.1