Giter VIP home page Giter VIP logo

Comments (7)

rowanbeentje avatar rowanbeentje commented on May 22, 2024 1

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.

jamesstout avatar jamesstout commented on May 22, 2024 1

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

<key>output</key>
<string>showashtml</string>

from sequel-ace.

jamesstout avatar jamesstout commented on May 22, 2024 1

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.

// Parse first line for magic header #! ; if found save the script content and run the command after #! with that file.
// This allows to write perl, ruby, osascript scripts natively.

from sequel-ace.

jamesstout avatar jamesstout commented on May 22, 2024

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:

  1. User needs node installed, and npm
  2. It's for T-SQL, so complex MySQL might not get formatted properly.

from sequel-ace.

jamesstout avatar jamesstout commented on May 22, 2024

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.

Jason-Morcos avatar Jason-Morcos commented on May 22, 2024

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.

Jason-Morcos avatar Jason-Morcos commented on May 22, 2024

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

<key>output</key>
<string>showashtml</string>

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.