張貼日期:Mar 10, 2016 5:7:34 AM
找到這一段 SQL, 可以把Gallery2中的相本目錄名稱 查詢出來
SELECT `g2_Item`.`g_id`,`g2_Item`.`g_title`,`g2_FileSystemEntity`.`g_pathComponent`,`g2_ItemAttributesMap`.`g_parentSequence` FROM `g2_Item` left join g2_ItemAttributesMap on (g2_Item.g_id = g2_ItemAttributesMap.g_itemId ) left join g2_FileSystemEntity on (g2_Item.g_id = g2_FileSystemEntity.g_id ) WHERE `g_canContainChildren` = 1
接著利用 mysql直接下指令
SELECT `g2_Item`.`g_id`,`g2_Item`.`g_title`,`g2_FileSystemEntity`.`g_pathComponent`,`g2_ItemAttributesMap`.`g_parentSequence` into outfile 'abc.txt' FROM `g2_Item` left join g2_ItemAttributesMap on (g2_Item.g_id = g2_ItemAttributesMap.g_itemId ) left join g2_FileSystemEntity on (g2_Item.g_id = g2_FileSystemEntity.g_id ) WHERE `g_canContainChildren` = 1;
這樣可以在 /var/lib/mysql/Gallery2/ 下面匯出 查詢結果 abc.txt 檔案
參考資料來源