def dbhost(mac, ip, hostname):
 source_idx = None
 while (source_idx is None):
  source_idx = fetch('SELECT ROWID FROM host WHERE ip = ?', (ip,))
  if (len(source_idx) > 0):
   insert('UPDATE host SET mac = ?, hostname = ? WHERE ip = ?', (mac, hostname))
   source_idx = None
  else:
   source_idx = insert('INSERT INTO host VALUES (?,?,?);', (mac, ip, hostname))
 return source_idx

def dbhost ( mac , ip , hostname ) : source_idx = None while ( source_idx is None ) : source_idx = fetch ( 'SELECT ROWID FROM host WHERE ip = ?' , ( ip , ) ) if ( len ( source_idx ) > 0 ) : insert ( 'UPDATE host SET mac = ?, hostname = ? WHERE ip = ?' , ( mac , hostname ) ) source_idx = None else : source_idx = insert ( 'INSERT INTO host VALUES (?,?,?);' , ( mac , ip , hostname ) ) return source_idx
insert basic host information into the database .