Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas
This commit is contained in:
commit
ca65f8287f
|
@ -0,0 +1,9 @@
|
||||||
|
-- This updates a 1.30.9 database to 1.30.10
|
||||||
|
--
|
||||||
|
-- Alter type of Messages column from VARCHAR(255) to TEXT
|
||||||
|
--
|
||||||
|
|
||||||
|
-- ALTER TABLE Logs ALTER Message DROP DEFAULT;
|
||||||
|
ALTER TABLE Logs MODIFY Message TEXT NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE Config MODIFY DefaultValue TEXT;
|
|
@ -553,15 +553,15 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
|
||||||
if (tid < 0 ) // Thread/Process id
|
if (tid < 0 ) // Thread/Process id
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_SYSCALL
|
#ifdef HAVE_SYSCALL
|
||||||
#ifdef __FreeBSD_kernel__
|
#ifdef __FreeBSD_kernel__
|
||||||
if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
|
if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
|
||||||
|
|
||||||
# else
|
# else
|
||||||
// SOLARIS doesn't have SYS_gettid; don't assume
|
// SOLARIS doesn't have SYS_gettid; don't assume
|
||||||
#ifdef SYS_gettid
|
#ifdef SYS_gettid
|
||||||
if ( (tid = syscall(SYS_gettid)) < 0 ) // Thread/Process id
|
if ( (tid = syscall(SYS_gettid)) < 0 ) // Thread/Process id
|
||||||
#endif // SYS_gettid
|
#endif // SYS_gettid
|
||||||
#endif
|
#endif
|
||||||
#endif // HAVE_SYSCALL
|
#endif // HAVE_SYSCALL
|
||||||
#endif
|
#endif
|
||||||
tid = getpid(); // Process id
|
tid = getpid(); // Process id
|
||||||
|
@ -615,12 +615,14 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
|
||||||
char escapedString[(strlen(syslogStart)*2)+1];
|
char escapedString[(strlen(syslogStart)*2)+1];
|
||||||
|
|
||||||
mysql_real_escape_string( &mDbConnection, escapedString, syslogStart, strlen(syslogStart) );
|
mysql_real_escape_string( &mDbConnection, escapedString, syslogStart, strlen(syslogStart) );
|
||||||
|
|
||||||
snprintf( sql, sizeof(sql), "insert into Logs ( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line ) values ( %ld.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )", timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line );
|
snprintf( sql, sizeof(sql), "insert into Logs ( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line ) values ( %ld.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )", timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line );
|
||||||
if ( mysql_query( &mDbConnection, sql ) )
|
if ( mysql_query( &mDbConnection, sql ) )
|
||||||
{
|
{
|
||||||
databaseLevel( NOLOG );
|
Level tempDatabaseLevel = mDatabaseLevel;
|
||||||
Error( "Can't insert log entry: %s", mysql_error( &mDbConnection ) );
|
databaseLevel( NOLOG );
|
||||||
|
Error( "Can't insert log entry: sql(%s) error(%s)", sql, mysql_error( &mDbConnection ) );
|
||||||
|
databaseLevel(tempDatabaseLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( level <= mSyslogLevel )
|
if ( level <= mSyslogLevel )
|
||||||
|
|
Loading…
Reference in New Issue