| 751 | } |
| 752 | |
| 753 | uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int id_parent, int type) |
| 754 | { |
| 755 | int ohfi; |
| 756 | //QImage img; |
| 757 | uint date_created; |
| 758 | int width, height, file_format, photo_codec; |
| 759 | |
| 760 | int cma_file_type = checkFileType(name, VITA_OHFI_PHOTO); |
| 761 | if(cma_file_type < 0) { |
| 762 | //qDebug() << "Excluding from database:" << path; |
| 763 | return 0; |
| 764 | } |
| 765 | |
| 766 | //if(!img.load(path + "/" + name)) { |
| 767 | // return 0; |
| 768 | //} |
| 769 | |
| 770 | QDateTime date = QFileInfo(path + "/" + name).birthTime(); |
| 771 | date_created = date.toUTC().toSecsSinceEpoch(); |
| 772 | QString month_created = date.toString("yyyy/MM"); |
| 773 | |
| 774 | width = 0; //img.width(); |
| 775 | height = 0; //img.height(); |
| 776 | file_format = 0; //photo_list[cma_file_type].file_format; |
| 777 | photo_codec = 0; //photo_list[cma_file_type].file_codec; |
| 778 | |
| 779 | QByteArray basename = QFileInfo(name).baseName().toUtf8(); |
| 780 | |
| 781 | if((ohfi = insertDefaultEntry(path, name, basename, id_parent, type)) == 0) { |
| 782 | return 0; |
| 783 | } |
| 784 | |
| 785 | QSqlQuery query; |
| 786 | query.prepare("REPLACE INTO photos" |
| 787 | "(object_id, date_created, file_format, photo_codec, width, height, month_created)" |
| 788 | "VALUES (:object_id, :date_created, :file_format, :photo_codec, :width, :height, :month_created)"); |
| 789 | |
| 790 | query.bindValue(0, ohfi); |
| 791 | query.bindValue(1, date_created); |
| 792 | query.bindValue(2, file_format); |
| 793 | query.bindValue(3, photo_codec); |
| 794 | query.bindValue(4, width); |
| 795 | query.bindValue(5, height); |
| 796 | query.bindValue(6, month_created); |
| 797 | |
| 798 | if(!query.exec()) { |
| 799 | return 0; |
| 800 | } |
| 801 | |
| 802 | return ohfi; |
| 803 | } |
| 804 | |
| 805 | uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int id_parent, int type) |
| 806 | { |
nothing calls this directly
no outgoing calls
no test coverage detected