Comments (7)
I think SP was hoping to do a built-in implementation at some point, but years ago there didn't seem to be a nice library we could use. Things have hopefully changed!
from sequel-ace.
At the very least, the formatted SQL string should be injected back into the editor.
Tried this out and all you need to do is change showashtml
to replaceselection
<key>output</key>
<string>replaceselection</string>
in
from sequel-ace.
Could also look into bundling the app with python (unless we can still use system python from the sandbox?
The bundles run system php, ruby and bash somehow from the sandbox.
Sequel-Ace/Source/SPBundleCommandRunner.m
Lines 101 to 102 in 56c5a55
from sequel-ace.
Better yet, we should consider implementing local formatting of the SQL string that doesn't require access to the internet (perhaps via python) both for security purposes and for allowing offline development with a local DB.
poor-mans-t-sql-formatter-npm-cli works quite well on basic SQL I tested, but two issues with it:
- User needs
node
installed, andnpm
- It's for T-SQL, so complex MySQL might not get formatted properly.
from sequel-ace.
poor man's formatter:
UPDATE IGNORE PushRegos,
PushRegos_copy
SET `PushRegos`.`deviceToken` = `PushRegos_copy`.`deviceToken`
FROM `PushRegos_copy`
INNER JOIN PushRegos ON PushRegos_copy.deviceToken LIKE CONCAT (
PushRegos.deviceToken,
'%'
)
AND LENGTH(PushRegos.deviceToken) < 64;
INSERT IGNORE
INTO warningsHist
VALUES (
15,
"Strong Monsoon Signal ( 11:20 HKT - 25.06.2012 )",
now(),
NULL,
NULL
);
sqlformat.org formatter:
UPDATE
IGNORE PushRegos,
PushRegos_copy
SET `PushRegos`.`deviceToken` = `PushRegos_copy`.`deviceToken`
FROM `PushRegos_copy`
INNER JOIN PushRegos ON PushRegos_copy.deviceToken LIKE CONCAT(PushRegos.deviceToken, '%')
and LENGTH(PushRegos.deviceToken) < 64;
INSERT
IGNORE INTO warningsHist
values (15,"Strong Monsoon Signal ( 11:20 HKT - 25.06.2012 )", now(), NULL, NULL)
I think I prefer sqlformat.org.
from sequel-ace.
I prefer sqlformatter.org too!
Could also look into bundling the app with python (unless we can still use system python from the sandbox? That would be better) and using a package to parse locally, like mentioned here. sequelpro/sequelpro#1988 (comment)
from sequel-ace.
At the very least, the formatted SQL string should be injected back into the editor.
Tried this out and all you need to do is change
showashtml
toreplaceselection
<key>output</key> <string>replaceselection</string>
in
Cool!
There may be an issue with the default bundle updater too because when I made this change in the default bundle, for me at least it wasn't automatically copied over into my user's copy of the bundle.
See #26
from sequel-ace.
Related Issues (20)
- Not escaping singel quotes (')
- possible to set the PATH used by app? HOT 1
- Connect to the localhost using TCP HOT 7
- Invalid configuration written to SSH config file after a successful connection HOT 1
- Program Crashes Frequently - Namespace SIGNAL, Code 6 Abort trap: 6 HOT 1
- Changing column name on UUID type (MariaDB) fails HOT 3
- Select a table field to display the add column ddl HOT 1
- Color code tables HOT 1
- Confirmation Popup Before Exiting HOT 4
- SequelAce keeps crashing after adding a user via gui (MariaDB Only)
- Is it possible to open Sequel Ace from Terminal into an ssh connection? HOT 2
- Default Sort Order / Sequence HOT 2
- SequelAce crashes after a while a lost database connection is closed and no other database connections are left open
- Swipe gesture when auto completing. HOT 1
- GitHub error when checking for updates HOT 1
- Bracket highlighting makes Query tab editor unresponsive HOT 1
- Table Multi Column Selection and Actions
- 当我尝试复制一个大表的聚合结果的部分内容的时候, 双击变成修改, 然后导致工具卡死 HOT 1
- Multiple windows to same DB causes transactions to be committed immediately HOT 1
- Option to swap icon back to the Sequel Pro icon HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sequel-ace.