106
106
di.backend = this;
109
if( ( tmp = odbx_field_value( m_result, 0 ) ) != NULL )
111
di.id = strtol( tmp, NULL, 10 );
114
if( ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
116
di.zone = string( tmp, odbx_field_length( m_result, 1 ) );
119
if( ( tmp = odbx_field_value( m_result, 2 ) ) != NULL )
121
if( !strncmp( tmp, "SLAVE", 5 ) )
123
di.kind = DomainInfo::Slave;
125
else if( !strncmp( tmp, "MASTER", 6 ) )
127
di.kind = DomainInfo::Master;
131
if( ( tmp = odbx_field_value( m_result, 3 ) ) != NULL )
133
string masters = string( tmp, odbx_field_length( m_result, 3 ) );
134
stringtok(di.masters, masters, ", \t");
137
if( ( tmp = odbx_field_value( m_result, 5 ) ) != NULL )
139
di.last_check = strtol( tmp, NULL, 10 );
142
109
if( ( tmp = odbx_field_value( m_result, 6 ) ) != NULL )
147
114
fillSOAData( string( tmp, odbx_field_length( m_result, 6 ) ), sd );
116
if( sd.serial == 0 && ( tmp = odbx_field_value( m_result, 5 ) ) != NULL )
118
sd.serial = strtol( tmp, NULL, 10 );
148
121
di.serial = sd.serial;
124
if( ( tmp = odbx_field_value( m_result, 4 ) ) != NULL )
126
di.last_check = strtol( tmp, NULL, 10 );
129
if( ( tmp = odbx_field_value( m_result, 3 ) ) != NULL )
131
stringtok(di.masters, string( tmp, odbx_field_length( m_result, 3 ) ), ", \t");
134
if( ( tmp = odbx_field_value( m_result, 2 ) ) != NULL )
136
if( !strncmp( tmp, "SLAVE", 5 ) )
138
di.kind = DomainInfo::Slave;
140
else if( !strncmp( tmp, "MASTER", 6 ) )
142
di.kind = DomainInfo::Master;
146
if( ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
148
di.zone = string( tmp, odbx_field_length( m_result, 1 ) );
151
if( ( tmp = odbx_field_value( m_result, 0 ) ) != NULL )
153
di.id = strtol( tmp, NULL, 10 );
151
156
while( getRecord( READ ) );
169
bool OdbxBackend::getSOA( const string& domain, SOAData& sd, DNSPacket* p )
176
DLOG( L.log( m_myname + " getSOA()", Logger::Debug ) );
178
string stmt = getArg( "sql-lookupsoa" );
179
string& stmtref = strbind( ":name", escape( toLower( domain ), READ ), stmt );
181
if( !execStmt( stmtref.c_str(), stmtref.size(), READ ) ) { return false; }
182
if( !getRecord( READ ) ) { return false; }
187
sd.ttl = m_default_ttl;
189
if( ( tmp = odbx_field_value( m_result, 3 ) ) != NULL )
191
fillSOAData( string( tmp, odbx_field_length( m_result, 3 ) ), sd );
194
if( ( tmp = odbx_field_value( m_result, 2 ) ) != NULL )
196
sd.ttl = strtoul( tmp, NULL, 10 );
199
if( sd.serial == 0 && ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
201
sd.serial = strtol( tmp, NULL, 10 );
204
if( ( tmp = odbx_field_value( m_result, 0 ) ) != NULL )
206
sd.domain_id = strtol( tmp, NULL, 10 );
209
if( sd.nameserver.empty() )
211
sd.nameserver = arg()["default-soa-name"];
214
if( sd.hostmaster.empty() )
216
sd.hostmaster = "hostmaster." + domain;
221
while( getRecord( READ ) );
223
catch( exception& e )
225
L.log( m_myname + " getSOA: Caught STL exception - " + e.what(), Logger::Error );
164
234
bool OdbxBackend::list( const string& target, int zoneid )