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

Minor improvements #157

Merged
merged 2 commits into from
Oct 7, 2024
Merged
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
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
Loading