2018-07-19 Fred Gleason <fredg@paravelsystems.com>

* Cleaned up SQL quieries in 'web/rdcastmanager/' to ensure UTF-8
	compatibility.
This commit is contained in:
Fred Gleason 2018-07-19 14:51:07 +00:00
parent 604648a7e4
commit 6a5563f3e7
2 changed files with 35 additions and 41 deletions

View File

@ -17178,3 +17178,6 @@
2018-07-19 Fred Gleason <fredg@paravelsystems.com> 2018-07-19 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up SQL quieries in 'utils/rdpurgecasts/' to ensure UTF-8 * Cleaned up SQL quieries in 'utils/rdpurgecasts/' to ensure UTF-8
compatibility. compatibility.
2018-07-19 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up SQL quieries in 'web/rdcastmanager/' to ensure UTF-8
compatibility.

View File

@ -341,17 +341,16 @@ void MainObject::ServeListFeeds()
line_colors[1]=RD_WEB_LINE_COLOR2; line_colors[1]=RD_WEB_LINE_COLOR2;
int current_color=0; int current_color=0;
sql=QString().sprintf("select FEED_PERMS.KEY_NAME from \ sql=QString("select ")+
FEED_PERMS left join WEB_CONNECTIONS \ "FEED_PERMS.KEY_NAME "+ // 00
on(FEED_PERMS.USER_NAME=WEB_CONNECTIONS.LOGIN_NAME) \ "from FEED_PERMS left join WEB_CONNECTIONS "+
where WEB_CONNECTIONS.SESSION_ID=%ld", "on(FEED_PERMS.USER_NAME=WEB_CONNECTIONS.LOGIN_NAME) where "+
cast_session_id); QString().sprintf("WEB_CONNECTIONS.SESSION_ID=%ld",cast_session_id);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
sql=QString().sprintf("select ID,KEY_NAME,CHANNEL_TITLE from FEEDS \ sql=QString().sprintf("select ID,KEY_NAME,CHANNEL_TITLE from FEEDS \
where "); where ");
while(q->next()) { while(q->next()) {
sql+=QString().sprintf("(KEY_NAME=\"%s\")||", sql+=QString("(KEY_NAME=\"")+RDEscapeString(q->value(0).toString())+"\")||";
(const char *)q->value(0).toString());
} }
delete q; delete q;
if(sql.right(2)=="||") { if(sql.right(2)=="||") {
@ -362,8 +361,8 @@ void MainObject::ServeListFeeds()
total=0; total=0;
active=0; active=0;
printf("<tr>\n"); printf("<tr>\n");
sql=QString().sprintf("select STATUS from PODCASTS where FEED_ID=%u", sql=QString("select STATUS from PODCASTS where ")+
q->value(0).toUInt()); QString().sprintf("FEED_ID=%u",q->value(0).toUInt());
q1=new RDSqlQuery(sql); q1=new RDSqlQuery(sql);
while(q1->next()) { while(q1->next()) {
total++; total++;
@ -1127,10 +1126,12 @@ void MainObject::ServePlay()
Exit(0); Exit(0);
} }
sql=QString().sprintf("select FEEDS.BASE_URL,PODCASTS.AUDIO_FILENAME \ sql=QString("select ")+
from FEEDS left join PODCASTS \ "FEEDS.BASE_URL,"+ // 00
on FEEDS.ID=PODCASTS.FEED_ID \ "PODCASTS.AUDIO_FILENAME "+ // 01
where PODCASTS.ID=%d",cast_cast_id); "from FEEDS left join PODCASTS "+
"on FEEDS.ID=PODCASTS.FEED_ID where "+
QString().sprintf("PODCASTS.ID=%d",cast_cast_id);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
if(q->first()) { if(q->first()) {
printf("Content-type: audio/x-mpeg\n"); printf("Content-type: audio/x-mpeg\n");
@ -1282,37 +1283,27 @@ void MainObject::CommitCast()
QDateTime QDateTime
effective_datetime(QDate(effective_year,effective_month,effective_day), effective_datetime(QDate(effective_year,effective_month,effective_day),
QTime(effective_hour,effective_minute,effective_second)); QTime(effective_hour,effective_minute,effective_second));
sql=QString().sprintf("update PODCASTS set \ sql=QString("update PODCASTS set ")+
STATUS=%d,\ QString().sprintf("STATUS=%d,",status)+
ITEM_TITLE=\"%s\",\ "ITEM_TITLE=\""+RDEscapeString(item_title)+"\","+
ITEM_DESCRIPTION=\"%s\",\ "ITEM_DESCRIPTION=\""+RDEscapeString(item_description)+"\","+
ITEM_CATEGORY=\"%s\",\ "ITEM_CATEGORY=\""+RDEscapeString(item_category)+"\","+
ITEM_LINK=\"%s\",\ "ITEM_LINK=\""+RDEscapeString(item_link)+"\","+
ITEM_COMMENTS=\"%s\",\ "ITEM_COMMENTS=\""+RDEscapeString(item_comments)+"\","+
ITEM_AUTHOR=\"%s\",\ "ITEM_AUTHOR=\""+RDEscapeString(item_author)+"\","+
ITEM_SOURCE_TEXT=\"%s\",\ "ITEM_SOURCE_TEXT=\""+RDEscapeString(item_source_text)+"\","+
ITEM_SOURCE_URL=\"%s\",\ "ITEM_SOURCE_URL=\""+RDEscapeString(item_source_url)+"\","+
SHELF_LIFE=%d,\ QString().sprintf("SHELF_LIFE=%d,",shelf_life)+
EFFECTIVE_DATETIME=%s \ "EFFECTIVE_DATETIME="+
where ID=%d", RDCheckDateTime(RDLocalToUtc(effective_datetime),"yyyy-MM-dd hh:mm:ss")+
status, " where "+
(const char *)RDEscapeString(item_title), QString().sprintf("ID=%d",cast_cast_id);
(const char *)RDEscapeString(item_description),
(const char *)RDEscapeString(item_category),
(const char *)RDEscapeString(item_link),
(const char *)RDEscapeString(item_comments),
(const char *)RDEscapeString(item_author),
(const char *)RDEscapeString(item_source_text),
(const char *)RDEscapeString(item_source_url),
shelf_life,
(const char *)RDCheckDateTime(RDLocalToUtc(effective_datetime),
"yyyy-MM-dd hh:mm:ss"),
cast_cast_id);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
delete q; delete q;
sql=QString().sprintf("update FEEDS set LAST_BUILD_DATETIME=UTC_TIMESTAMP()\ sql=QString("update FEEDS set ")+
where ID=%d",cast_feed_id); "LAST_BUILD_DATETIME=UTC_TIMESTAMP() where "+
QString().sprintf("ID=%d",cast_feed_id);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
delete q; delete q;