Skip to content

Commit

Permalink
update includes for jdbc location
Browse files Browse the repository at this point in the history
  • Loading branch information
dogatech committed Jun 25, 2023
1 parent f4773a5 commit b7c57e4
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 55 deletions.
12 changes: 6 additions & 6 deletions be/src/BasicGenreHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
#include <string>
#include <vector>

#include <cppconn/connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/connection.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>
#include <g3log/g3log.hpp>

#include "MysqlAccess.h"


namespace dogatech {
namespace soulsifter {

BasicGenre* BasicGenre::findByFilepath(const string& filepath) {
unsigned long pos = filepath.find("/", 0);
return findByName(filepath.substr(0, pos));
}

void BasicGenre::findAll(const vector<const BasicGenre*>** genresPtr) {
static vector<const BasicGenre*> basicGenres;
for (int i = 0; i < 3; ++i) {
Expand Down Expand Up @@ -83,6 +83,6 @@ namespace soulsifter {
}
LOG(FATAL) << "Unable to complete model operation";
}

}
}
12 changes: 6 additions & 6 deletions be/src/MixHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include "Mix.h"

#include <cppconn/connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/connection.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>
#include <g3log/g3log.hpp>

#include "MysqlAccess.h"
Expand All @@ -19,7 +19,7 @@

namespace dogatech {
namespace soulsifter {

int Mix::mixoutCountForRESongId(int outRESongId) {
for (int i = 0; i < 3; ++i) {
try {
Expand All @@ -32,7 +32,7 @@ namespace soulsifter {
}
rs->close();
delete rs;

return count;
} catch (sql::SQLException &e) {
LOG(WARNING) << "ERROR: SQLException in " << __FILE__ << " (" << __func__<< ") on line " << __LINE__;
Expand All @@ -43,6 +43,6 @@ namespace soulsifter {
}
LOG(FATAL) << "Unable to complete model operation";
}

}
}
6 changes: 3 additions & 3 deletions be/src/RESettingHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include "RESetting.h"

#include <cppconn/connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/connection.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>

#include "MysqlAccess.h"

Expand Down
14 changes: 7 additions & 7 deletions be/src/RESongHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

#include <sstream>

#include <cppconn/connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/connection.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>
#include <g3log/g3log.hpp>

#include "MysqlAccess.h"
#include "Style.h"

namespace dogatech {
namespace soulsifter {

const int RESong::maxREId() {
sql::PreparedStatement *ps = MysqlAccess::getInstance().getPreparedStatement("select max(id) from RESongs");
sql::ResultSet *rs = ps->executeQuery();
Expand All @@ -31,7 +31,7 @@ namespace soulsifter {
delete rs;
return max;
}

void RESong::setStylesBitmaskFromDb() {
sql::PreparedStatement *ps = MysqlAccess::getInstance().getPreparedStatement("select count(*) from Styles");
sql::ResultSet *rs = ps->executeQuery();
Expand All @@ -44,7 +44,7 @@ namespace soulsifter {
}
rs->close();
delete rs;

// this next statement always returns false even though it sets the variable correctly
MysqlAccess::getInstance().getPreparedStatement("set @n=0")->execute();
// the order of the styles in this query needs to be the order they're written out to the RE
Expand All @@ -67,7 +67,7 @@ namespace soulsifter {
}
rs->close();
delete rs;

setStylesBitmask(ss.str());
}
}
Expand Down
12 changes: 6 additions & 6 deletions be/src/ResultSetIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@

#include <vector>

#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>

namespace dogatech {

template <typename T>
class ResultSetIterator {
public:
explicit ResultSetIterator(sql::ResultSet* resultset) : rs(resultset) { }
virtual ~ResultSetIterator() { delete rs; }

bool next(T* obj) {
if (rs->next()) {
T::populateFields(rs, obj);
Expand All @@ -30,7 +30,7 @@ namespace dogatech {
return false;
}
}

std::vector<T*>* toVector() {
std::vector<T*>* v = new std::vector<T*>;
T* obj = new T();
Expand All @@ -42,7 +42,7 @@ namespace dogatech {
delete this;
return v;
}

private:
sql::ResultSet* rs;
ResultSetIterator();
Expand Down
24 changes: 12 additions & 12 deletions be/src/SongHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#include <sstream>

#include <cppconn/connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/connection.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>

#include "Album.h"
#include "AlbumPart.h"
Expand All @@ -24,7 +24,7 @@

namespace dogatech {
namespace soulsifter {

Song::Song(RESong* song) :
id(0),
artist(song->getArtist()),
Expand Down Expand Up @@ -56,7 +56,7 @@ namespace soulsifter {
styles(),
bpmLock(false),
tonicKeyLock(false) {

// styles
vector<Style*>* allStyles;
Style::findAllSortedByREId(&allStyles);
Expand All @@ -66,7 +66,7 @@ namespace soulsifter {
pos = song->getStylesBitmask().find('1', ++pos);
}
while (!allStyles->empty()) delete allStyles->back(), allStyles->pop_back();

// album
album = Album::findByNameAndArtist(song->getAlbum(), song->getArtist());
if (!album) album = new Album();
Expand All @@ -85,30 +85,30 @@ namespace soulsifter {
}
}
}

// basic genre
const BasicGenre *genre = BasicGenre::findByFilepath(song->getFilename());
if (genre)
album->setBasicGenre(*genre);

// date added
dateAdded = timeFromString(song->getDateAdded());

// keys
// TODO tonicKey(<RE KEY TO KEY>);
}

const string Song::reAlbum() {
if (!getAlbum()->getName().empty()) {
return getAlbum()->getName();
} else {
return getTitle();
}
}

const string Song::getDateAddedString() const { return stringFromTime(dateAdded); }
void Song::setDateAddedToNow() { dateAdded = time(0); }

RESong* Song::createRESongFromSong(Song& song) {
RESong* re = new RESong();
re->setId(0);
Expand Down
28 changes: 14 additions & 14 deletions be/src/StyleHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,52 @@

#include "Style.h"

#include <cppconn/connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <jdbc/cppconn/connection.h>
#include <jdbc/cppconn/prepared_statement.h>
#include <jdbc/cppconn/resultset.h>
#include <g3log/g3log.hpp>

#include "MysqlAccess.h"

namespace dogatech {
namespace soulsifter {

# pragma mark helpers

namespace {

struct lessThanKey {
inline bool operator()(const Style* v1, const Style* v2) {
return (*v1) < (*v2);
}
};

struct reIdLessThanKey {
inline bool operator()(const Style* v1, const Style* v2) {
return v1->getREId() < v2->getREId();
}
};

}

# pragma mark operator overrides

bool Style::operator<(const Style& style) const {
return name.compare(style.getName()) < 0;
}

bool Style::operator>(const Style& style) const {
return name.compare(style.getName()) > 0;
}

# pragma mark static methods

void Style::findAllSortedByName(vector<Style*>** stylesPtr) {
vector<Style*>* styles = Style::findAll()->toVector();
sort(styles->begin(), styles->end(), lessThanKey());
(*stylesPtr) = styles;
}

void Style::findAllSortedByREId(vector<Style*>** stylesPtr) {
vector<Style*>* styles = Style::findAll()->toVector();
sort(styles->begin(), styles->end(), reIdLessThanKey());
Expand Down
2 changes: 1 addition & 1 deletion fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "SoulSifter",
"version": "1.4.0",
"description": "DJ & music organization app.",
"build": 2959,
"build": 2967,
"main": "main.js",
"scripts": {
"fe:build": "vite build",
Expand Down

0 comments on commit b7c57e4

Please sign in to comment.