Difference between revisions of "A, An, The"

From LinuxMCE
Jump to: navigation, search
(Created page with "== SQL Query == sql Query, needs work. string sSQL_Sort = "SELECT PK_Attribute,CASE WHEN SUBSTRING_INDEX(Name, ' ', 1) IN ('a','an','the') THEN CONCAT(SUBSTRING(Name, I...")
 
 
Line 1: Line 1:
 
== SQL Query ==
 
== SQL Query ==
 +
 +
void Media_Plugin::PopulateFileBrowserInfoForAttribute(MediaListGrid *pMediaListGrid,int PK_AttributeType_Sort, int PK_Attribute, string &sPK_File_Or_Disc,string sTable)
  
 
sql Query, needs work.
 
sql Query, needs work.

Latest revision as of 03:50, 10 June 2013

SQL Query

void Media_Plugin::PopulateFileBrowserInfoForAttribute(MediaListGrid *pMediaListGrid,int PK_AttributeType_Sort, int PK_Attribute, string &sPK_File_Or_Disc,string sTable)

sql Query, needs work.

       string sSQL_Sort = "SELECT PK_Attribute,CASE WHEN SUBSTRING_INDEX(Name, ' ', 1) IN ('a','an','the') THEN CONCAT(SUBSTRING(Name, INSTR(Name, ' ')+1), ', ', SUBSTRING_INDEX(Name, ' ',1)) ELSE Name END AS Name,min(FK_Picture) AS FK_Picture FROM " + sTable + " JOIN " +
               sTable + "_Attribute ON FK_" + sTable + "=PK_" + sTable + " JOIN Attribute ON " +
               sTable + "_Attribute.FK_Attribute=PK_Attribute AND FK_AttributeType=" + StringUtils::itos(PK_AttributeType_Sort) +
               " LEFT JOIN Picture_Attribute ON Picture_Attribute.FK_Attribute=PK_Attribute WHERE " +
               (sTable=="File" ? "IsDirectory=0 AND " : "") +
               "PK_" + sTable + " in (" + sPK_File_Or_Disc + ") GROUP BY PK_Attribute,IF(SUBSTRING(Name,1,4)='The ',SUBSTRING(Name,5),Name)";