1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Compare commits

..

66 Commits

Author SHA1 Message Date
7cc5e7b67f chore(release): 0.1.13 2021-06-19 13:04:11 +02:00
e2ebb04a90 feat(UI): ability to manually insert page number in DATA tabs, closes #65 2021-06-19 12:13:09 +02:00
e579f37438 feat(UI): option to change query editors font size, closes #77 2021-06-19 11:54:15 +02:00
3829b94bf7 refactor: solved deprecation warning for url.format() 2021-06-18 21:08:21 +02:00
5c8ee66f43 feat(PostgreSQL): alter trigger support 2021-06-17 22:01:18 +02:00
b77e77f3bb chore: update dependencies 2021-06-14 09:11:37 +02:00
1d5614278c ci: moved to node 14 in build actions 2021-06-14 09:11:23 +02:00
8a20befd09 fix(UI): various fixes in displaying content with small window size 2021-06-13 11:16:21 +02:00
4133fc452f fix(MySQL): pool connections not released after MySQL errors, causing endless load animation 2021-06-11 15:02:45 +02:00
690a4541f9 perf: remove comments from queries before execution 2021-06-11 14:32:51 +02:00
71910ca5c8 chore(release): 0.1.12 2021-06-09 09:03:18 +02:00
cce5adbac7 feat(PostgreSQL): trigger rename and delete 2021-06-08 09:12:43 +02:00
e6d67fcb0c Update README.md 2021-06-07 23:03:08 +02:00
e83b80afc9 chore: update README.md 2021-06-05 12:27:20 +02:00
8742fa10f0 fix: internal exceptions 2021-06-05 10:15:44 +02:00
ab54eb086f chore: update dependencies 2021-06-05 10:15:08 +02:00
308f69f12e chore: update README.md 2021-06-04 14:01:46 +02:00
2f30bafa33 Merge pull request #74 from digitalgopnik/master
feat: added translation for de-DE
2021-06-04 10:39:22 +02:00
Christian
1716077182 added translation for de-DE 2021-06-04 09:37:02 +02:00
5562e73e75 fix: page offset not reset when selected table changes 2021-06-03 11:02:24 +02:00
8a7cc2a14f fix(UI): unable to browse view's result pages 2021-06-03 10:57:57 +02:00
9ca059d979 fix(MySQL): view's data tab doesn't work with some views, closes #71 2021-06-03 10:54:59 +02:00
c9ccf786cd chore(release): 0.1.11 2021-06-02 15:47:12 +02:00
5e9c88a7fd fix(UI): prevent canc key to trigger delete modal when editing a row 2021-06-02 12:32:12 +02:00
e0e6483d1f build: update dependencies 2021-06-02 12:13:43 +02:00
66227569f4 fix: table row loses internal id after cell update 2021-06-02 11:58:34 +02:00
faa799c8ea fix(MySQL): missing schema altering tables in some conditions 2021-05-31 17:07:48 +02:00
acc1eeb094 fix: empty offset in cell update queries 2021-05-31 14:27:02 +02:00
865dad80df chore: update README.md 2021-05-30 10:54:58 +02:00
f502620779 chore(release): 0.1.10 2021-05-29 11:41:48 +02:00
f61d7eeaf4 feat: key shortcuts to change DATA tab page 2021-05-29 11:26:23 +02:00
e71c7568c0 feat: option to set DATA tab page size 2021-05-29 11:04:02 +02:00
79f033e524 feat: prev/next buttons to browse the results pages of data tab 2021-05-27 22:13:59 +02:00
310cfaa3c2 fix(MySQL): wrong schema in view data tab select, closes #71 2021-05-26 17:44:33 +02:00
6f93e1f9ab chore: AUR badge on README.md 2021-05-26 13:19:48 +02:00
04bdd085a5 fix: wrong detection of field default expressions in some cases 2021-05-25 16:54:13 +02:00
c568acae14 build: update dependencies 2021-05-25 10:09:09 +02:00
7a46a119d8 chore(release): 0.1.9 2021-05-23 11:35:54 +02:00
f1636f1528 fix(MySQL): can't access tables having UNIQUE KEY, closes #69 2021-05-23 11:12:09 +02:00
f839d5cd3c chore: Twitter link in about tab 2021-05-23 10:19:56 +02:00
8f4f1d393c chore: update README.md 2021-05-22 17:33:03 +02:00
ab17c6d4bf chore: update README.md 2021-05-22 17:26:32 +02:00
b4b2f3d0cf chore(release): 0.1.8 2021-05-22 16:25:52 +02:00
7a766f04e6 perf: improved the way how field default value are handled 2021-05-22 16:24:19 +02:00
f6b77d1243 build: update dependencies 2021-05-22 16:12:08 +02:00
840241c3cc refactor: better description in foreign key value select 2021-05-20 15:07:51 +02:00
0f10c9e824 fix: internal id not removed before row update 2021-05-20 12:45:49 +02:00
1e37f2a96f fix: unable to add new ENUM fields 2021-05-20 12:38:05 +02:00
0d6137195d fix: unable to delete table rows 2021-05-19 16:55:38 +02:00
d26f168250 build: update build script 2021-05-17 19:08:36 +02:00
5efcad4d3f chore(release): 0.1.7 2021-05-16 21:08:52 +02:00
0a872e7023 build: separate build configurations 2021-05-16 21:03:04 +02:00
0e425a9c6d build: removed linux arm64 build from build process 2021-05-16 19:50:06 +02:00
434711a360 perf(MySQL): improved connections pool handling 2021-05-15 21:47:30 +02:00
854472c7a3 fix: row loses internal id after cell update 2021-05-15 19:33:31 +02:00
9a7cd90d5c build: arm mac (apple silicon) build configuration 2021-05-14 22:24:50 +02:00
026400d242 build: arm linux build configuration 2021-05-14 18:59:58 +02:00
4bd8cbbf6c build: moved to sass from node-sass 2021-05-14 17:27:56 +02:00
1382bc9300 Merge pull request #64 from Fabio286/dependabot/npm_and_yarn/pgsql-ast-parser-8.1.1
build(deps): bump pgsql-ast-parser from 7.2.1 to 8.1.1
2021-05-14 17:21:10 +02:00
ae103e5477 perf(core): increased connection pool size to improve performance 2021-05-14 17:17:37 +02:00
6b0b8b19d7 fix(MySQL): connection loses schema in some conditions 2021-05-14 17:02:27 +02:00
475397ca34 fix: issue with ENUM and SET fields on table filler modal 2021-05-13 20:46:44 +02:00
7a62131cc7 fix: issue with ENUM and SET length when creating a new field 2021-05-13 15:45:54 +02:00
c7663be338 fix: multiple row select on sorted tables not work properly 2021-05-11 18:32:11 +02:00
496490b14a build: update dependencies and build config 2021-05-11 12:00:22 +02:00
dependabot[bot]
672573d8c2 build(deps): bump pgsql-ast-parser from 7.2.1 to 8.1.1
Bumps [pgsql-ast-parser](https://github.com/oguimbal/pgsql-ast-parser) from 7.2.1 to 8.1.1.
- [Release notes](https://github.com/oguimbal/pgsql-ast-parser/releases)
- [Changelog](https://github.com/oguimbal/pgsql-ast-parser/blob/master/changelog.md)
- [Commits](https://github.com/oguimbal/pgsql-ast-parser/compare/7.2.1...8.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 06:16:49 +00:00
54 changed files with 1312 additions and 341 deletions

View File

@@ -1,4 +1,4 @@
name: Build/release name: Build/release [linux]
on: push on: push
@@ -8,8 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
# os: [macos-latest, ubuntu-latest, windows-latest] os: [ubuntu-latest]
os: [macos-latest, ubuntu-latest]
steps: steps:
- name: Check out Git repository - name: Check out Git repository
@@ -18,7 +17,7 @@ jobs:
- name: Install Node.js, NPM and Yarn - name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12 node-version: 14
- name: Build/release Electron app - name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1 uses: samuelmeuli/action-electron-builder@v1

26
.github/workflows/build-mac.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Build/release [mac]
on: push
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{ secrets.github_token }}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}

26
.github/workflows/build-win.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Build/release [windows]
on: push
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{ secrets.github_token }}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}

View File

