Show
Ignore:
Timestamp:
03/09/08 16:31:37 (2 years ago)
Author:
ahu
Message:

Norbert sends:
Here's an update for the OpenDBX backend:
- Fix for SQLite2/3 locking problem on concurrent reads/writes
- Fixes compilation on Solaris (u_int vs. uint)
- Support for autoserial (needs triggers)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/modules/opendbxbackend/odbxprivate.cc

    r1024 r1154  
    1919                odbx_finish( m_handle[type] ); 
    2020                m_handle[type] = NULL; 
     21        } 
     22 
     23        if( type == WRITE && getArg( "backend" ) == "sqlite" ) 
     24        { 
     25                L.log( m_myname + " Using same SQLite connection for reading and writeing to '" + hosts[odbx_host_index[READ]] + "'", Logger::Notice ); 
     26                m_handle[WRITE] = m_handle[READ]; 
     27                return true; 
    2128        } 
    2229 
     
    157164 
    158165 
    159 bool OdbxBackend::getDomainList( const string& stmt, vector<DomainInfo>* list, bool (*check_fcn)(u_int32_t,u_int32_t,SOAData*,DomainInfo*) ) 
     166bool OdbxBackend::getDomainList( const string& stmt, vector<DomainInfo>* list, bool (*check_fcn)(uint32_t,uint32_t,SOAData*,DomainInfo*) ) 
    160167{ 
    161168        const char* tmp; 
    162         u_int32_t nlast, nserial; 
     169        uint32_t nlast, nserial; 
    163170        DomainInfo di; 
    164171        SOAData sd; 
     
    189196                if( ( tmp = odbx_field_value( m_result, 4 ) ) != NULL ) 
    190197                { 
     198                        nserial = strtol( tmp, NULL, 10 ); 
     199                } 
     200 
     201                if( ( tmp = odbx_field_value( m_result, 3 ) ) != NULL ) 
     202                { 
    191203                        nlast = strtol( tmp, NULL, 10 ); 
    192                 } 
    193  
    194                 if( ( tmp = odbx_field_value( m_result, 3 ) ) != NULL ) 
    195                 { 
    196                         nserial = strtol( tmp, NULL, 10 ); 
    197204                } 
    198205 
     
    229236 
    230237 
    231 bool checkSlave( u_int32_t nlast, u_int32_t nserial, SOAData* sd, DomainInfo* di ) 
    232 { 
    233         if( nlast + sd->refresh < (u_int32_t) time( 0 ) ) 
     238bool checkSlave( uint32_t nlast, uint32_t nserial, SOAData* sd, DomainInfo* di ) 
     239{ 
     240        if( nlast + sd->refresh < (uint32_t) time( 0 ) ) 
    234241        { 
    235242                di->kind = DomainInfo::Slave; 
     
    242249 
    243250 
    244 bool checkMaster( u_int32_t nlast, u_int32_t nserial, SOAData* sd, DomainInfo* di ) 
     251bool checkMaster( uint32_t nlast, uint32_t nserial, SOAData* sd, DomainInfo* di ) 
    245252{ 
    246253        if( nserial != sd->serial )