trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [07/11] trafodion git commit: [TRAFODION-2650] Restructured Trafodion Configuration code into separate directory structure.
Date Tue, 06 Feb 2018 19:23:26 GMT
http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/tcdbsqlite.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/tcdbsqlite.cxx b/core/sqf/monitor/linux/tcdbsqlite.cxx
deleted file mode 100644
index ff18cdd..0000000
--- a/core/sqf/monitor/linux/tcdbsqlite.cxx
+++ /dev/null
@@ -1,3390 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-// 
-///////////////////////////////////////////////////////////////////////////////
-
-#include <string>
-#include <stdlib.h>
-#include <string.h>
-
-using namespace std;
-
-#include "tclog.h"
-#include "tctrace.h"
-#include "trafconfig.h"
-#include "tcdbsqlite.h"
-
-#define MAX_PROCESS_PATH           256
-
-///////////////////////////////////////////////////////////////////////////////
-//  Cluster Configuration
-///////////////////////////////////////////////////////////////////////////////
-
-CTcdbSqlite::CTcdbSqlite( void )
-           : CTcdbStore( TCDBSQLITE )
-           , db_(NULL)
-{
-    const char method_name[] = "CTcdbSqlite::CTcdbSqlite";
-    TRACE_ENTRY;
-
-    memcpy(&eyecatcher_, "TCSL", 4);
-
-    TRACE_EXIT;
-}
-
-CTcdbSqlite::~CTcdbSqlite ( void )
-{
-    const char method_name[] = "CTcdbSqlite::~CTcdbSqlite";
-    TRACE_ENTRY;
-
-    memcpy(&eyecatcher_, "tcsl", 4);
-
-    TRACE_EXIT;
-}
-
-// insert key into monRegKeyName table
-int CTcdbSqlite::AddRegistryKey( const char *key )
-{
-    const char method_name[] = "CTcdbSqlite::AddRegistryKey";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf("%s@%d inserting key=%s into monRegKeyName\n",
-                     method_name, __LINE__, key);
-    }
-
-    int rc;
-    const char * sqlStmt;
-    sqlStmt = "insert into monRegKeyName (keyName) values ( :key );";
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_text( prepStmt, 
-                                sqlite3_bind_parameter_index( prepStmt, ":key" ),
-                                key, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:key) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW ) 
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, key=%s, error: %s\n"
-                    , method_name, sqlStmt, key, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-        
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-// insert key into monRegProcName table
-int CTcdbSqlite::AddRegistryProcess( const char *name )
-{
-    const char method_name[] = "CTcdbSqlite::AddRegistryProcess";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf("%s@%d inserting name=%s into monRegProcName\n",
-                     method_name, __LINE__, name);
-    }
-
-    int rc;
-    const char * sqlStmt;
-    sqlStmt = "insert into monRegProcName (procName) values ( :name );";
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_text( prepStmt,
-                                sqlite3_bind_parameter_index( prepStmt, ":name" ),
-                                name, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:name) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW ) 
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, name=%s, error: %s\n"
-                    , method_name, sqlStmt, name, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-        
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::AddRegistryClusterData( const char *key
-                                       , const char *dataValue )
-{
-    const char method_name[] = "CTcdbSqlite::AddRegistryClusterData";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf("%s@%d inserting key=%s into monRegClusterData\n",
-                     method_name, __LINE__, key);
-    }
-
-    int rc;
-    const char * sqlStmt;
-    sqlStmt = "insert or replace into monRegClusterData (dataValue, keyId)"
-              " select :dataValue,"
-              "         k.keyId FROM monRegKeyName k"
-              " where k.keyName = :key";
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_text( prepStmt,
-                                sqlite3_bind_parameter_index( prepStmt,
-                                                              ":dataValue" ),
-                                dataValue, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:dataValue) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_text( prepStmt,
-                                sqlite3_bind_parameter_index( prepStmt, ":key" ),
-                                key, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:key) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW ) 
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, key=%s, error: %s\n"
-                    , method_name, sqlStmt, key, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-        
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::AddRegistryProcessData( const char *procName
-                                       , const char *key
-                                       , const char *dataValue )
-{
-    const char method_name[] = "CTcdbSqlite::AddRegistryProcessData";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf("%s@%d inserting key=%s into monRegProcData for "
-                     "proc=%s\n", method_name, __LINE__, key, procName);
-    }
-
-    int rc;
-    const char * sqlStmt;
-    sqlStmt = "insert or replace into monRegProcData (dataValue, procId, keyId )"
-              "   select :dataValue,"
-              "      p.procId,"
-              "       (SELECT k.keyId "
-              "          FROM monRegKeyName k"
-              "         WHERE k.keyName = :key)"
-              "   FROM monRegProcName p"
-              "   WHERE UPPER(p.procName) = UPPER(:procName)";
-
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_text( prepStmt,
-                                sqlite3_bind_parameter_index( prepStmt,
-                                                              ":procName" ),
-                                procName, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:procName) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_text( prepStmt,
-                                sqlite3_bind_parameter_index( prepStmt,
-                                                              ":dataValue" ),
-                                dataValue, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:dataValue) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_text( prepStmt,
-                                sqlite3_bind_parameter_index( prepStmt, ":key" ),
-                                key, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(:key) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW ) 
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, key=%s, proc=%s, error: %s\n"
-                    , method_name, sqlStmt, key, procName, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::AddUniqueString( int nid
-                                , int id
-                                , const char *uniqStr )
-{
-    const char method_name[] = "CTcdbSqlite::AddUniqueString";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf("%s@%d inserting unique string nid=%d id=%d into "
-                     "monRegUniqueStrings\n", method_name, __LINE__,
-                     nid, id);
-    }
-
-    int rc;
-    const char * sqlStmt;
-    sqlStmt = "insert or replace into monRegUniqueStrings values (?, ?, ?)";
-
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int( prepStmt, 1, nid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(nid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_int( prepStmt, 2, id );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(id) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_text( prepStmt, 3, uniqStr, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(uniqStr) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-        if ( rc != SQLITE_DONE )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, nid=%d, id=%d, error: %s\n"
-                    , method_name, sqlStmt, nid, id, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::Close( void )
-{
-    const char method_name[] = "CTcdbSqlite::Close";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    int rc = sqlite3_close( db_ );
-    if ( rc == SQLITE_OK)
-    {
-        db_ = NULL;
-    }
-    else
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] sqlite3_close() error: %s\n"
-                , method_name, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::DeleteNodeData( int pnid )
-{
-    const char method_name[] = "CTcdbSqlite::DeleteNodeData";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST))
-    {
-        trace_printf( "%s@%d delete from lnode, pnode values (pNid=%d)\n"
-                     , method_name, __LINE__
-                     , pnid );
-    }
-
-    int rc;
-
-    const char *sqlStmt1;
-    sqlStmt1 = "delete from lnode where lnode.pNid = ?";
-
-    sqlite3_stmt *prepStmt1 = NULL;
-    rc = sqlite3_prepare_v2( db_, sqlStmt1, strlen(sqlStmt1)+1, &prepStmt1, NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error=%s\n"
-                , method_name, sqlStmt1, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int( prepStmt1, 1, pnid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(pnid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt1 != NULL )
-            {
-                sqlite3_finalize( prepStmt1 );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt1 );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW )
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, pNid=%d, error: %s\n"
-                    , method_name, sqlStmt1, pnid, sqlite3_errmsg(db_));
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt1 != NULL )
-            {
-                sqlite3_finalize( prepStmt1 );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    const char *sqlStmt2;
-    sqlStmt2 = "delete from pnode where pnode.pNid = ?";
-
-    sqlite3_stmt *prepStmt2 = NULL;
-    rc = sqlite3_prepare_v2( db_, sqlStmt2, strlen(sqlStmt2)+1, &prepStmt2, NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error=%s\n"
-                , method_name, sqlStmt2, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        if ( prepStmt1 != NULL )
-        {
-            sqlite3_finalize( prepStmt1 );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int( prepStmt2, 1, pnid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(pnid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt1 != NULL )
-            {
-                sqlite3_finalize( prepStmt1 );
-            }
-            if ( prepStmt2 != NULL )
-            {
-                sqlite3_finalize( prepStmt2 );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt2 );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW )
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, pNid=%d, error: %s\n"
-                    , method_name, sqlStmt2, pnid, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt1 != NULL )
-            {
-                sqlite3_finalize( prepStmt1 );
-            }
-            if ( prepStmt2 != NULL )
-            {
-                sqlite3_finalize( prepStmt2 );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt1 != NULL )
-    {
-        sqlite3_finalize( prepStmt1 );
-    }
-    if ( prepStmt2 != NULL )
-    {
-        sqlite3_finalize( prepStmt2 );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::DeleteUniqueString( int nid )
-{
-    const char method_name[] = "CTcdbSqlite::DeleteUniqueString";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf( "%s@%d delete from monRegUniqueStrings values (nid=%d)\n"
-                     , method_name, __LINE__
-                     , nid );
-    }
-
-    int rc;
-
-    const char *sqlStmtA;
-    sqlStmtA = "delete from monRegUniqueStrings where monRegUniqueStrings.nid = ?";
-
-    sqlite3_stmt *prepStmtA = NULL;
-    rc = sqlite3_prepare_v2( db_, sqlStmtA, strlen(sqlStmtA)+1, &prepStmtA, NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error=%s\n"
-                , method_name, sqlStmtA, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int( prepStmtA, 1, nid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(nid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmtA != NULL )
-            {
-                sqlite3_finalize( prepStmtA );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmtA );
-        if (( rc != SQLITE_DONE ) && ( rc != SQLITE_ROW )
-         && ( rc != SQLITE_CONSTRAINT ) )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, pNid=%d, error: %s\n"
-                    , method_name, sqlStmtA, nid, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmtA != NULL )
-            {
-                sqlite3_finalize( prepStmtA );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmtA != NULL )
-    {
-        sqlite3_finalize( prepStmtA );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::Initialize( void )
-{
-    const char method_name[] = "CTcdbSqlite::Initialize";
-    TRACE_ENTRY;
-
-    if ( IsInitialized() )
-    {
-        // Already initialized
-        TRACE_EXIT;
-        return( TCALREADYINIT );
-    }
-
-    char dbase[MAX_PROCESS_PATH];
-
-    // Open the configuration database file
-    char *configenv = getenv("SQ_CONFIGDB");
-    if (configenv != NULL)
-    {
-        snprintf( dbase, sizeof(dbase), "%s", configenv);
-    }
-    else
-    {
-        snprintf( dbase, sizeof(dbase)
-                , "%s/sql/scripts/sqconfig.db", getenv("TRAF_HOME"));
-    }
-    int rc = sqlite3_open_v2( dbase, &db_
-                            , SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX
-                            , NULL);
-    if ( rc )
-    {
-        db_ = NULL;
-
-        // See if database is in current directory
-        int rc2 = sqlite3_open_v2( "sqconfig.db", &db_
-                                 , SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX
-                                 , NULL);
-        if ( rc2 )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s], sqlite3_open_v2(%s) failed, error: %s\n"
-                    , method_name, dbase, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( db_ != NULL )
-    {
-        rc = sqlite3_busy_timeout(db_, 1000);
-        if ( rc )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s], sqlite3_busy_timeout(%s) failed, error: %s\n"
-                    , method_name,  dbase, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        char *sErrMsg = NULL;
-        sqlite3_exec(db_, "PRAGMA synchronous = OFF", NULL, NULL, &sErrMsg);
-        if (sErrMsg != NULL)
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s], sqlite3_exec(PRAGMA synchronous = OFF) failed, error: %s\n"
-                    , method_name, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetNode( int nid
-                        , node_configuration_t &nodeConfig )
-{
-    const char method_name[] = "CTcdbSqlite::GetNode";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    int  rc;
-    int  firstcore = -1;
-    int  lastcore = -1;
-    int  excfirstcore = -1;
-    int  exclastcore = -1;
-    int  lnid = -1;
-    int  pnid = -1;
-    int  processors = 0;
-    int  roles;
-    const char   *nodename = NULL;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    // Prepare select logical nodes
-    sqlStmt = "select p.pNid, l.lNid, p.nodeName, l.firstCore, l.lastCore,"
-                   " p.excFirstCore, p.excLastCore, l.processors, l.roles"
-                   "  from pnode p, lnode l where p.pNid = l.pNid"
-                   "   and l.lNid = ?";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {   // Set nid in prepared statement
-        rc = sqlite3_bind_int(prepStmt, 1, nid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(nid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    rc = sqlite3_step( prepStmt );
-    if ( rc == SQLITE_ROW )
-    {  // Process row
-        int colCount = sqlite3_column_count(prepStmt);
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d sqlite3_column_count=%d\n",
-                         method_name, __LINE__, colCount);
-            for (int i=0; i<colCount; ++i)
-            {
-                trace_printf("%s@%d column %d is %s\n",
-                             method_name, __LINE__, i,
-                             sqlite3_column_name(prepStmt, i));
-            }
-        }
-
-        pnid = sqlite3_column_int(prepStmt, 0);
-        lnid = sqlite3_column_int(prepStmt, 1);
-        nodename = (const char *) sqlite3_column_text(prepStmt, 2);
-        firstcore = sqlite3_column_int(prepStmt, 3);
-        lastcore = sqlite3_column_int(prepStmt, 4);
-        excfirstcore = sqlite3_column_int(prepStmt, 5);
-        exclastcore = sqlite3_column_int(prepStmt, 6);
-        processors = sqlite3_column_int(prepStmt, 7);
-        roles = sqlite3_column_int(prepStmt, 8);
-        SetLNodeData( lnid
-                    , pnid
-                    , nodename
-                    , excfirstcore
-                    , exclastcore
-                    , firstcore
-                    , lastcore
-                    , processors
-                    , roles
-                    , nodeConfig );
-    }
-    else if ( rc == SQLITE_DONE )
-    {
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d Finished processing logical nodes.\n",
-                         method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCDBNOEXIST );
-    }
-    else
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetNode( const char *name
-                        , node_configuration_t &nodeConfig )
-{
-    const char method_name[] = "CTcdbSqlite::GetNode";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    int  rc;
-    int  firstcore = -1;
-    int  lastcore = -1;
-    int  excfirstcore = -1;
-    int  exclastcore = -1;
-    int  nid = -1;
-    int  pnid = -1;
-    int  processors = 0;
-    int  roles;
-    const char   *nodename = NULL;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    // Prepare select logical nodes
-    sqlStmt = "select p.pNid, l.lNid, p.nodeName, l.firstCore, l.lastCore,"
-                   " p.excFirstCore, p.excLastCore, l.processors, l.roles"
-                   "  from pnode p, lnode l where p.pNid = l.pNid"
-                   "   and p.nodeName = ?";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {   // Set name in prepared statement
-        rc = sqlite3_bind_text( prepStmt, 1, name, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(name) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    rc = sqlite3_step( prepStmt );
-    if ( rc == SQLITE_ROW )
-    {  // Process row
-        int colCount = sqlite3_column_count(prepStmt);
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d sqlite3_column_count=%d\n",
-                         method_name, __LINE__, colCount);
-            for (int i=0; i<colCount; ++i)
-            {
-                trace_printf("%s@%d column %d is %s\n",
-                             method_name, __LINE__, i,
-                             sqlite3_column_name(prepStmt, i));
-            }
-        }
-
-        pnid = sqlite3_column_int(prepStmt, 0);
-        nid = sqlite3_column_int(prepStmt, 1);
-        nodename = (const char *) sqlite3_column_text(prepStmt, 2);
-        firstcore = sqlite3_column_int(prepStmt, 3);
-        lastcore = sqlite3_column_int(prepStmt, 4);
-        excfirstcore = sqlite3_column_int(prepStmt, 5);
-        exclastcore = sqlite3_column_int(prepStmt, 6);
-        processors = sqlite3_column_int(prepStmt, 7);
-        roles = sqlite3_column_int(prepStmt, 8);
-        SetLNodeData( nid
-                    , pnid
-                    , nodename
-                    , excfirstcore
-                    , exclastcore
-                    , firstcore
-                    , lastcore
-                    , processors
-                    , roles
-                    , nodeConfig );
-    }
-    else if ( rc == SQLITE_DONE )
-    {
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d Finished processing logical nodes.\n",
-                         method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCDBNOEXIST );
-    }
-    else
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    // Destroy prepared statement object
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetNodes( int &count
-                         , int max
-                         , node_configuration_t nodeConfig[] )
-{
-    const char method_name[] = "CTcdbSqlite::GetNodes";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    int  rc;
-    int  firstcore = -1;
-    int  lastcore = -1;
-    int  excfirstcore = -1;
-    int  exclastcore = -1;
-    int  nid = -1;
-    int  pnid = -1;
-    int  processors = 0;
-    int  roles;
-    int  nodeCount = 0;
-    const char   *nodename = NULL;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    // Prepare select logical nodes
-    sqlStmt = "select p.pNid, l.lNid, p.nodeName, l.firstCore, l.lastCore,"
-                   " p.excFirstCore, p.excLastCore, l.processors, l.roles"
-                   "  from pnode p, lnode l where p.pNid = l.pNid";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    // Process logical nodes
-    while ( 1 )
-    {
-        rc = sqlite3_step( prepStmt );
-        if ( rc == SQLITE_ROW )
-        {  // Process row
-            if ( max == 0 )
-            {
-                nodeCount++;
-                continue;
-            }
-
-            int colCount = sqlite3_column_count(prepStmt);
-            if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d sqlite3_column_count=%d\n",
-                             method_name, __LINE__, colCount);
-                for (int i=0; i<colCount; ++i)
-                {
-                    trace_printf("%s@%d column %d is %s\n",
-                                 method_name, __LINE__, i,
-                                 sqlite3_column_name(prepStmt, i));
-                }
-            }
-
-            if ( nodeCount < max )
-            {
-                pnid = sqlite3_column_int(prepStmt, 0);
-                nid = sqlite3_column_int(prepStmt, 1);
-                nodename = (const char *) sqlite3_column_text(prepStmt, 2);
-                firstcore = sqlite3_column_int(prepStmt, 3);
-                lastcore = sqlite3_column_int(prepStmt, 4);
-                excfirstcore = sqlite3_column_int(prepStmt, 5);
-                exclastcore = sqlite3_column_int(prepStmt, 6);
-                processors = sqlite3_column_int(prepStmt, 7);
-                roles = sqlite3_column_int(prepStmt, 8);
-                SetLNodeData( nid
-                            , pnid
-                            , nodename
-                            , excfirstcore
-                            , exclastcore
-                            , firstcore
-                            , lastcore
-                            , processors
-                            , roles
-                            , nodeConfig[nodeCount] );
-                nodeCount++;
-            }
-            else
-            {
-                count = nodeCount;
-                if ( prepStmt != NULL )
-                {
-                    sqlite3_finalize( prepStmt );
-                }
-                TRACE_EXIT;
-                return( TCDBTRUNCATE );
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            count = nodeCount;
-            if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d Finished processing logical nodes.\n",
-                             method_name, __LINE__);
-            }
-            break;
-        }
-        else
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, error: %s\n"
-                    , method_name, sqlStmt, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetPNode( int pNid
-                         , physical_node_configuration_t &pnodeConfig )
-{
-    const char method_name[] = "CTcdbSqlite::GetPNode";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int  rc;
-    int  excfirstcore = -1;
-    int  exclastcore = -1;
-    int  pnid = -1;
-    const char   *nodename = NULL;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    // Prepare select logical nodes
-    sqlStmt = "select p.pNid, p.nodeName, p.excFirstCore, p.excLastCore"
-                   "  from pnode p where p.pNid = ?";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {   // Set nid in prepared statement
-        rc = sqlite3_bind_int(prepStmt, 1, pNid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(pNid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    rc = sqlite3_step( prepStmt );
-    if ( rc == SQLITE_ROW )
-    {  // Process row
-        int colCount = sqlite3_column_count(prepStmt);
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d sqlite3_column_count=%d\n",
-                         method_name, __LINE__, colCount);
-            for (int i=0; i<colCount; ++i)
-            {
-                trace_printf("%s@%d column %d is %s\n",
-                             method_name, __LINE__, i,
-                             sqlite3_column_name(prepStmt, i));
-            }
-        }
-
-        pnid = sqlite3_column_int(prepStmt, 0);
-        nodename = (const char *) sqlite3_column_text(prepStmt, 1);
-        excfirstcore = sqlite3_column_int(prepStmt, 2);
-        exclastcore = sqlite3_column_int(prepStmt, 3);
-        SetPNodeData( pnid
-                    , nodename
-                    , excfirstcore
-                    , exclastcore
-                    , pnodeConfig );
-    }
-    else if ( rc == SQLITE_DONE )
-    {
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d Finished processing logical nodes.\n",
-                         method_name, __LINE__);
-        }
-    }
-    else
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetPNode( const char *name
-                         , physical_node_configuration_t &pnodeConfig )
-{
-    const char method_name[] = "CTcdbSqlite::GetPNode";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int  rc;
-    int  excfirstcore = -1;
-    int  exclastcore = -1;
-    int  pnid = -1;
-    const char   *nodename = NULL;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    // Prepare select logical nodes
-    sqlStmt = "select p.pNid, p.nodeName, p.excFirstCore, p.excLastCore"
-                   "  from pnode p where p.nodeName = ?";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-        
-    rc = sqlite3_bind_text( prepStmt, 1, name, -1, SQLITE_STATIC );
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] sqlite3_bind_text(name) failed, error: %s\n"
-                , method_name,  sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    rc = sqlite3_step( prepStmt );
-    if ( rc == SQLITE_ROW )
-    {  // Process row
-        int colCount = sqlite3_column_count(prepStmt);
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d sqlite3_column_count=%d\n",
-                         method_name, __LINE__, colCount);
-            for (int i=0; i<colCount; ++i)
-            {
-                trace_printf("%s@%d column %d is %s\n",
-                             method_name, __LINE__, i,
-                             sqlite3_column_name(prepStmt, i));
-            }
-        }
-
-        pnid = sqlite3_column_int(prepStmt, 0);
-        nodename = (const char *) sqlite3_column_text(prepStmt, 1);
-        excfirstcore = sqlite3_column_int(prepStmt, 2);
-        exclastcore = sqlite3_column_int(prepStmt, 3);
-        SetPNodeData( pnid
-                    , nodename
-                    , excfirstcore
-                    , exclastcore
-                    , pnodeConfig );
-    }
-    else if ( rc == SQLITE_DONE )
-    {
-        if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d Finished processing logical nodes.\n",
-                         method_name, __LINE__);
-        }
-    }
-    else
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetSNodes( int &count
-                          , int max
-                          , physical_node_configuration_t spareNodeConfig[] )
-{
-    const char method_name[] = "CTcdbSqlite::GetSNodes";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    int  rc;
-    int  pnid = -1;
-    int  excfirstcore = -1;
-    int  exclastcore = -1;
-    int  snodeCount = 0;
-    const char   *nodename = NULL;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    // Prepare select spare nodes
-    sqlStmt = "select p.pNid, p.nodeName, p.excFirstCore, p.excLastCore,"
-              " s.spNid "
-              "  from pnode p, snode s where p.pNid = s.pNid";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    count = snodeCount;
-
-    // Process spare nodes
-    while ( 1 )
-    {
-        rc = sqlite3_step( prepStmt );
-        if ( rc == SQLITE_ROW )
-        {  // Process row
-            if ( max == 0 )
-            {
-                snodeCount++;
-                continue;
-            }
-
-            int colCount = sqlite3_column_count(prepStmt);
-            if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d sqlite3_column_count=%d\n",
-                             method_name, __LINE__, colCount);
-                for (int i=0; i<colCount; ++i)
-                {
-                    trace_printf("%s@%d column %d is %s\n",
-                                 method_name, __LINE__, i,
-                                 sqlite3_column_name(prepStmt, i));
-                }
-            }
-
-            if ( snodeCount < max )
-            {
-                pnid = sqlite3_column_int(prepStmt, 0);
-                nodename = (const char *) sqlite3_column_text(prepStmt, 1);
-                excfirstcore = sqlite3_column_int(prepStmt, 2);
-                exclastcore = sqlite3_column_int(prepStmt, 3);
-                if ( ! GetSNodeData( pnid
-                                   , nodename
-                                   , excfirstcore
-                                   , exclastcore
-                                   , spareNodeConfig[snodeCount] ) )
-                {
-                    char buf[TC_LOG_BUF_SIZE];
-                    snprintf( buf, sizeof(buf)
-                            , "[%s], Error: Invalid node configuration\n"
-                            , method_name);
-                    TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-                    if ( prepStmt != NULL )
-                    {
-                        sqlite3_finalize( prepStmt );
-                    }
-                    TRACE_EXIT;
-                    return( TCDBOPERROR );
-                }
-                snodeCount++;
-            }
-            else
-            {
-                count = snodeCount;
-                if ( prepStmt != NULL )
-                {
-                    sqlite3_finalize( prepStmt );
-                }
-                TRACE_EXIT;
-                return( TCDBTRUNCATE );
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            count = snodeCount;
-            if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d Finished processing spare nodes.\n",
-                             method_name, __LINE__);
-            }
-            break;
-        }
-        else
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, error: %s\n"
-                    , method_name, sqlStmt, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetSNodeData( int pnid
-                             , const char *nodename
-                             , int excfirstcore
-                             , int exclastcore 
-                             , physical_node_configuration_t &spareNodeConfig )
-{
-    const char method_name[] = "CTcdbSqlite::GetSNodeData";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int  rc;
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-    {
-        trace_printf( "%s@%d pnid=%d, name=%s, excluded cores=(%d:%d)\n"
-                    , method_name, __LINE__
-                    , pnid
-                    , nodename
-                    , excfirstcore
-                    , exclastcore );
-    }
-
-    spareNodeConfig.pnid = pnid;
-    strncpy( spareNodeConfig.node_name
-           , nodename
-           , sizeof(spareNodeConfig.node_name) );
-    spareNodeConfig.excluded_first_core = excfirstcore;
-    spareNodeConfig.excluded_last_core = exclastcore;
-
-    // Select all spared nodes configured for this spare node
-    sqlStmt = "select p.pNid, s.spNid"
-              "  from pnode p, snode s"
-              "    where p.pNid = s.pNid and p.pNid = ?";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {   // Set pnid in prepared statement
-        rc = sqlite3_bind_int(prepStmt, 1, pnid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(pnid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    int  spnid;
-    int  sparedpnid;
-    int  spareCount = 0;
-
-    // Process spare nodes
-    while ( 1 )
-    {
-        rc = sqlite3_step( prepStmt );
-        if ( rc == SQLITE_ROW )
-        {  // Process row
-            int colCount = sqlite3_column_count(prepStmt);
-            if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d sqlite3_column_count=%d\n",
-                             method_name, __LINE__, colCount);
-                for (int i=0; i<colCount; ++i)
-                {
-                    trace_printf("%s@%d column %d is %s\n",
-                                 method_name, __LINE__, i,
-                                 sqlite3_column_name(prepStmt, i));
-                }
-            }
-
-            spnid = sqlite3_column_int(prepStmt, 0);
-            sparedpnid = sqlite3_column_int(prepStmt, 1);
-            spareNodeConfig.spare_pnid[spareCount] = sparedpnid;
-            spareCount++;
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            spareNodeConfig.spare_count = spareCount;
-            if ( TcTraceSettings & (TC_TRACE_NODE | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d Finished processing spared node set.\n",
-                             method_name, __LINE__);
-            }
-            break;
-        }
-        else
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, error: %s\n"
-                    , method_name, sqlStmt, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetPersistProcess( const char *persistPrefix
-                                  , persist_configuration_t &persistConfig )
-{
-    const char method_name[] = "CTcdbSqlite::GetPersistProcess";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int  rc, rs;
-    char param[TC_PERSIST_KEY_MAX];
-    const char   *persistKey;
-    const char   *persistValue;
-    const char   *sqlStmtStmt;
-    sqlite3_stmt *prepStmt = NULL;
-
-    if ( TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST) )
-    {
-        trace_printf( "%s@%d processkey=%s\n"
-                    , method_name, __LINE__
-                    , persistPrefix );
-    }
-    
-    strncpy( persistConfig.persist_prefix
-           , persistPrefix
-           , sizeof(persistConfig.persist_prefix) );
-
-    snprintf( param, sizeof(param), "%s_%%", persistPrefix );
-
-    // Prepare select persistent process for the key
-    sqlStmtStmt = "select p.keyName, p.valueName"
-                     " from monRegPersistData p"
-                     "  where p.keyName like ?";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmtStmt
-                           , strlen(sqlStmtStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmtStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {   // Set key in prepared statement
-        rc = sqlite3_bind_text( prepStmt, 1, param, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(keyName) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    while ( 1 )
-    {
-        rc = sqlite3_step( prepStmt );
-        if ( rc == SQLITE_ROW )
-        {  // Process row
-            int colCount = sqlite3_column_count(prepStmt);
-            if ( TcTraceSettings & (TC_TRACE_PERSIST | TC_TRACE_REQUEST) )
-            {
-                trace_printf( "%s@%d sqlite3_column_count=%d\n"
-                            , method_name, __LINE__, colCount);
-                for (int i=0; i<colCount; ++i)
-                {
-                    trace_printf("%s@%d column %d is %s\n",
-                                 method_name, __LINE__, i,
-                                 sqlite3_column_name(prepStmt, i));
-                }
-            }
-
-            persistKey = (const char *) sqlite3_column_text(prepStmt, 0);
-            persistValue = (const char *) sqlite3_column_text(prepStmt, 1);
-
-            if ( TcTraceSettings & (TC_TRACE_PERSIST | TC_TRACE_REQUEST) )
-            {
-                trace_printf( "%s@%d monRegPersistData key=%s, value=%s\n"
-                            , method_name, __LINE__, persistKey, persistValue);
-            }
-
-            // Parse the value based on the key
-            rs = SetPersistProcessData( persistKey
-                                      , persistValue
-                                      , persistConfig );
-            if ( rs != TCSUCCESS )
-            {
-                char buf[TC_LOG_BUF_SIZE];
-                snprintf( buf, sizeof(buf)
-                        , "[%s], Error: Invalid persist key value in "
-                          "configuration, key=%s, value=%s\n"
-                        , method_name, persistKey, persistValue );
-                TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-                if ( prepStmt != NULL )
-                {
-                    sqlite3_finalize( prepStmt );
-                }
-                TRACE_EXIT;
-                return( TCDBOPERROR );
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            if ( TcTraceSettings & (TC_TRACE_PERSIST | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d Finished processing all rows.\n",
-                             method_name, __LINE__);
-            }
-            break;
-        }
-        else
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, error: %s\n"
-                    , method_name, sqlStmtStmt, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetPersistProcessKeys( const char *persistProcessKeys )
-{
-    const char method_name[] = "CTcdbSqlite::GetPersistProcessKeys";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-
-    int  rc;
-
-    const char   *sqlStmt;
-    sqlite3_stmt *prepStmt = NULL;
-    sqlStmt = "select p.valueName"
-              " from monRegPersistData p"
-              "  where p.keyName = 'PERSIST_PROCESS_KEYS'";
-
-    rc = sqlite3_prepare_v2( db_
-                           , sqlStmt
-                           , strlen(sqlStmt)+1
-                           , &prepStmt
-                           , NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    // Process persistent process keys
-    rc = sqlite3_step( prepStmt );
-    if ( rc == SQLITE_ROW )
-    {  // Process row
-        int colCount = sqlite3_column_count(prepStmt);
-
-        if ( TcTraceSettings & (TC_TRACE_PERSIST | TC_TRACE_REQUEST) )
-        {
-            trace_printf("%s@%d sqlite3_column_count=%d\n",
-                         method_name, __LINE__, colCount);
-            for (int i=0; i<colCount; ++i)
-            {
-                trace_printf("%s@%d column %d is %s\n",
-                             method_name, __LINE__, i,
-                             sqlite3_column_name(prepStmt, i));
-            }
-        }
-
-        const unsigned char *value;
-
-        value = sqlite3_column_text(prepStmt, 0);
-        strncpy( (char *)persistProcessKeys, (const char *)value, TC_PERSIST_KEYS_VALUE_MAX );
-    
-    }
-    else if ( rc == SQLITE_DONE )
-    {
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBNOEXIST );
-    }
-    else
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-        if ( prepStmt != NULL )
-        {
-            sqlite3_finalize( prepStmt );
-        }
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetRegistryClusterSet( int &count
-                                      , int max
-                                      , registry_configuration_t registryConfig[] )
-{
-    const char method_name[] = "CTcdbSqlite::GetRegistryClusterSet";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int rc;
-    const unsigned char *group;
-    const unsigned char *key;
-    const unsigned char *value;
-    int entryNum = 0;
-
-    count = 0;
-
-    if ( db_ == NULL )
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf("%s@%d cannot initialize registry from database "
-                         "since database open failed.\n", method_name,
-                         __LINE__);
-        }
-
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    // Read cluster configuration registry entries and populate in-memory
-    // structures.
-    const char *sqlStmt;
-    sqlStmt = "select k.keyName, d.dataValue "
-              " from monRegKeyName k, monRegClusterData d "
-              " where k.keyId = d.keyId";
-    sqlite3_stmt *prepStmt;
-
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt, NULL);
-    if( rc!=SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    while ( 1 )
-    {
-        rc = sqlite3_step(prepStmt);
-        if ( rc == SQLITE_ROW )
-        {  // Process row
-            if ( max == 0 )
-            {
-                ++entryNum;
-                continue;
-            }
-
-            if ( entryNum < max )
-            {
-                group = (const unsigned char *) "CLUSTER";
-                key = sqlite3_column_text(prepStmt, 0);
-                value = sqlite3_column_text(prepStmt, 1);
-                if ( TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST) )
-                {
-                    trace_printf( "%s@%d entry %d: group=%s key=%s, value=%s\n"
-                                , method_name, __LINE__
-                                , entryNum, group, key, value);
-                }
-                strncpy( registryConfig[entryNum].scope, (const char *)group, TC_REGISTRY_KEY_MAX );
-                strncpy( registryConfig[entryNum].key, (const char *)key, TC_REGISTRY_KEY_MAX );
-                strncpy( registryConfig[entryNum].value, (const char *)value, TC_REGISTRY_VALUE_MAX );
-                ++entryNum;
-            }
-            else
-            {
-                count = entryNum;
-                if ( prepStmt != NULL )
-                {
-                    sqlite3_finalize( prepStmt );
-                }
-                TRACE_EXIT;
-                return( TCDBTRUNCATE );
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            count = entryNum;
-            break;
-        }
-        else
-        { 
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, error: %s\n"
-                    , method_name, sqlStmt, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    count =entryNum;
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetRegistryProcessSet( int &count
-                                      , int max
-                                      , registry_configuration_t registryConfig[] )
-{
-    const char method_name[] = "CTcdbSqlite::GetRegistryProcessSet";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int rc;
-    const unsigned char *group;
-    const unsigned char *key;
-    const unsigned char *value;
-    int entryNum = 0;
-
-    count = 0;
-
-    if ( db_ == NULL )
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf("%s@%d cannot initialize registry from database "
-                         "since database open failed.\n", method_name,
-                         __LINE__);
-        }
-
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-
-    // Read process configuration registry entries and populate in-memory
-    // structures.
-    const char *sqlStmt;
-    sqlStmt = "select p.procName, k.keyName, d.dataValue"
-              " from monRegProcName p, monRegKeyName k, monRegProcData d"
-              " where p.procId = d.procId"
-              "   and k.keyId = d.keyId";
-    sqlite3_stmt *prepStmt;
-
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt, NULL);
-    if( rc!=SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-
-    while ( 1 )
-    {
-        rc = sqlite3_step(prepStmt);
-        if ( rc == SQLITE_ROW )
-        {  // Process row
-            if ( max == 0 )
-            {
-                ++entryNum;
-                continue;
-            }
-
-            if ( entryNum < max )
-            {
-                group = sqlite3_column_text(prepStmt, 0);
-                key = sqlite3_column_text(prepStmt, 1);
-                value = sqlite3_column_text(prepStmt, 2);
-                if ( TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST) )
-                {
-                    trace_printf( "%s@%d entry %d: group=%s key=%s, value=%s\n"
-                                , method_name, __LINE__
-                                , entryNum, group, key, value);
-                }
-                strncpy( registryConfig[entryNum].scope, (const char *)group, TC_REGISTRY_KEY_MAX );
-                strncpy( registryConfig[entryNum].key, (const char *)key, TC_REGISTRY_KEY_MAX );
-                strncpy( registryConfig[entryNum].value, (const char *)value, TC_REGISTRY_VALUE_MAX );
-                ++entryNum;
-                //
-            }
-            else
-            {
-                count = entryNum;
-                // Destroy prepared statement object
-                if ( prepStmt != NULL )
-                {
-                    sqlite3_finalize( prepStmt );
-                }
-                TRACE_EXIT;
-                return( TCDBTRUNCATE );
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            count = entryNum;
-            break;
-        }
-        else
-        { 
-            if ( TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST) )
-            {
-                trace_printf("%s@%d step failed, retrieving process registry"
-                             " data, error=%s (%d)\n",
-                             method_name, __LINE__, sqlite3_errmsg(db_), rc);
-            }
-
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, error: %s\n"
-                    , method_name, sqlStmt, sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetUniqueString( int nid, int id, const char *uniqStr )
-{
-    const char method_name[] = "CTcdbSqlite::GetUniqueString";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int rc;
-    const char *sqlStmt;
-    sqlite3_stmt *prepStmt;
-
-    // Read process configuration registry entries and populate in-memory
-    // structures.
-    sqlStmt = "select dataValue from monRegUniqueStrings where nid = ? and id = ?";
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt, NULL);
-
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int ( prepStmt, 1, nid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(nid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_int ( prepStmt, 2, id );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(id) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-
-        if ( rc == SQLITE_ROW )
-        {
-            const unsigned char *value;
-    
-            value = sqlite3_column_text(prepStmt, 0);
-            strncpy( (char *)uniqStr, (const char *)value, TC_UNIQUE_STRING_VALUE_MAX );
-
-            if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-            {
-                trace_printf("%s@%d retrieved unique string (%d, %d), "
-                             "value=%s\n", method_name, __LINE__,
-                             nid, id, uniqStr);
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBNOEXIST );
-        }
-        else
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, nid=%d, id=%d, error: %s\n"
-                    , method_name, sqlStmt, nid, id,sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-    
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetUniqueStringId( int nid
-                                  , const char *uniqStr
-                                  , int &id )
-{
-    const char method_name[] = "CTcdbSqlite::GetUniqueStringId";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-    {
-        trace_printf( "%s@%d Getting unique string id: nid=%d string=%s\n"
-                    , method_name, __LINE__, nid, uniqStr);
-    }
-
-    int rc;
-    const char * sqlStmt;
-    sqlStmt = "select id from monRegUniqueStrings where nid = ? and dataValue = ?";
-
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int( prepStmt, 1, nid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(nid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-        rc = sqlite3_bind_text( prepStmt, 2, uniqStr, -1, SQLITE_STATIC );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] sqlite3_bind_text(uniqStr) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-
-        if ( rc == SQLITE_ROW )
-        {   // Found string in database, return id
-            id = sqlite3_column_int (prepStmt, 0);
-
-            if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST))
-            {
-                trace_printf("%s@%d found unique string id: nid=%d, id=%d\n",
-                             method_name, __LINE__, nid, id);
-            }
-        }
-        else if ( rc == SQLITE_DONE )
-        {
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBNOEXIST );
-        }
-        else
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf)
-                    , "[%s] (%s) failed, nid=%d, id=%d, error: %s\n"
-                    , method_name, sqlStmt, nid, id,sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-    }
-
-    if ( prepStmt != NULL )
-    {
-        sqlite3_finalize( prepStmt );
-    }
-    TRACE_EXIT;
-    return( TCSUCCESS );
-}
-
-int CTcdbSqlite::GetUniqueStringIdMax( int nid, int &id )
-{
-    const char method_name[] = "CTcdbSqlite::GetUniqueStringIdMax";
-    TRACE_ENTRY;
-
-    if ( !IsInitialized() )  
-    {
-        if (TcTraceSettings & (TC_TRACE_REGISTRY | TC_TRACE_REQUEST | TC_TRACE_INIT))
-        {
-            trace_printf( "%s@%d Database is not initialized for access!\n"
-                        , method_name, __LINE__);
-        }
-        TRACE_EXIT;
-        return( TCNOTINIT );
-    }
-    
-    int result = 0;
-    int rc;
-    const char *sqlStmt;
-    sqlStmt = "select max(id) from monRegUniqueStrings where nid=?";
-
-    sqlite3_stmt * prepStmt;
-    rc = sqlite3_prepare_v2( db_, sqlStmt, strlen(sqlStmt)+1, &prepStmt,
-                             NULL);
-    if ( rc != SQLITE_OK )
-    {
-        char buf[TC_LOG_BUF_SIZE];
-        snprintf( buf, sizeof(buf)
-                , "[%s] prepare (%s) failed, error: %s\n"
-                , method_name, sqlStmt, sqlite3_errmsg(db_) );
-        TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_ERR, buf );
-        TRACE_EXIT;
-        return( TCDBOPERROR );
-    }
-    else
-    {
-        rc = sqlite3_bind_int( prepStmt, 1, nid );
-        if ( rc != SQLITE_OK )
-        {
-            char buf[TC_LOG_BUF_SIZE];
-            snprintf( buf, sizeof(buf),
-                      "[%s] sqlite3_bind_int(nid) failed, error: %s\n"
-                    , method_name,  sqlite3_errmsg(db_) );
-            TcLogWrite( SQLITE_DB_ACCESS_ERROR, TC_LOG_CRIT, buf );
-            if ( prepStmt != NULL )
-            {
-                sqlite3_finalize( prepStmt );
-            }
-            TRACE_EXIT;
-            return( TCDBOPERROR );
-        }
-
-        rc = sqlite3_step( prepStmt );
-
-    

<TRUNCATED>

Mime
View raw message