@ -49,7 +49,7 @@ uint64_t servaMySQLDBC::addMediaQueueRecord( CSTR uuid, uint64_t module_id, uint
sprintf ( tQBuf , " INSERT INTO `media_queue` SET `module_id`=% " PRIu64 " , `session_id`=% " PRIu64 " , `ts`=%d, `tsms`=%d, `uuid`='%s', `width`=%d, `height`=%d, `fps`=%d, `fmt`='%s', `status`=0, `process`=0 " ,
sprintf ( tQBuf , " INSERT INTO `media_queue` SET `module_id`=% " PRIu64 " , `session_id`=% " PRIu64 " , `ts`=%d, `tsms`=%d, `uuid`='%s', `width`=%d, `height`=%d, `fps`=%d, `fmt`='%s', `status`=0, `process`=0 " ,
module_id , session_id , ts , tsms , uuid , width , height , fps , fmt
module_id , session_id , ts , tsms , uuid , width , height , fps , fmt
) ;
) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
LOG ( tQBuf ) ;
# endif
# endif
RetVal = m_pDatabase - > QueryID ( tQBuf ) ;
RetVal = m_pDatabase - > QueryID ( tQBuf ) ;
@ -201,6 +201,9 @@ uint64_t servaMySQLDBC::getBottomLRF( uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `lrf_sensors` WHERE `role`='B' AND `mojo_id`=%d " , id ) ;
sprintf ( tQBuf , " SELECT `id` FROM `lrf_sensors` WHERE `role`='B' AND `mojo_id`=%d " , id ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -224,7 +227,9 @@ uint32_t servaMySQLDBC::getCloudLTS( uint8_t Obj, uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `ts` FROM `mem_online_cloud` WHERE `object_id`=% " PRIu64 " AND `object_type`=%d " , id , Obj ) ;
sprintf ( tQBuf , " SELECT `ts` FROM `mem_online_cloud` WHERE `object_id`=% " PRIu64 " AND `object_type`=%d " , id , Obj ) ;
LOG ( tQBuf ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -248,6 +253,9 @@ uint8_t servaMySQLDBC::getCloudStatus( uint8_t Obj, uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `status` FROM `mem_online_cloud` WHERE `object_id`=% " PRIu64 " AND `object_type`=%d " , id , Obj ) ;
sprintf ( tQBuf , " SELECT `status` FROM `mem_online_cloud` WHERE `object_id`=% " PRIu64 " AND `object_type`=%d " , id , Obj ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -271,6 +279,9 @@ uint64_t servaMySQLDBC::getRecentMediaId(){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `media_queue` WHERE `status`=1 LIMIT 1 " ) ;
sprintf ( tQBuf , " SELECT `id` FROM `media_queue` WHERE `status`=1 LIMIT 1 " ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -294,6 +305,9 @@ DBC_RPC_MEDIA_INFO *servaMySQLDBC::getRemoteMediaInfo( uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM `media_queue` WHERE `id`=% " PRIu64 , id ) ;
sprintf ( tQBuf , " SELECT * FROM `media_queue` WHERE `id`=% " PRIu64 , id ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -346,6 +360,9 @@ DBC_RPC_MEDIA_INFO_EX *servaMySQLDBC::getRemoteMediaInfoEx( uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM `media_queue` WHERE `id`=% " PRIu64 , id ) ;
sprintf ( tQBuf , " SELECT * FROM `media_queue` WHERE `id`=% " PRIu64 , id ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -406,6 +423,9 @@ uint64_t servaMySQLDBC::getTrackIdByMojo( uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `track_id` FROM `metro_modules` WHERE `id`=% " PRIu64 , id ) ;
sprintf ( tQBuf , " SELECT `track_id` FROM `metro_modules` WHERE `id`=% " PRIu64 , id ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -429,6 +449,9 @@ uint64_t servaMySQLDBC::getUpperLRF( uint64_t id ){
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `lrf_sensors` WHERE `role`='U' AND `mojo_id`=%d " , id ) ;
sprintf ( tQBuf , " SELECT `id` FROM `lrf_sensors` WHERE `role`='U' AND `mojo_id`=%d " , id ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -450,6 +473,9 @@ bool servaMySQLDBC::putIntoLog( CSTR A, CSTR B, CSTR C ){
if ( m_bIsConnected ) {
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " INSERT INTO `server_log_messages` SET lvl = '%s', `ts`='%s', `msg`='%s' " , A , B , C ) ;
sprintf ( tQBuf , " INSERT INTO `server_log_messages` SET lvl = '%s', `ts`='%s', `msg`='%s' " , A , B , C ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
m_pDatabase - > SilentQuery ( tQBuf ) ;
} else LOG ( " Not Connected! " ) ;
} else LOG ( " Not Connected! " ) ;
} ;
} ;
@ -460,6 +486,9 @@ uint64_t servaMySQLDBC::registerMojo( CSTR A, CSTR B ){
if ( m_bIsConnected ) {
if ( m_bIsConnected ) {
AAssoc * result ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `metro_modules` WHERE `IP4`='%s' AND `identity`='%s' " , A , B ) ;
sprintf ( tQBuf , " SELECT `id` FROM `metro_modules` WHERE `IP4`='%s' AND `identity`='%s' " , A , B ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
if ( result - > size ( ) > 0 ) {
@ -542,6 +571,9 @@ uint32_t servaMySQLDBC::registerVideoTransfer( uint32_t srcNode, CSTR uuid, uint
char tQBuf [ MAX_PATH_LEN ] ;
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " INSERT INTO `media_queue` SET `src`=%d, `uuid`='%s', `size`=%d, `fmt`='%s', `ts`=%d " ,
sprintf ( tQBuf , " INSERT INTO `media_queue` SET `src`=%d, `uuid`='%s', `size`=%d, `fmt`='%s', `ts`=%d " ,
srcNode , uuid , dataSize , fmt , ts ) ;
srcNode , uuid , dataSize , fmt , ts ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
return ( uint32_t ) m_pDatabase - > QueryID ( tQBuf ) ;
return ( uint32_t ) m_pDatabase - > QueryID ( tQBuf ) ;
} ;
} ;
return 0 ;
return 0 ;