Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msix: add mising .sas7bcat file type association #5773

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions CommonData/databaseinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void DatabaseInterface::upgradeDBFromVersion(Version originalVersion)
transactionWriteEnd();
}

DatabaseInterface::DatabaseInterface(bool createDb)
DatabaseInterface::DatabaseInterface(bool createDb, bool inMemory)
: _inMemory{inMemory}
{
assert(!_singleton);
_singleton = this;
Expand Down Expand Up @@ -1357,7 +1358,13 @@ std::string DatabaseInterface::dbFile(bool onlyName) const
{
JASPTIMER_SCOPE(DatabaseInterface::dbFile);

return onlyName ? "internal.sqlite" : Utils::osPath(TempFiles::sessionDirName() + "/internal.sqlite").string();
static std::string fileName = "internal.sqlite";
static std::string memoryName = ":memory:";

if (_inMemory)
return memoryName;

return onlyName ? fileName : Utils::osPath(TempFiles::sessionDirName() + "/" + fileName).string();
}

void DatabaseInterface::runQuery(const std::string & query, std::function<void(sqlite3_stmt *stmt)> bindParameters, std::function<void(size_t row, sqlite3_stmt *stmt)> processRow)
Expand Down Expand Up @@ -1608,7 +1615,7 @@ void DatabaseInterface::create()
JASPTIMER_SCOPE(DatabaseInterface::create);
assert(!_db);

if(std::filesystem::exists(dbFile()))
if(!_inMemory && std::filesystem::exists(dbFile()))
{
Log::log() << "DatabaseInterface::create: Removing existing sqlite internal db at " << dbFile() << std::endl;
std::filesystem::remove(dbFile());
Expand Down
9 changes: 5 additions & 4 deletions CommonData/databaseinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class DatabaseInterface
public:
typedef std::function<void(sqlite3_stmt *stmt)> bindParametersType;

DatabaseInterface(bool create = false); ///< Creates or loads a sqlite database based on the argument
DatabaseInterface(bool create = false, bool inMemory = false); ///< Creates or loads a sqlite database based on the argument
~DatabaseInterface();
std::string dbFile(bool onlyPostfix=false) const; ///< Convenience function for getting the filename where sqlite db should be
std::string dbFile(bool onlyPostfix = false) const; ///< Convenience function for getting the filename where sqlite db should be

static DatabaseInterface * singleton() { return _singleton; } ///< There can be only one! https://www.youtube.com/watch?v=sqcLjcSloXs

Expand Down Expand Up @@ -166,15 +166,16 @@ class DatabaseInterface
void _runStatements( const std::string & statements, std::function<void(sqlite3_stmt *stmt)> * bindParameters = nullptr, std::function<void(size_t row, sqlite3_stmt *stmt)> * processRow = nullptr); ///< Runs several sql statements without looking at the results. Unless processRow is not NULL, then this is called for each row.
void _runStatementsRepeatedly( const std::string & statements, std::function<bool( std::function<void(sqlite3_stmt *stmt)> ** bindParameters, size_t row)> bindParameterFactory, std::function<void(size_t row, size_t repetition, sqlite3_stmt *stmt)> * processRow = nullptr);

void create(); ///< Creates a new sqlite database in sessiondir and loads it
void load(); ///< Loads a sqlite database from sessiondir (after loading a jaspfile)
void create(); ///< Creates a new sqlite database in sessiondir and loads it
void load(); ///< Loads a sqlite database from sessiondir (after loading a jaspfile)
void close(); ///< Closes the loaded database and disconnects
bool tableHasColumn(const std::string & tableName, const std::string & columnName);

int _transactionWriteDepth = 0,
_transactionReadDepth = 0;

sqlite3 * _db = nullptr;
bool _inMemory = false;

static std::string _wrap_sqlite3_column_text(sqlite3_stmt * stmt, int iCol);
static const std::string _dbConstructionSql;
Expand Down
21 changes: 21 additions & 0 deletions CommonData/dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,24 @@ stringset DataSet::findUsedColumnNames(std::string searchThis)

return columnsFound;
}

bool DataSet::initColumnWithStrings(int colIndex, const std::string & newName, const stringvec &values, const stringvec & labels, const std::string & title, columnType desiredType, const stringset & emptyValues, int threshold, bool orderLabelsByValue)
{
Column * column = columns()[colIndex];
column -> setHasCustomEmptyValues(emptyValues.size());
column -> setCustomEmptyValues(emptyValues);
column -> setName(newName);
column -> setTitle(title);
column -> beginBatchedLabelsDB();
bool anyChanges = title != column->title() || newName != column->name();
columnType prevType = column->type(),
suggestedType = column->setValues(values, labels, threshold, &anyChanges); //If less unique integers than the thresholdScale then we think it must be ordinal: https://github.com/jasp-stats/INTERNAL-jasp/issues/270
column -> setType(column->type() != columnType::unknown ? column->type() : desiredType == columnType::unknown ? suggestedType : desiredType);
column -> endBatchedLabelsDB();

if(orderLabelsByValue)
column->labelsOrderByValue();

return anyChanges || column->type() != prevType;
}

1 change: 1 addition & 0 deletions CommonData/dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class DataSet : public DataSetBaseNode

void loadOldComputedColumnsJson(const Json::Value & json); ///< Should act the same as the old ComputedColumns::fromJson() to allow loading "older jaspfiles"
stringset findUsedColumnNames(std::string searchThis);
bool initColumnWithStrings(int colIndex, const std::string & newName, const stringvec &values, const stringvec & labels, const std::string & title, columnType desiredType, const stringset & emptyValues, int threshold, bool orderLabelsByValue);

DatabaseInterface & db();
const DatabaseInterface & db() const;
Expand Down
5 changes: 1 addition & 4 deletions Desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ target_link_libraries(
Qt::OpenGL
Qt::Widgets
Qt::Qml
$<$<NOT:$<BOOL:${FLATPAK_USED}>>:Qt::WebEngineQuick>
$<$<BOOL:${FLATPAK_USED}>:/app/lib/$ENV{FLATPAK_ARCH}-linux-gnu/libQt6WebEngineQuick.so>
$<$<BOOL:${FLATPAK_USED}>:/app/lib/$ENV{FLATPAK_ARCH}-linux-gnu/libQt6WebEngineCore.so>
$<$<BOOL:${FLATPAK_USED}>:/app/qml/QtWebEngine/libqtwebenginequickplugin.so>
Qt::WebEngineQuick
Qt::WebChannel
Qt::WebChannelQuick
Qt::Svg
Expand Down
22 changes: 4 additions & 18 deletions Desktop/data/datasetpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1488,24 +1488,10 @@ bool DataSetPackage::initColumnWithStrings(QVariant colId, const std::string & n
{
JASPTIMER_SCOPE(DataSetPackage::initColumnWithStrings);

int colIndex = getColIndex(colId),
threshold = Settings::value(Settings::THRESHOLD_SCALE).toInt();
Column * column = _dataSet->columns()[colIndex];
column -> setHasCustomEmptyValues(emptyValues.size());
column -> setCustomEmptyValues(emptyValues);
column -> setName(newName);
column -> setTitle(title);
column -> beginBatchedLabelsDB();
bool anyChanges = title != column->title() || newName != column->name();
columnType prevType = column->type(),
suggestedType = column->setValues(values, labels, threshold, &anyChanges); //If less unique integers than the thresholdScale then we think it must be ordinal: https://github.com/jasp-stats/INTERNAL-jasp/issues/270
column -> setType(column->type() != columnType::unknown ? column->type() : desiredType == columnType::unknown ? suggestedType : desiredType);
column -> endBatchedLabelsDB();

if(PreferencesModel::prefs()->orderByValueByDefault())
column->labelsOrderByValue();

return anyChanges || column->type() != prevType;
return _dataSet->initColumnWithStrings(
getColIndex(colId), newName, values, labels, title, desiredType, emptyValues,
Settings::value(Settings::THRESHOLD_SCALE).toInt(),
PreferencesModel::prefs()->orderByValueByDefault());
}

void DataSetPackage::initializeComputedColumns()
Expand Down
13 changes: 5 additions & 8 deletions Desktop/po/jaspDesktop-de.po
Original file line number Diff line number Diff line change
Expand Up @@ -5205,7 +5205,6 @@ msgctxt "ResizeDataDialog|"
msgid "Rows"
msgstr "Zeilen"

#, fuzzy
msgctxt "ResizeDataDialog|"
msgid "Resize"
msgstr "Größe ändern"
Expand Down Expand Up @@ -5433,7 +5432,6 @@ msgctxt "PrefsResults|"
msgid "PDF Settings"
msgstr "PDF-Einstellungen"

#, fuzzy
msgctxt "PrefsResults|"
msgid "Orientation"
msgstr "Ausrichtung"
Expand All @@ -5450,7 +5448,6 @@ msgctxt "PrefsResults|"
msgid "Page size"
msgstr "Seitengröße"

#, fuzzy
msgctxt "FilterConstructor|"
msgid "Filter cleared\n"
msgstr "Filter gelöscht\n"
Expand All @@ -5471,7 +5468,6 @@ msgstr ""
"Formel gibt keine logischen Werte zurück, und kann darum nicht in dem Filter "
"genutzt werden.\n"

#, fuzzy
msgctxt "FilterConstructor|"
msgid "Welcome to the drag and drop filter!\n"
msgstr "Willkommen zum Ziehen-&-Ablegen-Filter!\n"
Expand Down Expand Up @@ -5504,9 +5500,10 @@ msgstr ""
"Klicken Sie auf das (i)-Symbol in der unteren rechten Ecke für weitere "
"Hilfe.\n"

#, fuzzy
msgctxt "TextInputBase|"
msgid "Column-name-is-free field"
msgstr ""
msgstr "Feld Spaltenname-ist-frei"

#, qt-format
msgctxt "TextInputBase|"
Expand All @@ -5521,14 +5518,14 @@ msgstr "Filter hatte Fehler '%1'"

msgctxt "LabelEditorWindow|"
msgid "Automatically order labels by their value"
msgstr ""
msgstr "Sortiere Bezeichnungen automatisch nach deren Wert"

#, fuzzy, qt-format
#, qt-format
msgctxt "JASPListControl|"
msgid "Minimum number of levels is %1. Variable %2 has only %3 levels"
msgstr "Minimale Anzahl von Stufen ist %1. Variable %2 hat nur %3 Stufen"

#, fuzzy, qt-format
#, qt-format
msgctxt "JASPListControl|"
msgid "Maximum number of levels is %1. Variable %2 has %3 levels."
msgstr "Maximale Anzahl von Stufen ist %1. Die Variable %2 hat %3 Stufen."
Expand Down
9 changes: 2 additions & 7 deletions Desktop/po/jaspDesktop-pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -5269,12 +5269,10 @@ msgid ""
"This setting can always be changed in the Interface Preferences."
msgstr ""

#, fuzzy
msgctxt "MainWindow|"
msgid "Yes"
msgstr "Tak"

#, fuzzy
msgctxt "MainWindow|"
msgid "No"
msgstr "Nie"
Expand All @@ -5284,24 +5282,21 @@ msgctxt "ListModelTermsAssigned|"
msgid "Only %1 variables are allowed"
msgstr ""

#, fuzzy
msgctxt "VariableInfo|"
msgid "Scale"
msgstr "Skala"

#, fuzzy
msgctxt "VariableInfo|"
msgid "Ordinal"
msgstr "Porządkowa"

#, fuzzy
msgctxt "VariableInfo|"
msgid "Nominal"
msgstr "Nominalna"

msgctxt "VariableInfo|"
msgid "Unknown"
msgstr ""
msgstr "Nieznane"

msgctxt "ColumnBasicInfo|"
msgid "<First fill in the column name>"
Expand All @@ -5324,7 +5319,7 @@ msgstr ""

msgctxt "ActionButtons|"
msgid "New"
msgstr ""
msgstr "Nowy"

msgctxt "FileEvent|"
msgid "Importing Excel File"
Expand Down
Loading
Loading