diff --git a/ChangeLog b/ChangeLog index 113c7ea4..36184c2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25025,3 +25025,6 @@ * Fixed a bug in the 'Edit Audio' dialog in rdlibrary(1) that caused a marker to be removed from the view if it was dragged beyond the left hand edge of the view. +2025-07-05 Fred Gleason + * Fixed a bug in rdadmin(1) that thew a SQL error when creating + a new Host record. diff --git a/lib/rdairplay_conf.cpp b/lib/rdairplay_conf.cpp index 656e8419..dbd56867 100644 --- a/lib/rdairplay_conf.cpp +++ b/lib/rdairplay_conf.cpp @@ -37,18 +37,14 @@ RDAirPlayConf::RDAirPlayConf(const QString &station,const QString &tablename) sql=QString("select `ID` from `")+air_tablename+"` where "+ "`STATION`='"+RDEscapeString(air_station)+"'"; q=new RDSqlQuery(sql); - if(!q->first()) { - delete q; - sql=QString("insert into `")+air_tablename+"` set "+ - "`STATION`='"+RDEscapeString(air_station)+"'"; - q=new RDSqlQuery(sql); - delete q; - sql=QString("select `ID` from `")+air_tablename+"` where "+ - "`STATION`='"+RDEscapeString(air_station)+"'"; - q=new RDSqlQuery(sql); - q->first(); + if(q->first()) { + air_id=q->value(0).toUInt(); + } + else { + air_id=-1; + fprintf(stderr,"RDAirplayConf - no STATION record found for host \"%s\"\n", + air_station.toUtf8().constData()); } - air_id=q->value(0).toUInt(); delete q; }