@@ -2,6 +2,104 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.1.13](https://github.com/Fabio286/antares/compare/v0.1.12...v0.1.13) (2021-06-19)
### Features
* **PostgreSQL:** alter trigger support ([5c8ee66](https://github.com/Fabio286/antares/commit/5c8ee66f432585db7bd72103fa814558bf406bcc))
* **UI:** ability to manually insert page number in DATA tabs, closes [#65](https://github.com/Fabio286/antares/issues/65) ([e2ebb04](https://github.com/Fabio286/antares/commit/e2ebb04a9047d25187889644aa625fe675de808b))
* **UI:** option to change query editors font size, closes [#77](https://github.com/Fabio286/antares/issues/77) ([e579f37](https://github.com/Fabio286/antares/commit/e579f374381b329422b646b8f7ab5acf298db981))
### Bug Fixes
* **MySQL:** pool connections not released after MySQL errors, causing endless load animation ([4133fc4](https://github.com/Fabio286/antares/commit/4133fc452fc2e961eb587590e010f4968675db7e))
* **UI:** various fixes in displaying content with small window size ([8a20bef](https://github.com/Fabio286/antares/commit/8a20befd0941cb2e6d5e29552606454bd871b092))
### Improvements
* remove comments from queries before execution ([690a454](https://github.com/Fabio286/antares/commit/690a4541f96eaf831dea07b777a421729173b654))
### [0.1.12](https://github.com/Fabio286/antares/compare/v0.1.11...v0.1.12) (2021-06-09)
### Features
* **PostgreSQL:** trigger rename and delete ([cce5adb](https://github.com/Fabio286/antares/commit/cce5adbac75170186956211b54f4db5be25aba07))
### Bug Fixes
* internal exceptions ([8742fa1](https://github.com/Fabio286/antares/commit/8742fa10f08c92a98325df50be9a7df8e36b0f2c))
* page offset not reset when selected table changes ([5562e73](https://github.com/Fabio286/antares/commit/5562e73e75c659051a49d61041d1eee9d66ff6e2))
* **MySQL:** view's data tab doesn't work with some views, closes [#71](https://github.com/Fabio286/antares/issues/71) ([9ca059d](https://github.com/Fabio286/antares/commit/9ca059d979161c0132f64db372b4ed7ecc844b2d))
* **UI:** unable to browse view's result pages ([8a7cc2a](https://github.com/Fabio286/antares/commit/8a7cc2a14fa289c2f3d9e9eb1a5435ffbbaab006))
### [0.1.11](https://github.com/Fabio286/antares/compare/v0.1.10...v0.1.11) (2021-06-02)
### Bug Fixes
* **UI:** prevent canc key to trigger delete modal when editing a row ([5e9c88a](https://github.com/Fabio286/antares/commit/5e9c88a7fd656dd69b92ba4384ca81f4e8cdd422))
* table row loses internal id after cell update ([6622756](https://github.com/Fabio286/antares/commit/66227569f4c032298e20d44c253d30109ffde0b2))
* **MySQL:** missing schema altering tables in some conditions ([faa799c](https://github.com/Fabio286/antares/commit/faa799c8ea2329e7ca1b54c9414a060bc8a2a840))
* empty offset in cell update queries ([acc1eeb](https://github.com/Fabio286/antares/commit/acc1eeb0948db35f2c9a4d85d70fb654b41b15e5))
### [0.1.10](https://github.com/Fabio286/antares/compare/v0.1.9...v0.1.10) (2021-05-29)
### Features
* key shortcuts to change DATA tab page ([f61d7ee](https://github.com/Fabio286/antares/commit/f61d7eeaf42406eb88b3285ac4606794f56e88d3))
* option to set DATA tab page size ([e71c756](https://github.com/Fabio286/antares/commit/e71c7568c09bf8ad184753d3d0f14046f1e386d0))
* prev/next buttons to browse the results pages of data tab ([79f033e](https://github.com/Fabio286/antares/commit/79f033e5245e0e744c35540d25a30b1eadc4d603))
### Bug Fixes
* **MySQL:** wrong schema in view data tab select, closes [#71](https://github.com/Fabio286/antares/issues/71) ([310cfaa](https://github.com/Fabio286/antares/commit/310cfaa3c2324b1159a46be566b6af2555dc9732))
* wrong detection of field default expressions in some cases ([04bdd08](https://github.com/Fabio286/antares/commit/04bdd085a56240273133586d23196e52341d5f27))
### [0.1.9](https://github.com/Fabio286/antares/compare/v0.1.8...v0.1.9) (2021-05-23)
### Bug Fixes
* **MySQL:** can't access tables having UNIQUE KEY, closes [#69](https://github.com/Fabio286/antares/issues/69) ([f1636f1](https://github.com/Fabio286/antares/commit/f1636f1528b5765423535f84027fdc853c58ce80))
### [0.1.8](https://github.com/Fabio286/antares/compare/v0.1.7...v0.1.8) (2021-05-22)
### Bug Fixes
* internal id not removed before row update ([0f10c9e](https://github.com/Fabio286/antares/commit/0f10c9e824b679cfebd8a31085236da3d38a7953))
* unable to add new ENUM fields ([1e37f2a](https://github.com/Fabio286/antares/commit/1e37f2a96f660a36f2739fea57ca298059e9c31a))
* unable to delete table rows ([0d61371](https://github.com/Fabio286/antares/commit/0d6137195da9e0e9afe68f6d3ebcd50e913a888e))
### Improvements
* improved the way how field default value are handled ([7a766f0](https://github.com/Fabio286/antares/commit/7a766f04e668868e8844aac1d7d445bc2da21558))
### [0.1.7](https://github.com/Fabio286/antares/compare/v0.1.6...v0.1.7) (2021-05-16)
### Bug Fixes
* row loses internal id after cell update ([854472c](https://github.com/Fabio286/antares/commit/854472c7a3d8442b1eede12f978cad5aa684094e))
* **MySQL:** connection loses schema in some conditions ([6b0b8b1](https://github.com/Fabio286/antares/commit/6b0b8b19d7176ef8647d6f401a33315f8732fdf3))
* issue with ENUM and SET fields on table filler modal ([475397c](https://github.com/Fabio286/antares/commit/475397ca34c5b7d8925e2d97d32216d5b80d8211))
* issue with ENUM and SET length when creating a new field ([7a62131](https://github.com/Fabio286/antares/commit/7a62131cc707aa1c98bb12513de76229472b7c38))
* multiple row select on sorted tables not work properly ([c7663be](https://github.com/Fabio286/antares/commit/c7663be338ccb5ff31e241e824593531ad95bd32))
### Improvements
* **core:** increased connection pool size to improve performance ([ae103e5](https://github.com/Fabio286/antares/commit/ae103e5477ad190c541d0f29e277c41de6947063))
* **MySQL:** improved connections pool handling ([434711a](https://github.com/Fabio286/antares/commit/434711a360bd7539d2ec3adec92e7ccc96fa828e))
### [0.1.6](https://github.com/Fabio286/antares/compare/v0.1.5...v0.1.6) (2021-05-08) ### [0.1.6](https://github.com/Fabio286/antares/compare/v0.1.5...v0.1.6) (2021-05-08)

View File

@@ -4,7 +4,7 @@
# Antares SQL Client # Antares SQL Client
![GitHub package.json version](https://img.shields.io/github/package-json/v/fabio286/antares) ![GitHub All Releases](https://img.shields.io/github/downloads/fabio286/antares/total) ![GitHub](https://img.shields.io/github/license/fabio286/antares) [![antares](https://snapcraft.io/antares/badge.svg)](https://snapcraft.io/antares) [![antares](https://snapcraft.io/antares/trending.svg?name=0)](https://snapcraft.io/antares) [![Plant a Tree](https://raw.githubusercontent.com/Fabio286/treedom-badge/master/svg/plant-a-tree.svg)](https://www.treedom.net/en/user/fabio-di-stasio/event/antares-for-the-planet) ![GitHub package.json version](https://img.shields.io/github/package-json/v/fabio286/antares) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Ffabio286%2Fantares%2Fbadge&style=flat)](https://actions-badge.atrox.dev/fabio286/antares/goto) ![GitHub All Releases](https://img.shields.io/github/downloads/fabio286/antares/total) ![GitHub](https://img.shields.io/github/license/fabio286/antares) [![antares](https://snapcraft.io/antares/badge.svg)](https://snapcraft.io/antares) [![antares](https://snapcraft.io/antares/trending.svg?name=0)](https://snapcraft.io/antares) [![Twitter Follow](https://img.shields.io/twitter/follow/AntaresSQL?style=social)](https://twitter.com/AntaresSQL) [![Plant a Tree](https://raw.githubusercontent.com/Fabio286/treedom-badge/master/svg/plant-a-tree.svg)](https://www.treedom.net/en/user/fabio-di-stasio/event/antares-for-the-planet)
Antares is an SQL client based on [Electron.js](https://github.com/electron/electron) and [Vue.js](https://github.com/vuejs/vue) that aims to become a useful tool, especially for developers. Antares is an SQL client based on [Electron.js](https://github.com/electron/electron) and [Vue.js](https://github.com/vuejs/vue) that aims to become a useful tool, especially for developers.
My target is to support as many databases as possible, and all major operating systems, including the ARM versions. My target is to support as many databases as possible, and all major operating systems, including the ARM versions.
@@ -14,7 +14,7 @@ Many of its current features are enough to have a pleasant user experience with
I'm actively working on it, hoping to provide cool features and fixes as soon as possible. I'm actively working on it, hoping to provide cool features and fixes as soon as possible.
🔗 If you are curious to try Antares you can download and install the [latest release](https://github.com/Fabio286/antares/releases/latest). 🔗 If you are curious to try Antares you can download and install the [latest release](https://github.com/Fabio286/antares/releases/latest).
👁 To stay tuned for new releases watch this repo on **Release only** channel. 👁 To stay tuned for new releases [follow Antares SQL](https://twitter.com/AntaresSQL) on Twitter.
🌟 Don't forget to **leave a star** if you appreciate this project. 🌟 Don't forget to **leave a star** if you appreciate this project.
## Philosophy ## Philosophy
@@ -25,12 +25,14 @@ A modern application created with minimalism and semplicity in mind, with featur
## Download ## Download
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/antares) [![Get it from Microsoft Store](https://raw.githubusercontent.com/Fabio286/antares/gh-pages/src/assets/ms-store.png)](https://www.microsoft.com/p/antares-sql-client/9nhtb9sq51r1?cid=storebadge&ocid=badge&rtc=1&activetab=pivot:overviewtab) [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/antares) [![Get it from AUR](https://raw.githubusercontent.com/Fabio286/antares/3e00c4bae6e036300c752c1a40c5a038fea9c169/docs/aur-badge.svg)](https://aur.archlinux.org/packages/antares-sql/) [![Get it from Microsoft Store](https://raw.githubusercontent.com/Fabio286/antares/gh-pages/src/assets/ms-store.png)](https://www.microsoft.com/p/antares-sql-client/9nhtb9sq51r1?cid=storebadge&ocid=badge&rtc=1&activetab=pivot:overviewtab)
🚀 **[Other Downloads](https://github.com/Fabio286/antares/releases/latest)** 🚀 **[Other Downloads](https://github.com/Fabio286/antares/releases/latest)**
## How to contribute ## How to contribute
- [Translate Antares](https://github.com/Fabio286/antares/wiki/Translate-Antares) - 🌍 [Translate Antares](https://github.com/Fabio286/antares/wiki/Translate-Antares)
- 📖 [Contributors Guide](https://github.com/Fabio286/antares/wiki/Contributors-Guide)
- 🚧 [Project Board](https://github.com/users/Fabio286/projects/1)
## Current main features ## Current main features
@@ -83,7 +85,7 @@ This is a roadmap with major features will come in near future.
#### • ARM #### • ARM
- [ ] Windows - [ ] Windows
- [ ] Linux - [x] Linux
- [ ] MacOS - [ ] MacOS
## Translations ## Translations
@@ -93,6 +95,7 @@ This is a roadmap with major features will come in near future.
**Spanish Translation** / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)] **Spanish Translation** / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)]
**French Translation** / [MrAnyx](https://github.com/MrAnyx) [[#44](https://github.com/Fabio286/antares/pull/44)] **French Translation** / [MrAnyx](https://github.com/MrAnyx) [[#44](https://github.com/Fabio286/antares/pull/44)]
**Portugues (Brasil)** / [Daniel Eduardo](https://github.com/daeleduardo) [[#54](https://github.com/Fabio286/antares/pull/54)] **Portugues (Brasil)** / [Daniel Eduardo](https://github.com/daeleduardo) [[#54](https://github.com/Fabio286/antares/pull/54)]
**Deutsch (Deutschland)** / [Christian Ratz](https://github.com/digitalgopnik) [[#74](https://github.com/Fabio286/antares/pull/74)]
## Reviews ## Reviews

77
docs/aur-badge.svg Normal file
View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
style="isolation:isolate" viewBox="0 0 182 56" width="182px" height="56px">
<defs>
<clipPath id="_clipPath_tR1uglJ1Zei76xP861DY1TsjAiQWS9qF">
<rect width="182" height="56" />
</clipPath>
</defs>
<g clip-path="url(#_clipPath_tR1uglJ1Zei76xP861DY1TsjAiQWS9qF)">
<path
d="M 2.5 0.5 L 180.5 0.5 C 181.604 0.5 182.5 1.396 182.5 2.5 L 182.5 54.5 C 182.5 55.604 181.604 56.5 180.5 56.5 L 2.5 56.5 C 1.396 56.5 0.5 55.604 0.5 54.5 L 0.5 2.5 C 0.5 1.396 1.396 0.5 2.5 0.5 Z"
style="stroke:none;fill:#252525;stroke-miterlimit:10;" />
<path
d="M 2.5 0.5 L 180.5 0.5 C 181.604 0.5 182.5 1.396 182.5 2.5 L 182.5 54.5 C 182.5 55.604 181.604 56.5 180.5 56.5 L 2.5 56.5 C 1.396 56.5 0.5 55.604 0.5 54.5 L 0.5 2.5 C 0.5 1.396 1.396 0.5 2.5 0.5 Z"
style="fill:none;stroke:#CDCDCD;stroke-width:1;stroke-miterlimit:2;" />
<g>
<g>
<path
d=" M 60.898 13.777 C 58.555 13.774 56.61 14.254 55.858 14.516 L 55.083 18.697 C 55.081 18.712 58.937 17.669 60.635 17.73 C 63.447 17.831 63.706 18.805 63.656 20.119 C 63.704 20.196 62.931 18.931 60.498 18.889 C 57.43 18.836 53.098 19.976 53.104 24.608 C 53.022 29.818 56.997 31.351 59.704 31.379 C 62.138 31.335 63.279 30.458 63.904 29.988 C 64.726 29.129 65.665 28.265 66.561 27.229 C 65.714 28.77 64.978 29.835 64.213 30.651 L 64.213 31.339 L 67.913 30.716 L 67.938 20.66 C 67.901 19.237 68.754 13.791 60.898 13.777 Z M 60.367 22.533 C 61.9 22.554 63.659 23.31 63.662 25.129 C 63.669 26.784 61.589 27.674 60.235 27.66 C 58.881 27.646 57.085 26.596 57.077 24.982 C 57.103 23.54 58.771 22.496 60.367 22.533 Z "
fill-rule="evenodd" fill="rgb(255,255,255)" />
<path
d=" M 70.378 14.707 L 70.352 31.36 L 74.662 30.529 L 74.67 21.087 C 74.671 19.681 76.679 18.039 79.198 18.065 C 79.733 17.097 80.738 14.625 80.983 14.062 C 75.354 14.049 75.282 15.68 74.303 16.483 C 74.293 14.952 74.3 14.033 74.3 14.033 L 70.378 14.707 L 70.378 14.707 Z "
fill-rule="evenodd" fill="rgb(255,255,255)" />
<path
d=" M 94.632 16.893 C 94.591 16.873 92.385 14.312 87.949 14.292 C 83.795 14.223 79.135 15.834 79.061 22.8 C 79.097 28.925 83.537 31.318 87.973 31.365 C 92.72 31.414 94.609 28.396 94.722 28.322 C 94.156 27.83 92.034 25.728 92.034 25.728 C 92.034 25.728 90.709 27.615 88.138 27.639 C 85.566 27.664 83.331 25.651 83.299 22.844 C 83.266 20.036 85.354 18.515 88.157 18.392 C 90.584 18.392 91.984 19.959 91.984 19.959 L 94.632 16.893 L 94.632 16.893 Z "
fill-rule="evenodd" fill="rgb(255,255,255)" />
<path
d=" M 100.065 8.879 L 95.996 9.835 L 96.026 31.526 L 100.034 30.802 L 100.08 20.595 C 100.089 19.524 101.628 17.88 104.2 17.933 C 106.658 17.958 107.207 19.571 107.201 19.775 L 107.272 31.592 L 111.224 30.894 L 111.239 18.363 C 111.265 17.157 108.598 14.61 104.311 14.592 C 102.273 14.596 101.145 15.057 100.571 15.397 C 99.588 16.156 98.466 16.883 97.362 17.811 C 98.382 16.501 99.239 15.595 100.075 14.921 L 100.065 8.879 L 100.065 8.879 Z "
fill-rule="evenodd" fill="rgb(255,255,255)" />
</g>
<g>
<path
d=" M 114.673 9.441 L 116.508 8.982 L 116.595 30.85 L 114.73 31.168 L 114.673 9.441 L 114.673 9.441 Z "
fill-rule="evenodd" fill="rgb(23,147,209)" />
<path
d=" M 119.663 15.968 L 121.271 15.252 L 121.285 30.932 L 119.731 31.253 L 119.663 15.968 L 119.663 15.968 Z M 119.28 10.314 L 120.577 9.255 L 121.655 10.454 L 120.357 11.54 L 119.28 10.314 L 119.28 10.314 Z "
fill-rule="evenodd" fill="rgb(23,147,209)" />
<path
d=" M 124.296 15.682 L 126.131 15.308 L 126.14 18.586 C 126.14 18.727 127.148 14.924 132.008 15.009 C 136.727 15.035 137.499 18.688 137.473 19.507 L 137.531 31.034 L 135.922 31.384 L 135.913 19.998 C 135.932 19.665 135.178 16.853 131.843 16.843 C 128.509 16.833 126.199 19.265 126.203 20.818 L 126.229 30.848 L 124.365 31.335 L 124.296 15.682 L 124.296 15.682 Z "
fill-rule="evenodd" fill="rgb(23,147,209)" />
<path
d=" M 153.547 31.117 L 151.711 31.492 L 151.703 28.214 C 151.703 28.073 150.694 31.876 145.835 31.791 C 141.116 31.765 140.344 28.112 140.37 27.293 L 140.311 15.765 L 142.261 15.372 L 142.292 26.758 C 142.292 27.069 142.665 29.947 145.999 29.957 C 149.334 29.967 151.669 27.949 151.686 24.911 L 151.662 15.928 L 153.477 15.464 L 153.547 31.117 L 153.547 31.117 Z "
fill-rule="evenodd" fill="rgb(23,147,209)" />
<path
d=" M 157.144 15.553 L 155.857 16.56 L 160.792 23.018 L 155.529 30.478 L 156.894 31.492 L 161.841 24.563 L 166.948 31.656 L 168.211 30.649 L 162.738 23.065 L 167.104 16.933 L 165.762 15.797 L 161.785 21.472 L 157.144 15.553 L 157.144 15.553 Z "
fill-rule="evenodd" fill="rgb(23,147,209)" />
</g>
<path
d=" M 33.112 3.879 C 30.965 9.143 29.67 12.587 27.279 17.695 C 28.745 19.248 30.544 21.058 33.466 23.101 C 30.325 21.809 28.182 20.511 26.581 19.164 C 23.521 25.549 18.728 34.643 9 52.121 C 16.645 47.707 22.572 44.986 28.095 43.948 C 27.858 42.928 27.723 41.824 27.733 40.673 L 27.742 40.428 C 27.863 35.53 30.411 31.763 33.43 32.019 C 36.448 32.274 38.794 36.455 38.673 41.353 C 38.65 42.275 38.546 43.162 38.364 43.984 C 43.828 45.053 49.691 47.767 57.233 52.121 C 55.746 49.383 54.419 46.915 53.151 44.565 C 51.154 43.017 49.072 41.003 44.823 38.822 C 47.743 39.581 49.834 40.456 51.464 41.435 C 38.575 17.439 37.532 14.251 33.112 3.879 Z "
fill-rule="evenodd" fill="rgb(23,147,209)" />
<g>
<path
d=" M 170.614 30.156 L 170.614 28.802 L 170.109 28.802 L 170.109 28.621 L 171.325 28.621 L 171.325 28.802 L 170.817 28.802 L 170.817 30.156 L 170.614 30.156 Z "
fill="rgb(23,147,209)" />
<path
d=" M 171.536 30.156 L 171.536 28.621 L 171.842 28.621 L 172.205 29.708 C 172.238 29.809 172.263 29.884 172.278 29.935 C 172.295 29.879 172.323 29.797 172.36 29.689 L 172.727 28.621 L 173 28.621 L 173 30.156 L 172.804 30.156 L 172.804 28.871 L 172.358 30.156 L 172.175 30.156 L 171.732 28.849 L 171.732 30.156 L 171.536 30.156 Z "
fill="rgb(23,147,209)" />
</g>
<g>
<path
d=" M 57.471 47.815 L 57.471 46.493 L 56.977 46.493 L 56.977 46.316 L 58.166 46.316 L 58.166 46.493 L 57.67 46.493 L 57.67 47.815 L 57.471 47.815 Z "
fill="rgb(23,147,209)" />
<path
d=" M 58.372 47.815 L 58.372 46.316 L 58.671 46.316 L 59.026 47.377 C 59.059 47.476 59.083 47.55 59.098 47.599 C 59.115 47.545 59.141 47.465 59.177 47.359 L 59.536 46.316 L 59.803 46.316 L 59.803 47.815 L 59.612 47.815 L 59.612 46.56 L 59.176 47.815 L 58.997 47.815 L 58.564 46.539 L 58.564 47.815 L 58.372 47.815"
fill="rgb(23,147,209)" />
</g>
</g>
<g clip-path="url(#_clipPath_NvFIpNfWUS6M4fZAtfyVzggsKR3URDoi)"><text transform="matrix(1,0,0,1,87.023,43.899)"
style="font-family:'Open Sans';font-weight:700;font-size:11px;font-style:normal;fill:#ffffff;stroke:none;">user
repository</text></g>
<defs>
<clipPath id="_clipPath_NvFIpNfWUS6M4fZAtfyVzggsKR3URDoi">
<rect x="0" y="0" width="86" height="14.98" transform="matrix(1,0,0,1,87,32.142)" />
</clipPath>
</defs>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,20 +1,22 @@
{ {
"name": "antares", "name": "antares",
"productName": "Antares", "productName": "Antares",
"version": "0.1.6", "version": "0.1.13",
"description": "A cross-platform easy to use SQL client.", "description": "A cross-platform easy to use SQL client.",
"license": "MIT", "license": "MIT",
"repository": "https://github.com/Fabio286/antares.git", "repository": "https://github.com/Fabio286/antares.git",
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=development electron-webpack dev", "dev": "cross-env NODE_ENV=development electron-webpack dev",
"compile": "electron-webpack", "compile": "electron-webpack",
"build": "cross-env NODE_ENV=production npm run compile && electron-builder", "build": "cross-env NODE_ENV=production npm run compile",
"build:appx": "npm run build -- --win appx", "build:local": "npm run build && electron-builder",
"build:appx": "npm run build:local -- --win appx",
"release": "standard-version", "release": "standard-version",
"release:pre": "npm run release -- --prerelease alpha", "release:pre": "npm run release -- --prerelease alpha",
"test": "npm run lint", "test": "npm run lint",
"lint": "eslint . --ext .js,.vue && stylelint \"./src/**/*.{css,scss,sass,vue}\"", "lint": "eslint . --ext .js,.vue && stylelint \"./src/**/*.{css,scss,sass,vue}\"",
"lint:fix": "eslint . --ext .js,.vue --fix && stylelint \"./src/**/*.{css,scss,sass,vue}\" --fix" "lint:fix": "eslint . --ext .js,.vue --fix && stylelint \"./src/**/*.{css,scss,sass,vue}\" --fix",
"postinstall": "electron-builder install-app-deps"
}, },
"author": "Fabio Di Stasio <fabio286@gmail.com>", "author": "Fabio Di Stasio <fabio286@gmail.com>",
"build": { "build": {
@@ -26,24 +28,28 @@
"portable" "portable"
] ]
}, },
"dmg": { "mac": {
"contents": [ "target": {
{ "target": "default",
"x": 130, "arch": [
"y": 220 "x64"
},
{
"x": 410,
"y": 220,
"type": "link",
"path": "/Applications"
}
] ]
}
}, },
"linux": { "linux": {
"target": [ "target": [
"deb", {
"AppImage" "target": "deb",
"arch": "x64"
},
{
"target": "AppImage",
"arch": [
"x64",
"armv7l",
"arm64"
]
}
], ],
"category": "Development" "category": "Development"
}, },
@@ -59,6 +65,20 @@
"identityName": "62514FabioDiStasio.AntaresSQLClient", "identityName": "62514FabioDiStasio.AntaresSQLClient",
"publisher": "CN=1A2729ED-865C-41D2-9038-39AE2A63AA52", "publisher": "CN=1A2729ED-865C-41D2-9038-39AE2A63AA52",
"applicationId": "FabioDiStasio.AntaresSQLClient" "applicationId": "FabioDiStasio.AntaresSQLClient"
},
"dmg": {
"contents": [
{
"x": 130,
"y": 220
},
{
"x": 410,
"y": 220,
"type": "link",
"path": "/Applications"
}
]
} }
}, },
"electronWebpack": { "electronWebpack": {
@@ -67,14 +87,14 @@
} }
}, },
"dependencies": { "dependencies": {
"@electron/remote": "^1.1.0", "@electron/remote": "^1.2.0",
"@mdi/font": "^5.9.55", "@mdi/font": "^5.9.55",
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"electron-log": "^4.3.5", "electron-log": "^4.3.5",
"electron-store": "^8.0.0", "electron-store": "^8.0.0",
"electron-updater": "^4.3.5", "electron-updater": "^4.3.9",
"faker": "^5.3.1", "faker": "^5.5.3",
"marked": "^2.0.2", "marked": "^2.1.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"mysql2": "^2.2.5", "mysql2": "^2.2.5",
"pg": "^8.5.1", "pg": "^8.5.1",
@@ -85,30 +105,30 @@
"v-mask": "^2.2.4", "v-mask": "^2.2.4",
"vue-i18n": "^8.24.4", "vue-i18n": "^8.24.4",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"vuex": "^3.6.0" "vuex": "^3.6.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.13.14", "@babel/eslint-parser": "^7.14.5",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"electron": "^12.0.7", "electron": "^13.1.2",
"electron-builder": "^22.9.1", "electron-builder": "^22.11.7",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"electron-webpack": "^2.8.2", "electron-webpack": "^2.8.2",
"electron-webpack-vue": "^2.4.0", "electron-webpack-vue": "^2.4.0",
"eslint": "^7.26.0", "eslint": "^7.29.0",
"eslint-config-standard": "^16.0.2", "eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0", "eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^7.9.0", "eslint-plugin-vue": "^7.11.1",
"node-sass": "^5.0.0", "sass": "^1.35.1",
"sass-loader": "^10.1.1", "sass-loader": "^10.2.0",
"standard-version": "^9.3.0", "standard-version": "^9.3.0",
"stylelint": "^13.13.1", "stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0", "stylelint-config-standard": "^22.0.0",
"stylelint-scss": "^3.19.0", "stylelint-scss": "^3.19.0",
"vue": "^2.6.12", "vue": "^2.6.14",
"vue-template-compiler": "^2.6.12", "vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0" "webpack": "^4.46.0"
} }
} }

View File

@@ -62,8 +62,10 @@ module.exports = {
functionSql: false, functionSql: false,
functionContext: false, functionContext: false,
functionLanguage: false, functionLanguage: false,
triggerMiltipleEvents: false, triggerMultipleEvents: false,
triggerTableInName: false,
triggerUpdateColumns: false, triggerUpdateColumns: false,
triggerOnlyRename: false,
parametersLength: false, parametersLength: false,
languages: false languages: false
}; };

View File

@@ -13,7 +13,7 @@ module.exports = {
// Structure // Structure
tables: true, tables: true,
views: true, views: true,
triggers: false, triggers: true,
routines: true, routines: true,
functions: true, functions: true,
// Settings // Settings
@@ -25,7 +25,7 @@ module.exports = {
databaseEdit: false, databaseEdit: false,
tableSettings: true, tableSettings: true,
viewSettings: true, viewSettings: true,
triggerSettings: false, triggerSettings: true,
routineSettings: true, routineSettings: true,
functionSettings: true, functionSettings: true,
indexes: true, indexes: true,
@@ -38,5 +38,8 @@ module.exports = {
functionSql: '$BODY$\r\n\r\n$BODY$', functionSql: '$BODY$\r\n\r\n$BODY$',
functionContext: true, functionContext: true,
functionLanguage: true, functionLanguage: true,
triggerMultipleEvents: true,
triggerTableInName: true,
triggerOnlyRename: false,
languages: ['sql', 'plpgsql', 'c', 'internal'] languages: ['sql', 'plpgsql', 'c', 'internal']
}; };

View File

@@ -2,7 +2,6 @@
import { app, BrowserWindow, nativeImage } from 'electron'; import { app, BrowserWindow, nativeImage } from 'electron';
import * as path from 'path'; import * as path from 'path';
import { format as formatUrl } from 'url';
import Store from 'electron-store'; import Store from 'electron-store';
import ipcHandlers from './ipc-handlers'; import ipcHandlers from './ipc-handlers';
@@ -47,13 +46,8 @@ async function createMainWindow () {
const toolName = await installExtension(VUEJS_DEVTOOLS); const toolName = await installExtension(VUEJS_DEVTOOLS);
console.log(toolName, 'installed'); console.log(toolName, 'installed');
} }
else { else
await window.loadURL(formatUrl({ await window.loadURL(new URL(`file:///${path.join(__dirname, 'index.html')}`).href);
pathname: path.join(__dirname, 'index.html'),
protocol: 'file',
slashes: true
}));
}
} }
catch (err) { catch (err) {
console.log(err); console.log(err);

View File

@@ -71,7 +71,7 @@ export default connections => {
const connection = ClientsFactory.getConnection({ const connection = ClientsFactory.getConnection({
client: conn.client, client: conn.client,
params, params,
poolSize: 1 poolSize: 5
}); });
await connection.connect(); await connection.connect();

View File

@@ -128,7 +128,7 @@ export default connections => {
if (!query) return; if (!query) return;
try { try {
const result = await connections[uid].raw(query, { nest: true, details: true }); const result = await connections[uid].raw(query, { nest: true, details: true, schema });
return { status: 'success', response: result }; return { status: 'success', response: result };
} }

View File

@@ -16,13 +16,15 @@ export default (connections) => {
} }
}); });
ipcMain.handle('get-table-data', async (event, { uid, schema, table, sortParams }) => { ipcMain.handle('get-table-data', async (event, { uid, schema, table, limit, page, sortParams }) => {
try { try {
const offset = (page - 1) * limit;
const query = connections[uid] const query = connections[uid]
.select('*') .select('*')
.schema(schema) .schema(schema)
.from(table) .from(table)
.limit(1000); .limit(limit)
.offset(offset);
if (sortParams && sortParams.field && sortParams.dir) if (sortParams && sortParams.field && sortParams.dir)
query.orderBy({ [sortParams.field]: sortParams.dir.toUpperCase() }); query.orderBy({ [sortParams.field]: sortParams.dir.toUpperCase() });
@@ -59,6 +61,8 @@ export default (connections) => {
}); });
ipcMain.handle('update-table-cell', async (event, params) => { ipcMain.handle('update-table-cell', async (event, params) => {
delete params.row._id;
try { // TODO: move to client classes try { // TODO: move to client classes
let escapedParam; let escapedParam;
let reload = false; let reload = false;

View File

@@ -26,6 +26,7 @@ export class AntaresCore {
groupBy: [], groupBy: [],
orderBy: [], orderBy: [],
limit: [], limit: [],
offset: [],
join: [], join: [],
update: [], update: [],
insert: [], insert: [],
@@ -109,6 +110,11 @@ export class AntaresCore {
return this; return this;
} }
offset (...args) {
this._query.offset = args;
return this;
}
/** /**
* @param {String | Array} args field = value * @param {String | Array} args field = value
* @returns * @returns
@@ -134,7 +140,7 @@ export class AntaresCore {
* @returns {Promise} * @returns {Promise}
* @memberof AntaresCore * @memberof AntaresCore
*/ */
async run (args) { run (args) {
const rawQuery = this.getSQL(); const rawQuery = this.getSQL();
this._resetQuery(); this._resetQuery();
return this.raw(rawQuery, args); return this.raw(rawQuery, args);

View File

@@ -1,5 +1,5 @@
'use strict'; 'use strict';
import mysql from 'mysql2'; import mysql from 'mysql2/promise';
import { AntaresCore } from '../AntaresCore'; import { AntaresCore } from '../AntaresCore';
import dataTypes from 'common/data-types/mysql'; import dataTypes from 'common/data-types/mysql';
@@ -102,8 +102,10 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async connect () { async connect () {
delete this._params.application_name;
if (!this._poolSize) if (!this._poolSize)
this._connection = mysql.createConnection(this._params); this._connection = await mysql.createConnection(this._params);
else { else {
this._connection = mysql.createPool({ this._connection = mysql.createPool({
...this._params, ...this._params,
@@ -303,10 +305,57 @@ export class MySQLClient extends AntaresCore {
.select('*') .select('*')
.schema('information_schema') .schema('information_schema')
.from('COLUMNS') .from('COLUMNS')
.where({ TABLE_SCHEMA: `= '${schema}'`, TABLE_NAME: `= '${table}'` }) .where({ TABLE_SCHEMA: `= '${this._schema || schema}'`, TABLE_NAME: `= '${table}'` })
.orderBy({ ORDINAL_POSITION: 'ASC' }) .orderBy({ ORDINAL_POSITION: 'ASC' })
.run(); .run();
const { rows: fields } = await this.raw(`SHOW CREATE TABLE \`${this._schema || schema}\`.\`${table}\``);
const remappedFields = fields.map(row => {
if (!row['Create Table']) return false;
let n = 0;
return row['Create Table']
.split('')
.reduce((acc, curr) => {
if (curr === ')') n--;
if (n !== 0) acc += curr;
if (curr === '(') n++;
return acc;
}, '')
.replaceAll('\n', '')
.split(',')
.map(f => {
try {
const fieldArr = f.trim().split(' ');
const nameAndType = fieldArr.slice(0, 2);
if (nameAndType[0].charAt(0) !== '`') return false;
const details = fieldArr.slice(2).join(' ');
let defaultValue = null;
if (details.includes('DEFAULT'))
defaultValue = details.match(/(?<=DEFAULT ).*?$/gs)[0].split(' COMMENT')[0];
const typeAndLength = nameAndType[1].replace(')', '').split('(');
return {
name: nameAndType[0].replaceAll('`', ''),
type: typeAndLength[0].toUpperCase(),
length: typeAndLength[1] ? typeAndLength[1] : null,
default: defaultValue
};
}
catch (err) {
return false;
}
})
.filter(Boolean)
.reduce((acc, curr) => {
acc[curr.name] = curr;
return acc;
}, {});
})[0];
return rows.map(field => { return rows.map(field => {
let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/); let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/);
numLength = numLength ? +numLength.pop() : null; numLength = numLength ? +numLength.pop() : null;
@@ -317,7 +366,7 @@ export class MySQLClient extends AntaresCore {
return { return {
name: field.COLUMN_NAME, name: field.COLUMN_NAME,
key: field.COLUMN_KEY.toLowerCase(), key: field.COLUMN_KEY.toLowerCase(),
type: field.DATA_TYPE.toUpperCase(), type: remappedFields ? remappedFields[field.COLUMN_NAME].type : field.DATA_TYPE,
schema: field.TABLE_SCHEMA, schema: field.TABLE_SCHEMA,
table: field.TABLE_NAME, table: field.TABLE_NAME,
numPrecision: field.NUMERIC_PRECISION, numPrecision: field.NUMERIC_PRECISION,
@@ -329,7 +378,7 @@ export class MySQLClient extends AntaresCore {
unsigned: field.COLUMN_TYPE.includes('unsigned'), unsigned: field.COLUMN_TYPE.includes('unsigned'),
zerofill: field.COLUMN_TYPE.includes('zerofill'), zerofill: field.COLUMN_TYPE.includes('zerofill'),
order: field.ORDINAL_POSITION, order: field.ORDINAL_POSITION,
default: field.COLUMN_DEFAULT, default: remappedFields ? remappedFields[field.COLUMN_NAME].default : field.COLUMN_DEFAULT,
charset: field.CHARACTER_SET_NAME, charset: field.CHARACTER_SET_NAME,
collation: field.COLLATION_NAME, collation: field.COLLATION_NAME,
autoIncrement: field.EXTRA.includes('auto_increment'), autoIncrement: field.EXTRA.includes('auto_increment'),
@@ -488,7 +537,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropView (params) { async dropView (params) {
const sql = `DROP VIEW \`${params.view}\``; const sql = `DROP VIEW \`${this._schema}\`.\`${params.view}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -500,10 +549,10 @@ export class MySQLClient extends AntaresCore {
*/ */
async alterView (params) { async alterView (params) {
const { view } = params; const { view } = params;
let sql = `ALTER ALGORITHM = ${view.algorithm}${view.definer ? ` DEFINER=${view.definer}` : ''} SQL SECURITY ${view.security} VIEW \`${view.oldName}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`; let sql = `ALTER ALGORITHM = ${view.algorithm}${view.definer ? ` DEFINER=${view.definer}` : ''} SQL SECURITY ${view.security} VIEW \`${this._schema}\`.\`${view.oldName}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`;
if (view.name !== view.oldName) if (view.name !== view.oldName)
sql += `; RENAME TABLE \`${view.oldName}\` TO \`${view.name}\``; sql += `; RENAME TABLE \`${this._schema}\`.\`${view.oldName}\` TO \`${this._schema}\`.\`${view.name}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -515,7 +564,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createView (view) { async createView (view) {
const sql = `CREATE ALGORITHM = ${view.algorithm} ${view.definer ? `DEFINER=${view.definer} ` : ''}SQL SECURITY ${view.security} VIEW \`${view.name}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`; const sql = `CREATE ALGORITHM = ${view.algorithm} ${view.definer ? `DEFINER=${view.definer} ` : ''}SQL SECURITY ${view.security} VIEW \`${this._schema}\`.\`${view.name}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -535,8 +584,8 @@ export class MySQLClient extends AntaresCore {
sql: row['SQL Original Statement'].match(/(BEGIN|begin)(.*)(END|end)/gs)[0], sql: row['SQL Original Statement'].match(/(BEGIN|begin)(.*)(END|end)/gs)[0],
name: row.Trigger, name: row.Trigger,
table: row['SQL Original Statement'].match(/(?<=ON `).*?(?=`)/gs)[0], table: row['SQL Original Statement'].match(/(?<=ON `).*?(?=`)/gs)[0],
event1: row['SQL Original Statement'].match(/(BEFORE|AFTER)/gs)[0], activation: row['SQL Original Statement'].match(/(BEFORE|AFTER)/gs)[0],
event2: row['SQL Original Statement'].match(/(INSERT|UPDATE|DELETE)/gs)[0] event: row['SQL Original Statement'].match(/(INSERT|UPDATE|DELETE)/gs)[0]
}; };
})[0]; })[0];
} }
@@ -548,7 +597,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropTrigger (params) { async dropTrigger (params) {
const sql = `DROP TRIGGER \`${params.trigger}\``; const sql = `DROP TRIGGER \`${this._schema}\`.\`${params.trigger}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -581,7 +630,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createTrigger (trigger) { async createTrigger (trigger) {
const sql = `CREATE ${trigger.definer ? `DEFINER=${trigger.definer} ` : ''}TRIGGER \`${trigger.name}\` ${trigger.event1} ${trigger.event2} ON \`${trigger.table}\` FOR EACH ROW ${trigger.sql}`; const sql = `CREATE ${trigger.definer ? `DEFINER=${trigger.definer} ` : ''}TRIGGER \`${this._schema}\`.\`${trigger.name}\` ${trigger.activation} ${trigger.event} ON \`${trigger.table}\` FOR EACH ROW ${trigger.sql}`;
return await this.raw(sql, { split: false }); return await this.raw(sql, { split: false });
} }
@@ -655,7 +704,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropRoutine (params) { async dropRoutine (params) {
const sql = `DROP PROCEDURE \`${params.routine}\``; const sql = `DROP PROCEDURE \`${this._schema}\`.\`${params.routine}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -782,7 +831,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropFunction (params) { async dropFunction (params) {
const sql = `DROP FUNCTION \`${params.func}\``; const sql = `DROP FUNCTION \`${this._schema}\`.\`${params.func}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -822,7 +871,7 @@ export class MySQLClient extends AntaresCore {
const body = func.returns ? func.sql : 'BEGIN\n RETURN 0;\nEND'; const body = func.returns ? func.sql : 'BEGIN\n RETURN 0;\nEND';
const sql = `CREATE ${func.definer ? `DEFINER=${func.definer} ` : ''}FUNCTION \`${func.name}\`(${parameters}) RETURNS ${func.returns || 'SMALLINT'}${func.returnsLength ? `(${func.returnsLength})` : ''} const sql = `CREATE ${func.definer ? `DEFINER=${func.definer} ` : ''}FUNCTION \`${this._schema}\`.\`${func.name}\`(${parameters}) RETURNS ${func.returns || 'SMALLINT'}${func.returnsLength ? `(${func.returnsLength})` : ''}
LANGUAGE SQL LANGUAGE SQL
${func.deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'} ${func.deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'}
${func.dataAccess} ${func.dataAccess}
@@ -874,7 +923,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropEvent (params) { async dropEvent (params) {
const sql = `DROP EVENT \`${params.scheduler}\``; const sql = `DROP EVENT \`${this._schema}\`.\`${params.scheduler}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -890,13 +939,13 @@ export class MySQLClient extends AntaresCore {
if (scheduler.execution === 'EVERY' && scheduler.every[0].includes('-')) if (scheduler.execution === 'EVERY' && scheduler.every[0].includes('-'))
scheduler.every[0] = `'${scheduler.every[0]}'`; scheduler.every[0] = `'${scheduler.every[0]}'`;
const sql = `ALTER ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${scheduler.oldName}\` const sql = `ALTER ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${this._schema}\`.\`${scheduler.oldName}\`
ON SCHEDULE ON SCHEDULE
${scheduler.execution === 'EVERY' ${scheduler.execution === 'EVERY'
? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}` ? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
: `AT '${scheduler.at}'`} : `AT '${scheduler.at}'`}
ON COMPLETION${!scheduler.preserve ? ' NOT' : ''} PRESERVE ON COMPLETION${!scheduler.preserve ? ' NOT' : ''} PRESERVE
${scheduler.name !== scheduler.oldName ? `RENAME TO \`${scheduler.name}\`` : ''} ${scheduler.name !== scheduler.oldName ? `RENAME TO \`${this._schema}\`.\`${scheduler.name}\`` : ''}
${scheduler.state} ${scheduler.state}
COMMENT '${scheduler.comment}' COMMENT '${scheduler.comment}'
DO ${scheduler.sql}`; DO ${scheduler.sql}`;
@@ -911,7 +960,7 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createEvent (scheduler) { async createEvent (scheduler) {
const sql = `CREATE ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${scheduler.name}\` const sql = `CREATE ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${this._schema}\`.\`${scheduler.name}\`
ON SCHEDULE ON SCHEDULE
${scheduler.execution === 'EVERY' ${scheduler.execution === 'EVERY'
? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}` ? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
@@ -1048,7 +1097,7 @@ export class MySQLClient extends AntaresCore {
engine engine
} = params; } = params;
const sql = `CREATE TABLE \`${name}\` (\`${name}_ID\` INT NULL) COMMENT='${comment}', COLLATE='${collation}', ENGINE=${engine}`; const sql = `CREATE TABLE \`${this._schema}\`.\`${name}\` (\`${name}_ID\` INT NULL) COMMENT='${comment}', COLLATE='${collation}', ENGINE=${engine}`;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -1070,7 +1119,7 @@ export class MySQLClient extends AntaresCore {
options options
} = params; } = params;
let sql = `ALTER TABLE \`${this._schema}\`.\`${table}\` `; let sql = `ALTER TABLE \`${this._schema || params.options.schema}\`.\`${table}\` `;
const alterColumns = []; const alterColumns = [];
// OPTIONS // OPTIONS
@@ -1082,7 +1131,7 @@ export class MySQLClient extends AntaresCore {
// ADD FIELDS // ADD FIELDS
additions.forEach(addition => { additions.forEach(addition => {
const typeInfo = this._getTypeInfo(addition.type); const typeInfo = this._getTypeInfo(addition.type);
const length = typeInfo.length ? addition.numLength || addition.charLength || addition.datePrecision : false; const length = typeInfo.length ? addition.enumValues || addition.numLength || addition.charLength || addition.datePrecision : false;
alterColumns.push(`ADD COLUMN \`${addition.name}\` alterColumns.push(`ADD COLUMN \`${addition.name}\`
${addition.type.toUpperCase()}${length ? `(${length})` : ''} ${addition.type.toUpperCase()}${length ? `(${length})` : ''}
@@ -1182,7 +1231,7 @@ export class MySQLClient extends AntaresCore {
sql += alterColumns.join(', '); sql += alterColumns.join(', ');
// RENAME // RENAME
if (options.name) sql += `; RENAME TABLE \`${table}\` TO \`${options.name}\``; if (options.name) sql += `; RENAME TABLE \`${this._schema}\`.\`${table}\` TO \`${this._schema}\`.\`${options.name}\``;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -1260,7 +1309,10 @@ export class MySQLClient extends AntaresCore {
// LIMIT // LIMIT
const limitRaw = this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : ''; const limitRaw = this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : '';
return `${selectRaw}${updateRaw ? 'UPDATE' : ''}${insertRaw ? 'INSERT ' : ''}${this._query.delete ? 'DELETE ' : ''}${fromRaw}${updateRaw}${whereRaw}${groupByRaw}${orderByRaw}${limitRaw}${insertRaw}`; // OFFSET
const offsetRaw = this._query.offset.length ? `OFFSET ${this._query.offset.join(', ')} ` : '';
return `${selectRaw}${updateRaw ? 'UPDATE' : ''}${insertRaw ? 'INSERT ' : ''}${this._query.delete ? 'DELETE ' : ''}${fromRaw}${updateRaw}${whereRaw}${groupByRaw}${orderByRaw}${limitRaw}${offsetRaw}${insertRaw}`;
} }
/** /**
@@ -1273,18 +1325,29 @@ export class MySQLClient extends AntaresCore {
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async raw (sql, args) { async raw (sql, args) {
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder
args = { args = {
nest: false, nest: false,
details: false, details: false,
split: true, split: true,
...args ...args
}; };
const nestTables = args.nest ? '.' : false; const nestTables = args.nest ? '.' : false;
const resultsArr = []; const resultsArr = [];
let paramsArr = []; let paramsArr = [];
const queries = args.split ? sql.split(/((?:[^;'"]*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*')[^;'"]*)+)|;/gm) : [sql]; const queries = args.split
? sql.split(/((?:[^;'"]*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*')[^;'"]*)+)|;/gm)
.filter(Boolean)
.map(q => q.trim())
: [sql];
const isPool = typeof this._connection.getConnection === 'function';
const connection = isPool ? await this._connection.getConnection() : this._connection;
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder if (args.schema)
await connection.query(`USE \`${args.schema}\``);
for (const query of queries) { for (const query of queries) {
if (!query) continue; if (!query) continue;
@@ -1293,13 +1356,10 @@ export class MySQLClient extends AntaresCore {
let keysArr = []; let keysArr = [];
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => { const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
this._connection.query({ sql: query, nestTables }, async (err, response, fields) => { connection.query({ sql: query, nestTables }).then(async ([response, fields]) => {
timeStop = new Date(); timeStop = new Date();
const queryResult = response; const queryResult = response;
if (err)
reject(err);
else {
let remappedFields = fields let remappedFields = fields
? fields.map(field => { ? fields.map(field => {
if (!field || Array.isArray(field)) if (!field || Array.isArray(field))
@@ -1341,11 +1401,12 @@ export class MySQLClient extends AntaresCore {
remappedFields = remappedFields.map(field => { remappedFields = remappedFields.map(field => {
const detailedField = response.find(f => f.name === field.name); const detailedField = response.find(f => f.name === field.name);
if (detailedField && field.orgTable === paramObj.table && field.schema === paramObj.schema) if (detailedField && field.orgTable === paramObj.table && field.schema === paramObj.schema)
field = { ...detailedField, ...field }; field = { ...field, ...detailedField };
return field; return field;
}); });
} }
catch (err) { catch (err) {
if (isPool) connection.release();
reject(err); reject(err);
} }
@@ -1354,6 +1415,7 @@ export class MySQLClient extends AntaresCore {
keysArr = keysArr ? [...keysArr, ...response] : response; keysArr = keysArr ? [...keysArr, ...response] : response;
} }
catch (err) { catch (err) {
if (isPool) connection.release();
reject(err); reject(err);
} }
} }
@@ -1367,13 +1429,17 @@ export class MySQLClient extends AntaresCore {
fields: remappedFields, fields: remappedFields,
keys: keysArr keys: keysArr
}); });
} }).catch((err) => {
if (isPool) connection.release();
reject(err);
}); });
}); });
resultsArr.push({ rows, report, fields, keys, duration }); resultsArr.push({ rows, report, fields, keys, duration });
} }
if (isPool) connection.release();
return resultsArr.length === 1 ? resultsArr[0] : resultsArr; return resultsArr.length === 1 ? resultsArr[0] : resultsArr;
} }
} }

View File

@@ -496,17 +496,33 @@ export class PostgreSQLClient extends AntaresCore {
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async getTriggerInformations ({ schema, trigger }) { async getTriggerInformations ({ schema, trigger }) {
const sql = `SHOW CREATE TRIGGER \`${schema}\`.\`${trigger}\``; const [table, triggerName] = trigger.split('.');
const results = await this.raw(sql);
const results = await this.raw(`
SELECT event_object_schema AS table_schema,
event_object_table AS table_name,
trigger_schema,
trigger_name,
string_agg(event_manipulation, ',') AS event,
action_timing AS activation,
action_condition AS condition,
action_statement AS definition
FROM information_schema.triggers
WHERE trigger_schema = '${schema}'
AND trigger_name = '${triggerName}'
AND event_object_table = '${table}'
GROUP BY 1,2,3,4,6,7,8
ORDER BY table_schema,
table_name
`);
return results.rows.map(row => { return results.rows.map(row => {
return { return {
definer: row['SQL Original Statement'].match(/(?<=DEFINER=).*?(?=\s)/gs)[0], sql: row.definition,
sql: row['SQL Original Statement'].match(/(BEGIN|begin)(.*)(END|end)/gs)[0], name: row.trigger_name,
name: row.Trigger, table: row.table_name,
table: row['SQL Original Statement'].match(/(?<=ON `).*?(?=`)/gs)[0], event: row.event.split(','),
event1: row['SQL Original Statement'].match(/(BEFORE|AFTER)/gs)[0], activation: row.activation
event2: row['SQL Original Statement'].match(/(INSERT|UPDATE|DELETE)/gs)[0]
}; };
})[0]; })[0];
} }
@@ -519,7 +535,7 @@ export class PostgreSQLClient extends AntaresCore {
*/ */
async dropTrigger (params) { async dropTrigger (params) {
const triggerParts = params.trigger.split('.'); const triggerParts = params.trigger.split('.');
const sql = `DROP TRIGGER ${triggerParts[1]} ON ${triggerParts[0]}`; const sql = `DROP TRIGGER "${triggerParts[1]}" ON "${triggerParts[0]}"`;
return await this.raw(sql); return await this.raw(sql);
} }
@@ -536,8 +552,8 @@ export class PostgreSQLClient extends AntaresCore {
try { try {
await this.createTrigger(tempTrigger); await this.createTrigger(tempTrigger);
await this.dropTrigger({ trigger: tempTrigger.name }); await this.dropTrigger({ trigger: `${tempTrigger.table}.${tempTrigger.name}` });
await this.dropTrigger({ trigger: trigger.oldName }); await this.dropTrigger({ trigger: `${trigger.table}.${trigger.oldName}` });
await this.createTrigger(trigger); await this.createTrigger(trigger);
} }
catch (err) { catch (err) {
@@ -552,7 +568,8 @@ export class PostgreSQLClient extends AntaresCore {
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async createTrigger (trigger) { async createTrigger (trigger) {
const sql = `CREATE ${trigger.definer ? `DEFINER=${trigger.definer} ` : ''}TRIGGER \`${trigger.name}\` ${trigger.event1} ${trigger.event2} ON \`${trigger.table}\` FOR EACH ROW ${trigger.sql}`; const eventsString = Array.isArray(trigger.event) ? trigger.event.join(' OR ') : trigger.event;
const sql = `CREATE TRIGGER "${trigger.name}" ${trigger.activation} ${eventsString} ON "${trigger.table}" FOR EACH ROW ${trigger.sql}`;
return await this.raw(sql, { split: false }); return await this.raw(sql, { split: false });
} }
@@ -816,97 +833,6 @@ export class PostgreSQLClient extends AntaresCore {
return await this.raw(sql, { split: false }); return await this.raw(sql, { split: false });
} }
/**
* SHOW CREATE EVENT
*
* @returns {Array.<Object>} view informations
* @memberof PostgreSQLClient
*/
// async getEventInformations ({ schema, scheduler }) {
// const sql = `SHOW CREATE EVENT \`${schema}\`.\`${scheduler}\``;
// const results = await this.raw(sql);
// return results.rows.map(row => {
// const schedule = row['Create Event'];
// const execution = schedule.includes('EVERY') ? 'EVERY' : 'ONCE';
// const every = execution === 'EVERY' ? row['Create Event'].match(/(?<=EVERY )(\s*([^\s]+)){0,2}/gs)[0].replaceAll('\'', '').split(' ') : [];
// const starts = execution === 'EVERY' && schedule.includes('STARTS') ? schedule.match(/(?<=STARTS ').*?(?='\s)/gs)[0] : '';
// const ends = execution === 'EVERY' && schedule.includes('ENDS') ? schedule.match(/(?<=ENDS ').*?(?='\s)/gs)[0] : '';
// const at = execution === 'ONCE' && schedule.includes('AT') ? schedule.match(/(?<=AT ').*?(?='\s)/gs)[0] : '';
// return {
// definer: row['Create Event'].match(/(?<=DEFINER=).*?(?=\s)/gs)[0],
// sql: row['Create Event'].match(/(?<=DO )(.*)/gs)[0],
// name: row.Event,
// comment: row['Create Event'].match(/(?<=COMMENT ').*?(?=')/gs) ? row['Create Event'].match(/(?<=COMMENT ').*?(?=')/gs)[0] : '',
// state: row['Create Event'].includes('ENABLE') ? 'ENABLE' : row['Create Event'].includes('DISABLE ON SLAVE') ? 'DISABLE ON SLAVE' : 'DISABLE',
// preserve: row['Create Event'].includes('ON COMPLETION PRESERVE'),
// execution,
// every,
// starts,
// ends,
// at
// };
// })[0];
// }
/**
* DROP EVENT
*
* @returns {Array.<Object>} parameters
* @memberof PostgreSQLClient
*/
// async dropEvent (params) {
// const sql = `DROP EVENT \`${params.scheduler}\``;
// return await this.raw(sql);
// }
/**
* ALTER EVENT
*
* @returns {Array.<Object>} parameters
* @memberof PostgreSQLClient
*/
// async alterEvent (params) {
// const { scheduler } = params;
// if (scheduler.execution === 'EVERY' && scheduler.every[0].includes('-'))
// scheduler.every[0] = `'${scheduler.every[0]}'`;
// const sql = `ALTER ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${scheduler.oldName}\`
// ON SCHEDULE
// ${scheduler.execution === 'EVERY'
// ? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
// : `AT '${scheduler.at}'`}
// ON COMPLETION${!scheduler.preserve ? ' NOT' : ''} PRESERVE
// ${scheduler.name !== scheduler.oldName ? `RENAME TO \`${scheduler.name}\`` : ''}
// ${scheduler.state}
// COMMENT '${scheduler.comment}'
// DO ${scheduler.sql}`;
// return await this.raw(sql, { split: false });
// }
/**
* CREATE EVENT
*
* @returns {Array.<Object>} parameters
* @memberof PostgreSQLClient
*/
// async createEvent (scheduler) {
// const sql = `CREATE ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${scheduler.name}\`
// ON SCHEDULE
// ${scheduler.execution === 'EVERY'
// ? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
// : `AT '${scheduler.at}'`}
// ON COMPLETION${!scheduler.preserve ? ' NOT' : ''} PRESERVE
// ${scheduler.state}
// COMMENT '${scheduler.comment}'
// DO ${scheduler.sql}`;
// return await this.raw(sql, { split: false });
// }
/** /**
* SELECT * FROM pg_collation * SELECT * FROM pg_collation
* *
@@ -1230,7 +1156,10 @@ export class PostgreSQLClient extends AntaresCore {
// LIMIT // LIMIT
const limitRaw = selectArray.length && this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : ''; const limitRaw = selectArray.length && this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : '';
return `${selectRaw}${updateRaw ? 'UPDATE' : ''}${insertRaw ? 'INSERT ' : ''}${this._query.delete ? 'DELETE ' : ''}${fromRaw}${updateRaw}${whereRaw}${groupByRaw}${orderByRaw}${limitRaw}${insertRaw}`; // OFFSET
const offsetRaw = selectArray.length && this._query.offset.length ? `OFFSET ${this._query.offset.join(', ')} ` : '';
return `${selectRaw}${updateRaw ? 'UPDATE' : ''}${insertRaw ? 'INSERT ' : ''}${this._query.delete ? 'DELETE ' : ''}${fromRaw}${updateRaw}${whereRaw}${groupByRaw}${orderByRaw}${limitRaw}${offsetRaw}${insertRaw}`;
} }
/** /**
@@ -1243,6 +1172,8 @@ export class PostgreSQLClient extends AntaresCore {
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async raw (sql, args) { async raw (sql, args) {
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');
args = { args = {
nest: false, nest: false,
details: false, details: false,
@@ -1250,12 +1181,16 @@ export class PostgreSQLClient extends AntaresCore {
...args ...args
}; };
if (args.nest && this._schema !== 'public') if (args.schema && args.schema !== 'public')
await this.use(this._schema); await this.use(args.schema);
const resultsArr = []; const resultsArr = [];
let paramsArr = []; let paramsArr = [];
const queries = args.split ? sql.split(/(?!\B'[^']*);(?![^']*'\B)/gm) : [sql]; const queries = args.split
? sql.split(/(?!\B'[^']*);(?![^']*'\B)/gm)
.filter(Boolean)
.map(q => q.trim())
: [sql];
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder

View File

@@ -34,6 +34,7 @@ export default {
computed: { computed: {
...mapGetters({ ...mapGetters({
editorTheme: 'settings/getEditorTheme', editorTheme: 'settings/getEditorTheme',
editorFontSize: 'settings/getEditorFontSize',
autoComplete: 'settings/getAutoComplete', autoComplete: 'settings/getAutoComplete',
lineWrap: 'settings/getLineWrap' lineWrap: 'settings/getLineWrap'
}) })
@@ -47,6 +48,19 @@ export default {
if (this.editor) if (this.editor)
this.editor.setTheme(`ace/theme/${this.editorTheme}`); this.editor.setTheme(`ace/theme/${this.editorTheme}`);
}, },
editorFontSize () {
const sizes = {
small: '12px',
medium: '14px',
large: '16px'
};
if (this.editor) {
this.editor.setOptions({
fontSize: sizes[this.editorFontSize]
});
}
},
autoComplete () { autoComplete () {
if (this.editor) { if (this.editor) {
this.editor.setOptions({ this.editor.setOptions({

View File

@@ -66,6 +66,21 @@
:type="inputProps().type" :type="inputProps().type"
:disabled="!isChecked" :disabled="!isChecked"
> >
<select
v-else-if="enumArray"
v-model="selectedValue"
class="form-select"
:disabled="!isChecked"
@change="onChange"
>
<option
v-for="val in enumArray"
:key="val"
:value="val"
>
{{ val }}
</option>
</select>
<input <input
v-else v-else
ref="formInput" ref="formInput"
@@ -121,7 +136,8 @@ export default {
selectedMethod: '', selectedMethod: '',
selectedValue: '', selectedValue: '',
debounceTimeout: null, debounceTimeout: null,
methodParams: {} methodParams: {},
enumArray: null
}; };
}, },
computed: { computed: {
@@ -150,8 +166,14 @@ export default {
}, },
watch: { watch: {
fieldObj () { fieldObj () {
if (this.fieldObj) if (this.fieldObj) {
if (Array.isArray(this.fieldObj.value)) {
this.enumArray = this.fieldObj.value;
this.selectedValue = this.fieldObj.value[0];
}
else
this.selectedValue = this.fieldObj.value; this.selectedValue = this.fieldObj.value;
}
}, },
selectedGroup () { selectedGroup () {
if (this.fakerMethods.length) if (this.fakerMethods.length)

View File

@@ -51,7 +51,8 @@ export default {
}), }),
isValidDefault () { isValidDefault () {
if (!this.foreignList.length) return true; if (!this.foreignList.length) return true;
return this.value === null || this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString()); if (this.value === null) return false;
return this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString());
} }
}, },
async created () { async created () {
@@ -65,7 +66,7 @@ export default {
try { // Field data try { // Field data
const { status, response } = await Tables.getTableColumns(params); const { status, response } = await Tables.getTableColumns(params);
if (status === 'success') { if (status === 'success') {
const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type)); const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type) && field.name !== this.keyUsage.refField);
foreignDesc = textField ? textField.name : false; foreignDesc = textField ? textField.name : false;
} }
else else

View File

@@ -8,7 +8,8 @@
> >
<template slot="header"> <template slot="header">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-play mr-1" /> {{ $t('word.parameters') }}: {{ localRoutine.name }} <i class="mdi mdi-24px mdi-play mr-1" />
<span class="cut-text">{{ $t('word.parameters') }}: {{ localRoutine.name }}</span>
</div> </div>
</template> </template>
<div slot="body"> <div slot="body">
@@ -19,10 +20,10 @@
:key="parameter._id" :key="parameter._id"
class="form-group" class="form-group"
> >
<div class="col-3"> <div class="col-4">
<label class="form-label">{{ parameter.name }}</label> <label class="form-label">{{ parameter.name }}</label>
</div> </div>
<div class="col-9"> <div class="col-8">
<div class="input-group"> <div class="input-group">
<input <input
:ref="i === 0 ? 'firstInput' : ''" :ref="i === 0 ? 'firstInput' : ''"

View File

@@ -5,7 +5,8 @@
<div class="modal-header pl-2"> <div class="modal-header pl-2">
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-database-edit mr-1" /> {{ $t('message.editSchema') }} <i class="mdi mdi-24px mdi-database-edit mr-1" />
<span class="cut-text">{{ $t('message.editSchema') }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click.stop="closeModal" /> <a class="btn btn-clear c-hand" @click.stop="closeModal" />

View File

@@ -5,7 +5,8 @@
<div class="modal-header pl-2"> <div class="modal-header pl-2">
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-plus mr-1" /> {{ $t('message.tableFiller') }} <i class="mdi mdi-24px mdi-playlist-plus mr-1" />
<span class="cut-text">{{ $t('message.tableFiller') }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click.stop="closeModal" /> <a class="btn btn-clear c-hand" @click.stop="closeModal" />
@@ -250,10 +251,15 @@ export default {
if (field.default === 'NULL') fieldDefault = null; if (field.default === 'NULL') fieldDefault = null;
else { else {
if ([...NUMBER, ...FLOAT].includes(field.type)) if ([...NUMBER, ...FLOAT].includes(field.type))
fieldDefault = +field.default; fieldDefault = Number.isNaN(+field.default) ? null : +field.default;
if ([...TEXT, ...LONG_TEXT].includes(field.type)) if ([...TEXT, ...LONG_TEXT].includes(field.type)) {
fieldDefault = field.default ? field.default.substring(1, field.default.length - 1) : ''; fieldDefault = field.default
? field.default.includes('\'')
? field.default.split('\'')[1]
: field.default
: '';
}
if ([...TIME, ...DATE].includes(field.type)) if ([...TIME, ...DATE].includes(field.type))
fieldDefault = field.default; fieldDefault = field.default;
@@ -269,6 +275,9 @@ export default {
fieldDefault = moment().format(`YYYY-MM-DD HH:mm:ss${datePrecision}`); fieldDefault = moment().format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
} }
} }
if (field.enumValues)
fieldDefault = field.enumValues.replaceAll('\'', '').split(',');
} }
rowObj[field.name] = { value: fieldDefault }; rowObj[field.name] = { value: fieldDefault };

View File

@@ -5,7 +5,8 @@
<div class="modal-header pl-2"> <div class="modal-header pl-2">
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-server-plus mr-1" /> {{ $t('message.createNewConnection') }} <i class="mdi mdi-24px mdi-server-plus mr-1" />
<span class="cut-text">{{ $t('message.createNewConnection') }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click="closeModal" /> <a class="btn btn-clear c-hand" @click="closeModal" />

View File

@@ -5,7 +5,8 @@
<div class="modal-header pl-2"> <div class="modal-header pl-2">
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-database-plus mr-1" /> {{ $t('message.createNewSchema') }} <i class="mdi mdi-24px mdi-database-plus mr-1" />
<span class="cut-text">{{ $t('message.createNewSchema') }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click.stop="closeModal" /> <a class="btn btn-clear c-hand" @click.stop="closeModal" />

View File

@@ -5,7 +5,8 @@
<div class="modal-header pl-2"> <div class="modal-header pl-2">
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-plus mr-1" /> {{ $t('message.addNewRow') }} <i class="mdi mdi-24px mdi-playlist-plus mr-1" />
<span class="cut-text">{{ $t('message.addNewRow') }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click.stop="closeModal" /> <a class="btn btn-clear c-hand" @click.stop="closeModal" />

View File

@@ -71,11 +71,11 @@
</label> </label>
<div class="column"> <div class="column">
<div class="input-group"> <div class="input-group">
<select v-model="localTrigger.event1" class="form-select"> <select v-model="localTrigger.activation" class="form-select">
<option>BEFORE</option> <option>BEFORE</option>
<option>AFTER</option> <option>AFTER</option>
</select> </select>
<select v-model="localTrigger.event2" class="form-select"> <select v-model="localTrigger.event" class="form-select">
<option>INSERT</option> <option>INSERT</option>
<option>UPDATE</option> <option>UPDATE</option>
<option>DELETE</option> <option>DELETE</option>
@@ -106,8 +106,8 @@ export default {
sql: 'BEGIN\r\n\r\nEND', sql: 'BEGIN\r\n\r\nEND',
name: '', name: '',
table: '', table: '',
event1: 'BEFORE', activation: 'BEFORE',
event2: 'INSERT' event: 'INSERT'
}, },
isOptionsChanging: false isOptionsChanging: false
}; };

View File

@@ -5,7 +5,8 @@
<div class="modal-header pl-2"> <div class="modal-header pl-2">
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-memory mr-1" /> {{ $t('message.processesList') }}: {{ connectionName }} <i class="mdi mdi-24px mdi-memory mr-1" />
<span class="cut-text">{{ $t('message.processesList') }}: {{ connectionName }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click.stop="closeModal" /> <a class="btn btn-clear c-hand" @click.stop="closeModal" />

View File

@@ -6,7 +6,7 @@
<div class="modal-title h6"> <div class="modal-title h6">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-cog mr-1" /> <i class="mdi mdi-24px mdi-cog mr-1" />
{{ $t('word.settings') }} <span class="cut-text">{{ $t('word.settings') }}</span>
</div> </div>
</div> </div>
<a class="btn btn-clear c-hand" @click="closeModal" /> <a class="btn btn-clear c-hand" @click="closeModal" />
@@ -83,6 +83,27 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<div class="col-6 col-sm-12">
<label class="form-label">
{{ $t('message.dataTabPageSize') }}
</label>
</div>
<div class="col-6 col-sm-12">
<select
v-model="localPageSize"
class="form-select"
@change="changePageSize(+localPageSize)"
>
<option
v-for="size in pageSizes"
:key="size"
>
{{ size }}
</option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="col-6 col-sm-12"> <div class="col-6 col-sm-12">
<label class="form-label"> <label class="form-label">
@@ -201,6 +222,31 @@
</optgroup> </optgroup>
</select> </select>
</div> </div>
<div class="column col-6 mb-4">
<div class="btn-group btn-group-block">
<button
class="btn btn-dark cut-text"
:class="{'active': editorFontSize === 'small'}"
@click="changeEditorFontSize('small')"
>
{{ $t('word.small') }}
</button>
<button
class="btn btn-dark cut-text"
:class="{'active': editorFontSize === 'medium'}"
@click="changeEditorFontSize('medium')"
>
{{ $t('word.medium') }}
</button>
<button
class="btn btn-dark cut-text"
:class="{'active': editorFontSize === 'large'}"
@click="changeEditorFontSize('large')"
>
{{ $t('word.large') }}
</button>
</div>
</div>
<div class="column col-12"> <div class="column col-12">
<BaseTextEditor <BaseTextEditor
:value="exampleQuery" :value="exampleQuery"
@@ -227,7 +273,7 @@
<h4>{{ appName }}</h4> <h4>{{ appName }}</h4>
<p> <p>
{{ $t('word.version') }} {{ appVersion }}<br> {{ $t('word.version') }} {{ appVersion }}<br>
<a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares')">GitHub</a> | <a class="c-hand" @click="openOutside('https://antares-sql.app/')">Website</a><br> <a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares')"><i class="mdi mdi-github d-inline" /> GitHub</a> <a class="c-hand" @click="openOutside('https://twitter.com/AntaresSQL')"><i class="mdi mdi-twitter d-inline" /> Twitter</a> <a class="c-hand" @click="openOutside('https://antares-sql.app/')"><i class="mdi mdi-web d-inline" /> Website</a><br>
<small>{{ $t('word.author') }} <a class="c-hand" @click="openOutside('https://github.com/Fabio286')">Fabio Di Stasio</a></small><br> <small>{{ $t('word.author') }} <a class="c-hand" @click="openOutside('https://github.com/Fabio286')">Fabio Di Stasio</a></small><br>
<small>{{ $t('message.madeWithJS') }}</small> <small>{{ $t('message.madeWithJS') }}</small>
</p> </p>
@@ -257,9 +303,11 @@ export default {
data () { data () {
return { return {
localLocale: null, localLocale: null,
localPageSize: null,
localTimeout: null, localTimeout: null,
localEditorTheme: null, localEditorTheme: null,
selectedTab: 'general', selectedTab: 'general',
pageSizes: [40, 100, 250, 500, 1000],
editorThemes: [ editorThemes: [
{ {
group: this.$t('word.light'), group: this.$t('word.light'),
@@ -317,11 +365,13 @@ export default {
appVersion: 'application/appVersion', appVersion: 'application/appVersion',
selectedSettingTab: 'application/selectedSettingTab', selectedSettingTab: 'application/selectedSettingTab',
selectedLocale: 'settings/getLocale', selectedLocale: 'settings/getLocale',
pageSize: 'settings/getDataTabLimit',
selectedAutoComplete: 'settings/getAutoComplete', selectedAutoComplete: 'settings/getAutoComplete',
selectedLineWrap: 'settings/getLineWrap', selectedLineWrap: 'settings/getLineWrap',
notificationsTimeout: 'settings/getNotificationsTimeout', notificationsTimeout: 'settings/getNotificationsTimeout',
applicationTheme: 'settings/getApplicationTheme', applicationTheme: 'settings/getApplicationTheme',
editorTheme: 'settings/getEditorTheme', editorTheme: 'settings/getEditorTheme',
editorFontSize: 'settings/getEditorFontSize',
updateStatus: 'application/getUpdateStatus', updateStatus: 'application/getUpdateStatus',
selectedWorkspace: 'workspaces/getSelected', selectedWorkspace: 'workspaces/getSelected',
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace'
@@ -359,6 +409,7 @@ ORDER BY
}, },
created () { created () {
this.localLocale = this.selectedLocale; this.localLocale = this.selectedLocale;
this.localPageSize = this.pageSize;
this.localTimeout = this.notificationsTimeout; this.localTimeout = this.notificationsTimeout;
this.localEditorTheme = this.editorTheme; this.localEditorTheme = this.editorTheme;
this.selectedTab = this.selectedSettingTab; this.selectedTab = this.selectedSettingTab;
@@ -371,10 +422,12 @@ ORDER BY
...mapActions({ ...mapActions({
closeModal: 'application/hideSettingModal', closeModal: 'application/hideSettingModal',
changeLocale: 'settings/changeLocale', changeLocale: 'settings/changeLocale',
changePageSize: 'settings/changePageSize',
changeAutoComplete: 'settings/changeAutoComplete', changeAutoComplete: 'settings/changeAutoComplete',
changeLineWrap: 'settings/changeLineWrap', changeLineWrap: 'settings/changeLineWrap',
changeApplicationTheme: 'settings/changeApplicationTheme', changeApplicationTheme: 'settings/changeApplicationTheme',
changeEditorTheme: 'settings/changeEditorTheme', changeEditorTheme: 'settings/changeEditorTheme',
changeEditorFontSize: 'settings/changeEditorFontSize',
updateNotificationsTimeout: 'settings/updateNotificationsTimeout' updateNotificationsTimeout: 'settings/updateNotificationsTimeout'
}), }),
selectTab (tab) { selectTab (tab) {

View File

@@ -38,6 +38,7 @@ export default {
computed: { computed: {
...mapGetters({ ...mapGetters({
editorTheme: 'settings/getEditorTheme', editorTheme: 'settings/getEditorTheme',
editorFontSize: 'settings/getEditorFontSize',
autoComplete: 'settings/getAutoComplete', autoComplete: 'settings/getAutoComplete',
lineWrap: 'settings/getLineWrap', lineWrap: 'settings/getLineWrap',
baseCompleter: 'application/getBaseCompleter' baseCompleter: 'application/getBaseCompleter'
@@ -158,6 +159,19 @@ export default {
if (this.editor) if (this.editor)
this.editor.setTheme(`ace/theme/${this.editorTheme}`); this.editor.setTheme(`ace/theme/${this.editorTheme}`);
}, },
editorFontSize () {
const sizes = {
small: '12px',
medium: '14px',
large: '16px'
};
if (this.editor) {
this.editor.setOptions({
fontSize: sizes[this.editorFontSize]
});
}
},
autoComplete () { autoComplete () {
if (this.editor) { if (this.editor) {
this.editor.setOptions({ this.editor.setOptions({

View File

@@ -20,7 +20,8 @@
> >
<template slot="header"> <template slot="header">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-delete mr-1" /> {{ deleteMessage }} <i class="mdi mdi-24px mdi-delete mr-1" />
<span class="cut-text">{{ deleteMessage }}</span>
</div> </div>
</template> </template>
<div slot="body"> <div slot="body">

View File

@@ -69,7 +69,8 @@
> >
<template slot="header"> <template slot="header">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-database-remove mr-1" /> {{ $t('message.deleteSchema') }} <i class="mdi mdi-24px mdi-database-remove mr-1" />
<span class="cut-text">{{ $t('message.deleteSchema') }}</span>
</div> </div>
</template> </template>
<div slot="body"> <div slot="body">

View File

@@ -21,7 +21,7 @@
> >
<template slot="header"> <template slot="header">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-table-off mr-1" /> {{ $t('message.emptyTable') }} <i class="mdi mdi-24px mdi-table-off mr-1" /> <span class="cut-text">{{ $t('message.emptyTable') }}</span>
</div> </div>
</template> </template>
<div slot="body"> <div slot="body">
@@ -37,7 +37,8 @@
> >
<template slot="header"> <template slot="header">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-table-remove mr-1" /> {{ selectedTable.type === 'table' ? $t('message.deleteTable') : $t('message.deleteView') }} <i class="mdi mdi-24px mdi-table-remove mr-1" />
<span class="cut-text">{{ selectedTable.type === 'table' ? $t('message.deleteTable') : $t('message.deleteView') }}</span>
</div> </div>
</template> </template>
<div slot="body"> <div slot="body">

View File

@@ -8,7 +8,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-key-link mr-1" /> {{ $t('word.foreignKeys') }} "{{ table }}" <i class="mdi mdi-24px mdi-key-link mr-1" />
<span class="cut-text">{{ $t('word.foreignKeys') }} "{{ table }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -7,7 +7,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-cogs mr-1" /> {{ $t('word.options') }} "{{ localOptions.name }}" <i class="mdi mdi-24px mdi-cogs mr-1" />
<span class="cut-text">{{ $t('word.options') }} "{{ localOptions.name }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -8,7 +8,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-dots-horizontal mr-1" /> {{ $t('word.parameters') }} "{{ func }}" <i class="mdi mdi-24px mdi-dots-horizontal mr-1" />
<span class="cut-text">{{ $t('word.parameters') }} "{{ func }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -8,7 +8,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-key mdi-rotate-45 mr-1" /> {{ $t('word.indexes') }} "{{ table }}" <i class="mdi mdi-24px mdi-key mdi-rotate-45 mr-1" />
<span class="cut-text">{{ $t('word.indexes') }} "{{ table }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -7,7 +7,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-cogs mr-1" /> {{ $t('word.options') }} "{{ table }}" <i class="mdi mdi-24px mdi-cogs mr-1" />
<span class="cut-text">{{ $t('word.options') }} "{{ table }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -7,7 +7,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-cogs mr-1" /> {{ $t('word.options') }} "{{ localOptions.name }}" <i class="mdi mdi-24px mdi-cogs mr-1" />
<span class="cut-text">{{ $t('word.options') }} "{{ localOptions.name }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -8,7 +8,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-dots-horizontal mr-1" /> {{ $t('word.parameters') }} "{{ routine }}" <i class="mdi mdi-24px mdi-dots-horizontal mr-1" />
<span class="cut-text">{{ $t('word.parameters') }} "{{ routine }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -7,7 +7,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-timer mr-1" /> {{ $t('word.timing') }} "{{ localOptions.name }}" <i class="mdi mdi-24px mdi-timer mr-1" />
<span class="cut-text">{{ $t('word.timing') }} "{{ localOptions.name }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">

View File

@@ -239,11 +239,11 @@ export default {
field.defaultType = 'noval'; field.defaultType = 'noval';
else if (field.default === 'NULL') else if (field.default === 'NULL')
field.defaultType = 'null'; field.defaultType = 'null';
else if (field.default.match(/^\s*(\w+)\s*\((.*)\)$/)) else if (isNaN(+field.default) && field.default.charAt(0) !== '\'')
field.defaultType = 'expression'; field.defaultType = 'expression';
else { else {
field.defaultType = 'custom'; field.defaultType = 'custom';
if (isNaN(field.default) && !field.default.includes('\'')) if (isNaN(+field.default) && !field.default.includes('\''))
field.default = `'${field.default}'`; field.default = `'${field.default}'`;
} }

View File

@@ -37,7 +37,7 @@
> >
</div> </div>
</div> </div>
<div class="column col-auto"> <div v-if="customizations.definer" class="column col-auto">
<div class="form-group"> <div class="form-group">
<label class="form-label">{{ $t('word.definer') }}</label> <label class="form-label">{{ $t('word.definer') }}</label>
<select <select
@@ -67,7 +67,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="columns"> <fieldset class="columns" :disabled="customizations.triggerOnlyRename">
<div class="column col-auto"> <div class="column col-auto">
<div class="form-group"> <div class="form-group">
<label class="form-label">{{ $t('word.table') }}</label> <label class="form-label">{{ $t('word.table') }}</label>
@@ -82,19 +82,33 @@
<div class="form-group"> <div class="form-group">
<label class="form-label">{{ $t('word.event') }}</label> <label class="form-label">{{ $t('word.event') }}</label>
<div class="input-group"> <div class="input-group">
<select v-model="localTrigger.event1" class="form-select"> <select v-model="localTrigger.activation" class="form-select">
<option>BEFORE</option> <option>BEFORE</option>
<option>AFTER</option> <option>AFTER</option>
</select> </select>
<select v-model="localTrigger.event2" class="form-select"> <select
<option>INSERT</option> v-if="!customizations.triggerMultipleEvents"
<option>UPDATE</option> v-model="localTrigger.event"
<option>DELETE</option> class="form-select"
>
<option v-for="event in Object.keys(localEvents)" :key="event">
{{ event }}
</option>
</select> </select>
<div v-if="customizations.triggerMultipleEvents" class="px-4">
<label
v-for="event in Object.keys(localEvents)"
:key="event"
class="form-checkbox form-inline"
@change.prevent="changeEvents(event)"
>
<input :checked="localEvents[event]" type="checkbox"><i class="form-icon" /> {{ event }}
</label>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</fieldset>
</div> </div>
<div class="workspace-query-results column col-12 mt-2 p-relative"> <div class="workspace-query-results column col-12 mt-2 p-relative">
<BaseLoader v-if="isLoading" /> <BaseLoader v-if="isLoading" />
@@ -136,7 +150,8 @@ export default {
localTrigger: { sql: '' }, localTrigger: { sql: '' },
lastTrigger: null, lastTrigger: null,
sqlProxy: '', sqlProxy: '',
editorHeight: 300 editorHeight: 300,
localEvents: { INSERT: false, UPDATE: false, DELETE: false }
}; };
}, },
computed: { computed: {
@@ -147,6 +162,9 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
customizations () {
return this.workspace.customizations;
},
isSelected () { isSelected () {
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.trigger; return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.trigger;
}, },
@@ -209,6 +227,10 @@ export default {
async getTriggerData () { async getTriggerData () {
if (!this.trigger) return; if (!this.trigger) return;
Object.keys(this.localEvents).forEach(event => {
this.localEvents[event] = false;
});
this.localTrigger = { sql: '' }; this.localTrigger = { sql: '' };
this.isLoading = true; this.isLoading = true;
@@ -224,6 +246,12 @@ export default {
this.originalTrigger = response; this.originalTrigger = response;
this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger)); this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger));
this.sqlProxy = this.localTrigger.sql; this.sqlProxy = this.localTrigger.sql;
if (this.customizations.triggerMultipleEvents) {
this.originalTrigger.event.forEach(e => {
this.localEvents[e] = true;
});
}
} }
else else
this.addNotification({ status: 'error', message: response }); this.addNotification({ status: 'error', message: response });
@@ -235,6 +263,16 @@ export default {
this.resizeQueryEditor(); this.resizeQueryEditor();
this.isLoading = false; this.isLoading = false;
}, },
changeEvents (event) {
if (this.customizations.triggerMultipleEvents) {
this.localEvents[event] = !this.localEvents[event];
this.localTrigger.event = [];
for (const key in this.localEvents) {
if (this.localEvents[key])
this.localTrigger.event.push(key);
}
}
},
async saveChanges () { async saveChanges () {
if (this.isSaving) return; if (this.isSaving) return;
this.isSaving = true; this.isSaving = true;
@@ -257,7 +295,8 @@ export default {
if (oldName !== this.localTrigger.name) { if (oldName !== this.localTrigger.name) {
this.setUnsavedChanges(false); this.setUnsavedChanges(false);
this.changeBreadcrumbs({ schema: this.schema, trigger: this.localTrigger.name }); const triggerName = this.customizations.triggerTableInName ? `${this.localTrigger.table}.${this.localTrigger.name}` : this.localTrigger.name;
this.changeBreadcrumbs({ schema: this.schema, trigger: triggerName });
} }
this.getTriggerData(); this.getTriggerData();
@@ -274,6 +313,16 @@ export default {
clearChanges () { clearChanges () {
this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger)); this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger));
this.$refs.queryEditor.editor.session.setValue(this.localTrigger.sql); this.$refs.queryEditor.editor.session.setValue(this.localTrigger.sql);
Object.keys(this.localEvents).forEach(event => {
this.localEvents[event] = false;
});
if (this.customizations.triggerMultipleEvents) {
this.originalTrigger.event.forEach(e => {
this.localEvents[e] = true;
});
}
}, },
resizeQueryEditor () { resizeQueryEditor () {
if (this.$refs.queryEditor) { if (this.$refs.queryEditor) {

View File

@@ -96,8 +96,13 @@
class="cell-content" class="cell-content"
@dblclick="editON($event, localLength, 'length')" @dblclick="editON($event, localLength, 'length')"
> >
<span v-if="localRow.enumValues">
{{ localRow.enumValues }}
</span>
<span v-else>
{{ localLength }} {{ localLength }}
</span> </span>
</span>
<input <input
v-else-if="localRow.enumValues" v-else-if="localRow.enumValues"
ref="editField" ref="editField"
@@ -227,7 +232,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-edit mr-1" /> {{ $t('word.default') }} "{{ row.name }}" <i class="mdi mdi-24px mdi-playlist-edit mr-1" />
<span class="cut-text">{{ $t('word.default') }} "{{ row.name }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">
@@ -361,7 +367,7 @@ export default {
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace'
}), }),
localLength () { localLength () {
return this.localRow.enumValues || this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0; return this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
}, },
fieldType () { fieldType () {
const fieldType = this.dataTypes.reduce((acc, group) => [...acc, ...group.types], []).filter(type => const fieldType = this.dataTypes.reduce((acc, group) => [...acc, ...group.types], []).filter(type =>
@@ -445,8 +451,13 @@ export default {
this.defaultValue.onUpdate = this.localRow.onUpdate; this.defaultValue.onUpdate = this.localRow.onUpdate;
this.defaultValue.type = this.localRow.defaultType; this.defaultValue.type = this.localRow.defaultType;
if (this.defaultValue.type === 'custom') if (this.defaultValue.type === 'custom') {
this.defaultValue.custom = this.localRow.default; this.defaultValue.custom = this.localRow.default
? this.localRow.default.includes('\'')
? this.localRow.default.split('\'')[1]
: this.localRow.default
: '';
}
if (this.defaultValue.type === 'expression') if (this.defaultValue.type === 'expression')
this.defaultValue.expression = this.localRow.default; this.defaultValue.expression = this.localRow.default;
}, },
@@ -492,11 +503,13 @@ export default {
this.localRow.numLength = null; this.localRow.numLength = null;
this.localRow.charLength = null; this.localRow.charLength = null;
this.localRow.datePrecision = null; this.localRow.datePrecision = null;
this.localRow.enumValues = '';
if (this.fieldType.length) { if (this.fieldType.length) {
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.localRow.numLength = 11; if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.localRow.numLength = 11;
if (['string', 'other'].includes(this.fieldType.group)) this.localRow.charLength = 15; if (['string'].includes(this.fieldType.group)) this.localRow.charLength = 15;
if (['time'].includes(this.fieldType.group)) this.localRow.datePrecision = 0; if (['time'].includes(this.fieldType.group)) this.localRow.datePrecision = 0;
if (['other'].includes(this.fieldType.group)) this.localRow.enumValues = '\'valA\',\'valB\'';
} }
if (!this.fieldType.collation) if (!this.fieldType.collation)
@@ -523,7 +536,7 @@ export default {
break; break;
case 'custom': case 'custom':
this.localRow.autoIncrement = false; this.localRow.autoIncrement = false;
this.localRow.default = this.defaultValue.custom; this.localRow.default = Number.isNaN(+this.defaultValue.custom) ? `'${this.defaultValue.custom}'` : this.defaultValue.custom;
break; break;
case 'expression': case 'expression':
this.localRow.autoIncrement = false; this.localRow.autoIncrement = false;

View File

@@ -85,7 +85,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-delete mr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }} <i class="mdi mdi-24px mdi-delete mr-1" />
<span class="cut-text">{{ $tc('message.deleteRows', selectedRows.length) }}</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">
@@ -139,7 +140,8 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace',
pageSize: 'settings/getDataTabLimit'
}), }),
workspaceSchema () { workspaceSchema () {
return this.getWorkspace(this.connUid).breadcrumbs.schema; return this.getWorkspace(this.connUid).breadcrumbs.schema;
@@ -157,7 +159,7 @@ export default {
return this.fields.every(field => field.name); return this.fields.every(field => field.name);
}, },
isHardSort () { isHardSort () {
return this.mode === 'table' && this.localResults.length === 1000; return this.mode === 'table' && this.localResults.length === this.pageSize;
}, },
sortedResults () { sortedResults () {
if (this.currentSort && !this.isHardSort) { if (this.currentSort && !this.isHardSort) {
@@ -319,8 +321,6 @@ export default {
}, },
updateField (payload, row) { updateField (payload, row) {
const orgRow = this.localResults.find(lr => lr._id === row._id); const orgRow = this.localResults.find(lr => lr._id === row._id);
delete row._id;
delete orgRow._id;
Object.keys(orgRow).forEach(key => { // remap the row Object.keys(orgRow).forEach(key => { // remap the row
if (orgRow[key] instanceof Date && moment(orgRow[key]).isValid()) { // if datetime if (orgRow[key] instanceof Date && moment(orgRow[key]).isValid()) { // if datetime
@@ -347,7 +347,9 @@ export default {
closeContext () { closeContext () {
this.isContext = false; this.isContext = false;
}, },
showDeleteConfirmModal () { showDeleteConfirmModal (e) {
if (e && e.path && ['INPUT', 'TEXTAREA', 'SELECT'].includes(e.path[0].tagName))
return;
this.isDeleteConfirmModal = true; this.isDeleteConfirmModal = true;
}, },
hideDeleteConfirmModal () { hideDeleteConfirmModal () {
@@ -370,7 +372,6 @@ export default {
}, },
setNull () { setNull () {
const row = this.localResults.find(row => this.selectedRows.includes(row._id)); const row = this.localResults.find(row => this.selectedRows.includes(row._id));
delete row._id;
const params = { const params = {
primary: this.primaryField.name, primary: this.primaryField.name,
@@ -408,15 +409,15 @@ export default {
this.selectedRows.push(row); this.selectedRows.push(row);
else { else {
const lastID = this.selectedRows.slice(-1)[0]; const lastID = this.selectedRows.slice(-1)[0];
const lastIndex = this.localResults.findIndex(el => el._id === lastID); const lastIndex = this.sortedResults.findIndex(el => el._id === lastID);
const clickedIndex = this.localResults.findIndex(el => el._id === row); const clickedIndex = this.sortedResults.findIndex(el => el._id === row);
if (lastIndex > clickedIndex) { if (lastIndex > clickedIndex) {
for (let i = clickedIndex; i < lastIndex; i++) for (let i = clickedIndex; i < lastIndex; i++)
this.selectedRows.push(this.localResults[i]._id); this.selectedRows.push(this.sortedResults[i]._id);
} }
else if (lastIndex < clickedIndex) { else if (lastIndex < clickedIndex) {
for (let i = clickedIndex; i > lastIndex; i--) for (let i = clickedIndex; i > lastIndex; i--)
this.selectedRows.push(this.localResults[i]._id); this.selectedRows.push(this.sortedResults[i]._id);
} }
} }
} }
@@ -435,6 +436,8 @@ export default {
sort (field) { sort (field) {
if (!this.isSortable) return; if (!this.isSortable) return;
this.selectedRows = [];
if (this.mode === 'query') if (this.mode === 'query')
field = `${this.getTable(this.resultsetIndex)}.${field}`; field = `${this.getTable(this.resultsetIndex)}.${field}`;

View File

@@ -10,7 +10,7 @@
> >
<template v-if="cKey !== '_id'"> <template v-if="cKey !== '_id'">
<span <span
v-if="!isInlineEditor[cKey]" v-if="!isInlineEditor[cKey] && fields[cKey]"
class="cell-content px-2" class="cell-content px-2"
:class="`${isNull(col)} ${typeClass(fields[cKey].type)}`" :class="`${isNull(col)} ${typeClass(fields[cKey].type)}`"
@dblclick="editON($event, col, cKey)" @dblclick="editON($event, col, cKey)"
@@ -74,7 +74,7 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-edit mr-1" /> {{ $t('word.edit') }} "{{ editingField }}" <i class="mdi mdi-24px mdi-playlist-edit mr-1" /> <span class="cut-text">{{ $t('word.edit') }} "{{ editingField }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">
@@ -138,7 +138,8 @@
> >
<template :slot="'header'"> <template :slot="'header'">
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-edit mr-1" /> {{ $t('word.edit') }} "{{ editingField }}" <i class="mdi mdi-24px mdi-playlist-edit mr-1" />
<span class="cut-text">{{ $t('word.edit') }} "{{ editingField }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <div :slot="'body'">
@@ -348,7 +349,7 @@ export default {
return false; return false;
}, },
enumArray () { enumArray () {
if (this.fields[this.editingField].enumValues) if (this.fields[this.editingField] && this.fields[this.editingField].enumValues)
return this.fields[this.editingField].enumValues.replaceAll('\'', '').split(','); return this.fields[this.editingField].enumValues.replaceAll('\'', '').split(',');
return false; return false;
} }

View File

@@ -32,6 +32,44 @@
</div> </div>
</div> </div>
</div> </div>
<div class="btn-group">
<button
class="btn btn-dark btn-sm mr-0"
:disabled="isQuering || page === 1"
title="CTRL+ᐊ"
@click="pageChange('prev')"
>
<i class="mdi mdi-24px mdi-skip-previous" />
</button>
<div class="dropdown" :class="{'active': isPageMenu}">
<div class="btn-group" @click="openPageMenu">
<div class="btn btn-dark btn-sm mr-0 dropdown-toggle text-bold px-3">
{{ page }}
</div>
<div class="menu px-3">
<span>{{ $t('message.pageNumber') }}</span>
<input
ref="pageSelect"
v-model="pageProxy"
type="number"
min="1"
class="form-input"
@blur="setPageNumber"
>
</div>
</div>
</div>
<button
class="btn btn-dark btn-sm mr-0"
:disabled="isQuering || (results.length && results[0].rows.length < limit)"
title="CTRL+ᐅ"
@click="pageChange('next')"
>
<i class="mdi mdi-24px mdi-skip-next" />
</button>
</div>
<div class="divider-vert py-3" />
<button <button
v-if="isTable" v-if="isTable"
@@ -72,10 +110,10 @@
<i class="mdi mdi-timer-sand mdi-rotate-180 pr-1" /> <b>{{ results[0].duration / 1000 }}s</b> <i class="mdi mdi-timer-sand mdi-rotate-180 pr-1" /> <b>{{ results[0].duration / 1000 }}s</b>
</div> </div>
<div v-if="results.length && results[0].rows"> <div v-if="results.length && results[0].rows">
{{ $t('word.results') }}: <b>{{ results[0].rows.length.toLocaleString() }}</b> {{ $t('word.results') }}: <b>{{ results[0].rows.length | localeString }}</b>
</div> </div>
<div v-if="hasApproximately"> <div v-if="hasApproximately || (page > 1 && tableInfo.rows)">
{{ $t('word.total') }}: <b>{{ tableInfo.rows.toLocaleString() }}</b> <small>({{ $t('word.approximately') }})</small> {{ $t('word.total') }}: <b>{{ tableInfo.rows | localeString }}</b> <small>({{ $t('word.approximately') }})</small>
</div> </div>
<div v-if="workspace.breadcrumbs.database"> <div v-if="workspace.breadcrumbs.database">
{{ $t('word.schema') }}: <b>{{ workspace.breadcrumbs.database }}</b> {{ $t('word.schema') }}: <b>{{ workspace.breadcrumbs.database }}</b>
@@ -134,6 +172,12 @@ export default {
ModalNewTableRow, ModalNewTableRow,
ModalFakerRows ModalFakerRows
}, },
filters: {
localeString (val) {
if (val)
return val.toLocaleString();
}
},
mixins: [tableTabs], mixins: [tableTabs],
props: { props: {
connection: Object, connection: Object,
@@ -143,19 +187,23 @@ export default {
return { return {
tabUid: 'data', tabUid: 'data',
isQuering: false, isQuering: false,
isPageMenu: false,
results: [], results: [],
lastTable: null, lastTable: null,
isAddModal: false, isAddModal: false,
isFakerModal: false, isFakerModal: false,
autorefreshTimer: 0, autorefreshTimer: 0,
refreshInterval: null, refreshInterval: null,
sortParams: {} sortParams: {},
page: 1,
pageProxy: 1
}; };
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
getWorkspace: 'workspaces/getWorkspace', getWorkspace: 'workspaces/getWorkspace',
selectedWorkspace: 'workspaces/getSelected' selectedWorkspace: 'workspaces/getSelected',
limit: 'settings/getDataTabLimit'
}), }),
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
@@ -184,19 +232,26 @@ export default {
return this.results.length && return this.results.length &&
this.results[0].rows && this.results[0].rows &&
this.tableInfo && this.tableInfo &&
this.results[0].rows.length === 1000 && this.results[0].rows.length === this.limit &&
this.results[0].rows.length < this.tableInfo.rows; this.results[0].rows.length < this.tableInfo.rows;
} }
}, },
watch: { watch: {
table () { table () {
if (this.isSelected) { if (this.isSelected) {
this.page = 1;
this.sortParams = {}; this.sortParams = {};
this.getTableData(); this.getTableData();
this.lastTable = this.table; this.lastTable = this.table;
this.$refs.queryTable.resetSort(); this.$refs.queryTable.resetSort();
} }
}, },
page (val, oldVal) {
if (val && val > 0 && val !== oldVal) {
this.pageProxy = this.page;
this.getTableData();
}
},
isSelected (val) { isSelected (val) {
if (val && this.lastTable !== this.table) { if (val && this.lastTable !== this.table) {
this.getTableData(); this.getTableData();
@@ -228,6 +283,8 @@ export default {
uid: this.connection.uid, uid: this.connection.uid,
schema: this.schema, schema: this.schema,
table: this.workspace.breadcrumbs.table || this.workspace.breadcrumbs.view, table: this.workspace.breadcrumbs.table || this.workspace.breadcrumbs.view,
limit: this.limit,
page: this.page,
sortParams sortParams
}; };
@@ -255,6 +312,33 @@ export default {
this.sortParams = sortParams; this.sortParams = sortParams;
this.getTableData(sortParams); this.getTableData(sortParams);
}, },
openPageMenu () {
if (this.isQuering) return;
this.isPageMenu = true;
if (this.isPageMenu)
setTimeout(() => this.$refs.pageSelect.focus(), 20);
},
setPageNumber () {
this.isPageMenu = false;
if (this.pageProxy > 0)
this.page = this.pageProxy;
else
this.pageProxy = this.page;
},
pageChange (direction) {
if (this.isQuering) return;
if (direction === 'next' && (this.results.length && this.results[0].rows.length === this.limit)) {
if (!this.page)
this.page = 2;
else
this.page++;
}
else if (direction === 'prev' && this.page > 1)
this.page--;
},
showAddModal () { showAddModal () {
this.isAddModal = true; this.isAddModal = true;
}, },
@@ -273,6 +357,13 @@ export default {
e.stopPropagation(); e.stopPropagation();
if (e.key === 'F5') if (e.key === 'F5')
this.reloadTable(); this.reloadTable();
if (e.ctrlKey) {
if (e.key === 'ArrowRight')
this.pageChange('next');
if (e.key === 'ArrowLeft')
this.pageChange('prev');
}
} }
}, },
setRefreshInterval () { setRefreshInterval () {

379
src/renderer/i18n/de-DE.js Normal file
View File

@@ -0,0 +1,379 @@
module.exports = {
word: {
edit: 'Bearbeiten',
save: 'Speichern',
close: 'Schließen',
delete: 'Löschen',
confirm: 'Bestätigen',
cancel: 'Abbrechen',
send: 'Senden',
connectionName: 'Verbindungsname',
client: 'Client',
hostName: 'Hostname',
port: 'Port',
user: 'Nutzer',
password: 'Kennwort',
credentials: 'Zugangsdaten',
connect: 'Verbinden',
connected: 'Verbunden',
disconnect: 'Trennen',
disconnected: 'Getrennt',
refresh: 'Aktualisieren',
settings: 'Einstellungen',
general: 'Allgemein',
themes: 'Designs',
update: 'Aktualisierung',
about: 'Über',
language: 'Sprache',
version: 'Version',
donate: 'Spenden',
run: 'Ausführen',
schema: 'Schema',
results: 'Ergebnisse',
size: 'Größe',
seconds: 'Sekunden',
type: 'Typ',
mimeType: 'Mime-Type',
download: 'Herunterladen',
add: 'Hinzufügen',
data: 'Daten',
properties: 'Eigenschaften',
insert: 'Einfügen',
connecting: 'Verbinden',
name: 'Name',
collation: 'Kollation',
clear: 'Leeren',
options: 'Optionen',
autoRefresh: 'Auto-Aktualisierung',
indexes: 'Indizes',
foreignKeys: 'Fremdschlüssel',
length: 'Länge',
unsigned: 'Unsigniert',
default: 'Standard',
comment: 'Kommentar',
key: 'Schlüssel',
order: 'Sortierung',
expression: 'Ausdruck',
autoIncrement: 'Auto Inkrement',
engine: 'Engine',
field: 'Feld | Felder',
approximately: 'Ungefähr',
total: 'Gesamt',
table: 'Tabelle',
discard: 'Verwerfen',
stay: 'Warten',
author: 'Autor',
light: 'Hell',
dark: 'Dunkel',
autoCompletion: 'Auto-Vervollständigung',
application: 'Anwendung',
editor: 'Editor',
view: 'Ansicht',
definer: 'Bestimmer',
algorithm: 'Algorithmus',
trigger: 'Auslöser',
storedRoutine: 'Gespeicherte Routine | Gespeicherte Routinen',
scheduler: 'Zeitplaner',
event: 'Ereignis',
parameters: 'Parameter',
function: 'Funktion | Funktionen',
deterministic: 'Deterministisch',
context: 'Kontext',
export: 'Export',
returns: 'Rückgabe',
timing: 'Dauer',
state: 'Stand',
execution: 'Ausführung',
starts: 'Startet',
ends: 'Endet',
ssl: 'SSL',
privateKey: 'Privater Schlüssel',
certificate: 'Zertifikat',
caCertificate: 'CA Zertifikat',
ciphers: 'Chiffren',
upload: 'Hochladen',
browse: 'Suchen',
faker: 'Faker',
content: 'Inhalt',
cut: 'Ausschneiden',
copy: 'Kopieren',
paste: 'Einfügen',
tools: 'Tools',
variables: 'Variablen',
processes: 'Prozesse',
database: 'Datenbank',
scratchpad: 'Scratchpad',
array: 'Array',
format: 'Formatierung'
},
message: {
appWelcome: 'Willkommen im Antares SQL Client!',
appFirstStep: 'Dein erster Schritt: Erstelle eine neue Datenbankverbindung.',
addConnection: 'Verbindung hinzufügen',
createConnection: 'Verbindung erstellen',
createNewConnection: 'Neue Verbindung erstellen',
askCredentials: 'Frage nach Zugangsdaten',
testConnection: 'Verbindung testen',
editConnection: 'Verbindung bearbeiten',
deleteConnection: 'Verbindung löschen',
deleteCorfirm: 'Bestätige den Abbruch von',
connectionSuccessfullyMade: 'Verbindung erfolgreich erstellt!',
madeWithJS: 'Mit 💛 und JavaScript gemacht!',
checkForUpdates: 'Suche nach Aktualisierungen',
noUpdatesAvailable: 'Keine Aktualisierungen verfügbar',
checkingForUpdate: 'Suche nach Aktualisierungen',
checkFailure: 'Suche fehlgeschlagen, bitte versuche es später noch einmal',
updateAvailable: 'Aktualisierung verfügbar',
downloadingUpdate: 'Aktualisierung wird heruntergeladen',
updateDownloaded: 'Aktualisierung heruntergeladen',
restartToInstall: 'Starte Antares neu für die Installation',
unableEditFieldWithoutPrimary: 'Feld kann ohne Primärschlüssel in Ergebnisliste nicht bearbeitet werden',
editCell: 'Zelle bearbeiten',
deleteRows: 'Zeile löschen | Lösche {count} Zeilen',
confirmToDeleteRows: 'Eine Zeile wirklich löschen? | {count} Zeilen wirklich löschen?',
notificationsTimeout: 'Timeout für Benachrichtigungen',
uploadFile: 'Datei hochladen',
addNewRow: 'Neue Zeile hinzufügen',
numberOfInserts: 'Anzahl der eingefügten Zeilen',
openNewTab: 'Öffne einen neuen Tab',
affectedRows: 'Betroffene Zeilen',
createNewDatabase: 'Erstelle ein neue Datenbank',
databaseName: 'Datenbankname',
serverDefault: 'Server default',
deleteDatabase: 'Datenbank löschen',
editDatabase: 'Datenbank bearbeiten',
clearChanges: 'Änderungen leeren',
addNewField: 'Neues Feld hinzufügen',
manageIndexes: 'Indizes verwalten',
manageForeignKeys: 'Fremdschlüssel verwalten',
allowNull: 'Erlaube NULL',
zeroFill: 'Nullauffüllung',
customValue: 'Spezifischer Wert',
onUpdate: 'Bei Aktualisierung',
deleteField: 'Feld löschen',
createNewIndex: 'Neuen Index erstellen',
addToIndex: 'Zum Index hinzufügen',
createNewTable: 'Neue Tabelle erstellen',
emptyTable: 'Tabelle leeren',
deleteTable: 'Tabelle löschen',
emptyCorfirm: 'Wirklich leeren?',
unsavedChanges: 'Ungespeicherte Änderungen',
discardUnsavedChanges: 'Du hast ungespeicherte Änderungen. Wenn du den Tab verlässt, werden diese Änderungen verworfen.',
thereAreNoIndexes: 'Es gibt keine Indizes',
thereAreNoForeign: 'Es gibt keine Fremdschlüssel',
createNewForeign: 'Neuen Fremdschlüssel erstellen',
referenceTable: 'Referenztabelle',
referenceField: 'Referenzfeld',
foreignFields: 'Fremdfelder',
invalidDefault: 'Ungültiger Standard',
onDelete: 'Bei Löschung',
applicationTheme: 'Anwendungsdesign',
editorTheme: 'Editordesign',
wrapLongLines: 'Lange Zeilen umbrechen',
selectStatement: 'Select-Anweisung',
triggerStatement: 'Trigger-Anweisung',
sqlSecurity: 'SQL-Sicherheit',
updateOption: 'Aktualisierungsoption',
deleteView: 'View löschen',
createNewView: 'Neue View erstellen',
deleteTrigger: 'Trigger löschen',
createNewTrigger: 'Neuen Trigger erstellen',
currentUser: 'Aktueller Nutzer',
routineBody: 'Routineninhalt',
dataAccess: 'Datenzugriff',
thereAreNoParameters: 'Es gibt keine Parameter',
createNewParameter: 'Neue Parameter erstellen',
createNewRoutine: 'Neue Routine erstellen',
deleteRoutine: 'Routine löschen',
functionBody: 'Funktionsinhalt',
createNewFunction: 'Neue Funktion erstellen',
deleteFunction: 'Funktion löschen',
schedulerBody: 'Zeitplaner-Inhalt',
createNewScheduler: 'Neuen Zeitplaner erstellen',
deleteScheduler: 'Zeitplaner löschen',
preserveOnCompletion: 'Bei Vervollständigung erhalten',
enableSsl: 'Aktiviere SSL',
manualValue: 'Manueller Wert',
tableFiller: 'Tabellenfüller',
fakeDataLanguage: 'Fingierte Datensprache',
searchForElements: 'Suche nach Elemente',
selectAll: 'Alle auswählen',
queryDuration: 'Dauer der Abfrage',
includeBetaUpdates: 'Beta-Aktualisierungen berücksichtigen',
setNull: 'Setze NULL',
processesList: 'Prozessliste',
processInfo: 'Prozessinformationen',
manageUsers: 'Benutzer verwalten',
createNewSchema: 'Neues Schema erstellen',
schemaName: 'Schemaname',
editSchema: 'Schema bearbeiten',
deleteSchema: 'Schema löschen',
markdownSupported: 'Unterstützt Markdown',
plantATree: 'Pflanze einen Baum',
dataTabPageSize: 'Einträge pro Tab / Seite'
},
faker: {
address: 'Adresse',
commerce: 'Handel',
company: 'Firma',
database: 'Datenbank',
date: 'Datum',
finance: 'Finanzen',
git: 'Git',
hacker: 'Hacker',
internet: 'Internet',
lorem: 'Lorem',
name: 'Name',
music: 'Musik',
phone: 'Telefon',
random: 'Zufällig',
system: 'System',
time: 'Zeit',
vehicle: 'Fahrzeug',
zipCode: 'Postleitzahl',
zipCodeByState: 'Postleitzahl nach Stadt',
city: 'Stadt',
cityPrefix: 'Stadtpräfix',
citySuffix: 'Stadtzusatz',
streetName: 'Straßenname',
streetAddress: 'Anschrift',
streetSuffix: 'Straßenzusatz',
streetPrefix: 'Straßenpräfix',
secondaryAddress: 'Zweite Anschrift',
county: 'Landkreis',
country: 'Land',
countryCode: 'Ländercode',
state: 'Bundesland',
stateAbbr: 'Bundeslandkürzel',
latitude: 'Breitengrad',
longitude: 'Längengrad',
direction: 'Richtung',
cardinalDirection: 'Himmelsrichtung',
ordinalDirection: 'Nebenhimmelsrichtung',
nearbyGPSCoordinate: 'Nächste GPS-Koordinate',
timeZone: 'Zeitzone',
color: 'Farbe',
department: 'Abteilung',
productName: 'Produktname',
price: 'Preis',
productAdjective: 'Produkteigenschaft',
productMaterial: 'Produktmaterial',
product: 'Produkt',
productDescription: 'Produktbeschreibung',
suffixes: 'Zusätze',
companyName: 'Firmenname',
companySuffix: 'Firmenzusatz',
catchPhrase: 'Slogan',
bs: 'BS',
catchPhraseAdjective: 'Sloganeigenschaft',
catchPhraseDescriptor: 'Sloganbeschreibung',
catchPhraseNoun: 'Slogannomen',
bsAdjective: 'BS-Eigenschaft',
bsBuzz: 'BS-Klatsch',
bsNoun: 'BS-Nomen',
column: 'Spalte',
type: 'Typ',
collation: 'Kollation',
engine: 'Engine',
past: 'Vergangenheit',
future: 'Zukunft',
between: 'Zwischen',
recent: 'Kürzlich',
soon: 'Bald',
month: 'Monat',
weekday: 'Wochentag',
account: 'Konto',
accountName: 'Kontoname',
routingNumber: 'Bankleitzahl',
mask: 'Maske',
amount: 'Wert',
transactionType: 'Vorgangstyp',
currencyCode: 'Währungscode',
currencyName: 'Währungsname',
currencySymbol: 'Währungssymbol',
bitcoinAddress: 'Bitcoin-Adresse',
litecoinAddress: 'Litecoin-Adresse',
creditCardNumber: 'Kreditkartennummer',
creditCardCVV: 'Kartenprüfnummer',
ethereumAddress: 'Ethereum-Adresse',
iban: 'IBAN',
bic: 'BIC',
transactionDescription: 'Vorgangsbeschreibung',
branch: 'Zweig',
commitEntry: 'Commit-Eintrag',
commitMessage: 'Commit-Nachricht',
commitSha: 'Commit-SHA',
shortSha: 'Kurzer SHA',
abbreviation: 'Kürzel',
adjective: 'Adjektiv',
noun: 'Nomen',
verb: 'Verb',
ingverb: 'Ingverb',
phrase: 'Phrase',
avatar: 'Avatar',
email: 'E-Mail',
exampleEmail: 'Beispiel-E-Mail',
userName: 'Benutzername',
protocol: 'Protokoll',
url: 'Url',
domainName: 'Domainname',
domainSuffix: 'Domainzusatz',
domainWord: 'Domainwort',
ip: 'IP',
ipv6: 'IPv6',
userAgent: 'Browserkennung',
mac: 'Mac',
password: 'Kennwort',
word: 'Wort',
words: 'Wörter',
sentence: 'Satz',
slug: 'Slug',
sentences: 'Sätze',
paragraph: 'Paragraph',
paragraphs: 'Paragraphen',
text: 'Text',
lines: 'Zeilen',
genre: 'Genre',
firstName: 'Vorname',
lastName: 'Nachname',
middleName: 'Zweitname',
findName: 'Vollständiger Name',
jobTitle: 'Berufsbezeichnung',
gender: 'Geschlecht',
prefix: 'Präfix',
suffix: 'Zusatz',
title: 'Titel',
jobDescriptor: 'Berufsbeschreibung',
jobArea: 'Berufsfeld',
jobType: 'Anstellungsart',
phoneNumber: 'Telefonnummer',
phoneNumberFormat: 'Telefonnummerformat',
phoneFormats: 'Telefonnummerformate',
number: 'Nummer',
float: 'Gleitkommazahl',
arrayElement: 'Array-Element',
arrayElements: 'Array-Elemente',
objectElement: 'Object-Element',
uuid: 'Uuid',
boolean: 'Boolean',
image: 'Grafik',
locale: 'Sprachumgebung',
alpha: 'Alpha',
alphaNumeric: 'Alphanumerisch',
hexaDecimal: 'Hexadezimal',
fileName: 'Dateiname',
commonFileName: 'Allgemeiner Dateiname',
mimeType: 'Mimetype',
commonFileType: 'Allgemeiner Dateityp',
commonFileExt: 'Allgemeine Dateiendung',
fileType: 'Dateityp',
fileExt: 'Dateiendung',
directoryPath: 'Verzeichnispfad',
filePath: 'Dateipfad',
semver: 'Semver',
manufacturer: 'Hersteller',
model: 'Modell',
fuel: 'Treibstoff',
vin: 'Wein'
}
};

View File

@@ -105,7 +105,11 @@ module.exports = {
scratchpad: 'Scratchpad', scratchpad: 'Scratchpad',
array: 'Array', array: 'Array',
changelog: 'Changelog', changelog: 'Changelog',
format: 'Format' format: 'Format',
structure: 'Structure',
small: 'Small',
medium: 'Medium',
large: 'Large'
}, },
message: { message: {
appWelcome: 'Welcome to Antares SQL Client!', appWelcome: 'Welcome to Antares SQL Client!',
@@ -210,7 +214,9 @@ module.exports = {
editSchema: 'Edit schema', editSchema: 'Edit schema',
deleteSchema: 'Delete schema', deleteSchema: 'Delete schema',
markdownSupported: 'Markdown supported', markdownSupported: 'Markdown supported',
plantATree: 'Plant a Tree' plantATree: 'Plant a Tree',
dataTabPageSize: 'DATA tab page size',
pageNumber: 'Page number'
}, },
faker: { faker: {
address: 'Address', address: 'Address',

View File

@@ -10,7 +10,8 @@ const i18n = new VueI18n({
'ar-SA': require('./ar-SA'), 'ar-SA': require('./ar-SA'),
'es-ES': require('./es-ES'), 'es-ES': require('./es-ES'),
'fr-FR': require('./fr-FR'), 'fr-FR': require('./fr-FR'),
'pt-BR': require('./pt-BR') 'pt-BR': require('./pt-BR'),
'de-DE': require('./de-DE')
} }
}); });
export default i18n; export default i18n;

View File

@@ -4,5 +4,6 @@ export default {
'ar-SA': 'العربية', 'ar-SA': 'العربية',
'es-ES': 'Español', 'es-ES': 'Español',
'fr-FR': 'Français', 'fr-FR': 'Français',
'pt-BR': 'Português (Brasil)' 'pt-BR': 'Português (Brasil)',
'de-DE': 'Deutsch (Deutschland)'
}; };

View File

@@ -40,6 +40,12 @@ body {
box-shadow: none !important; box-shadow: none !important;
} }
.cut-text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.workspace-tabs { .workspace-tabs {
align-content: baseline; align-content: baseline;
@@ -112,6 +118,10 @@ body {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;
.modal-title {
overflow: hidden;
}
} }
} }
} }
@@ -185,6 +195,10 @@ body {
max-height: 5000rem !important; max-height: 5000rem !important;
} }
.btn-group {
flex-wrap: nowrap;
}
.btn.loading { .btn.loading {
> .mdi, > .mdi,
> span { > span {

View File

@@ -58,6 +58,10 @@
&:hover { &:hover {
background: $bg-color-gray; background: $bg-color-gray;
} }
&.active {
background-color: $primary-color;
}
} }
} }
@@ -211,10 +215,8 @@
} }
.bg-checkered { .bg-checkered {
background-image: background-image: linear-gradient(to right, rgba(192, 192, 192, 0.75), rgba(192, 192, 192, 0.75)),
linear-gradient(to right, rgba(192, 192, 192, 0.75), rgba(192, 192, 192, 0.75)), linear-gradient(to right, black 50%, white 50%), linear-gradient(to bottom, black 50%, white 50%);
linear-gradient(to right, black 50%, white 50%),
linear-gradient(to bottom, black 50%, white 50%);
background-blend-mode: normal, difference, normal; background-blend-mode: normal, difference, normal;
background-size: 2em 2em; background-size: 2em 2em;
} }

View File

@@ -62,6 +62,10 @@
&:hover { &:hover {
background: $bg-color-gray; background: $bg-color-gray;
} }
&.active {
background-color: $primary-color;
}
} }
} }

View File

@@ -11,20 +11,24 @@ export default {
allow_prerelease: persistentStore.get('allow_prerelease', true), allow_prerelease: persistentStore.get('allow_prerelease', true),
explorebar_size: persistentStore.get('explorebar_size', null), explorebar_size: persistentStore.get('explorebar_size', null),
notifications_timeout: persistentStore.get('notifications_timeout', 5), notifications_timeout: persistentStore.get('notifications_timeout', 5),
data_tab_limit: persistentStore.get('data_tab_limit', 1000),
auto_complete: persistentStore.get('auto_complete', true), auto_complete: persistentStore.get('auto_complete', true),
line_wrap: persistentStore.get('line_wrap', true), line_wrap: persistentStore.get('line_wrap', true),
application_theme: persistentStore.get('application_theme', 'dark'), application_theme: persistentStore.get('application_theme', 'dark'),
editor_theme: persistentStore.get('editor_theme', 'twilight') editor_theme: persistentStore.get('editor_theme', 'twilight'),
editor_font_size: persistentStore.get('editor_font_size', 'medium')
}, },
getters: { getters: {
getLocale: state => state.locale, getLocale: state => state.locale,
getDataTabLimit: state => state.data_tab_limit,
getAllowPrerelease: state => state.allow_prerelease, getAllowPrerelease: state => state.allow_prerelease,
getExplorebarSize: state => state.explorebar_size, getExplorebarSize: state => state.explorebar_size,
getNotificationsTimeout: state => state.notifications_timeout, getNotificationsTimeout: state => state.notifications_timeout,
getAutoComplete: state => state.auto_complete, getAutoComplete: state => state.auto_complete,
getLineWrap: state => state.line_wrap, getLineWrap: state => state.line_wrap,
getApplicationTheme: state => state.application_theme, getApplicationTheme: state => state.application_theme,
getEditorTheme: state => state.editor_theme getEditorTheme: state => state.editor_theme,
getEditorFontSize: state => state.editor_font_size
}, },
mutations: { mutations: {
SET_LOCALE (state, locale) { SET_LOCALE (state, locale) {
@@ -32,6 +36,10 @@ export default {
i18n.locale = locale; i18n.locale = locale;
persistentStore.set('locale', state.locale); persistentStore.set('locale', state.locale);
}, },
SET_DATA_TAB_LIMIT (state, limit) {
state.data_tab_limit = limit;
persistentStore.set('data_tab_limit', state.data_tab_limit);
},
SET_ALLOW_PRERELEASE (state, allow) { SET_ALLOW_PRERELEASE (state, allow) {
state.allow_prerelease = allow; state.allow_prerelease = allow;
persistentStore.set('allow_prerelease', state.allow_prerelease); persistentStore.set('allow_prerelease', state.allow_prerelease);
@@ -59,12 +67,19 @@ export default {
SET_EDITOR_THEME (state, theme) { SET_EDITOR_THEME (state, theme) {
state.editor_theme = theme; state.editor_theme = theme;
persistentStore.set('editor_theme', state.editor_theme); persistentStore.set('editor_theme', state.editor_theme);
},
SET_EDITOR_FONT_SIZE (state, size) {
state.editor_font_size = size;
persistentStore.set('editor_font_size', state.editor_font_size);
} }
}, },
actions: { actions: {
changeLocale ({ commit }, locale) { changeLocale ({ commit }, locale) {
commit('SET_LOCALE', locale); commit('SET_LOCALE', locale);
}, },
changePageSize ({ commit }, limit) {
commit('SET_DATA_TAB_LIMIT', limit);
},
changeAllowPrerelease ({ commit }, allow) { changeAllowPrerelease ({ commit }, allow) {
commit('SET_ALLOW_PRERELEASE', allow); commit('SET_ALLOW_PRERELEASE', allow);
}, },
@@ -85,6 +100,9 @@ export default {
}, },
changeEditorTheme ({ commit }, theme) { changeEditorTheme ({ commit }, theme) {
commit('SET_EDITOR_THEME', theme); commit('SET_EDITOR_THEME', theme);
},
changeEditorFontSize ({ commit }, size) {
commit('SET_EDITOR_FONT_SIZE', size);
} }
} }
}; };