Skip to content

Commit

Permalink
Merge pull request #157 from OP-Engineering/oscar/minor-improvements
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
ospfranco authored Oct 7, 2024
2 parents ee10dca + 73ff14e commit 5254500
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ jobs:
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Create a Release
uses: elgohr/Github-Release-Action@v5
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: ${{ github.ref }}
tag: ${{ github.ref }}
24 changes: 8 additions & 16 deletions cpp/bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,11 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
opsqlite_bind_statement(statement, params);
}

int i, count, column_type;
int i, column_type;
std::string column_name, column_declared_type;

int column_count = sqlite3_column_count(statement);

while (isConsuming) {
step = sqlite3_step(statement);

Expand All @@ -755,25 +757,15 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
}

std::vector<JSVariant> row;
row.reserve(column_count);

i = 0;

count = sqlite3_column_count(statement);

while (i < count) {
while (i < column_count) {
column_type = sqlite3_column_type(statement, i);

switch (column_type) {
case SQLITE_INTEGER: {
/**
* Warning this will loose precision because JS can
* only represent Integers up to 53 bits
*/
double column_value = sqlite3_column_double(statement, i);
row.emplace_back(column_value);
break;
}

case SQLITE_INTEGER:
case SQLITE_FLOAT: {
double column_value = sqlite3_column_double(statement, i);
row.emplace_back(column_value);
Expand Down Expand Up @@ -809,7 +801,7 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
i++;
}

results->push_back(row);
results->emplace_back(row);

break;
}
Expand Down Expand Up @@ -871,7 +863,7 @@ std::string operation_to_string(int operation_type) {
return "UPDATE";

default:
throw std::invalid_argument("Uknown SQLite operation on hook");
throw std::invalid_argument("Unknown SQLite operation on hook");
}
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ set -ex

npm --no-git-tag-version version $1
VERSION=$(node -p "require('./package.json').version")
echo "Releasing $VERSION"

git add .
git commit -m "Release $VERSION"
git push
git tag "$VERSION"
git push --tags
git push --tags

0 comments on commit 5254500

Please sign in to comment.