question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] SQL strings

See original GitHub issue

It would be great if the syntax highlighter could detect SQL in strings like it does for queryExecute(). I frequently break out my SQL statements from queryExecute(), and form them in a string before calling the function. For example:

public query function someSQL(someArg, ID){
    var sql = '';
    var params = {};
    if(ARGUMENTS.someArg == 'all') {
        sql &= 'SELECT * FROM someTable';
    } else if(ARGUMENTS.someArg == 'name'){
        sql &= 'SELECT name FROM someTable';
    }
    sql &= 'WHERE ID = :ID'
    params.ID = { value = ARGUMENTS.ID, sqltype = "INTEGER"};
    return query = queryExecute(sql, params, {datasource = DSN});
}

I don’t know how many people program like this, but if there was some reg ex that could detect either ‘sql =’ or ‘sql &=’ before a string, and then treat the string as SQL, it would help quite a bit. Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jcberquistcommented, Apr 19, 2017

Adding those seems fine to me.

1reaction
mrlifecommented, Apr 17, 2017

@jcberquist Would it be reasonable to add a couple more triggers? For consideration, it would be nice to have “TRUNCATE TABLE” and “BULK INSERT”. I’m not sure how many others would benefit from this, though I have some sections where this would apply for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Top 10 Feature Requests for SQL Server on Connect ...
The Top 10 Feature Requests for SQL Server on Connect.Microsoft.com · 1. Please fix the “String or binary data would be truncated” message...
Read more >
[feature request] option to save sql chunk to a string #1441
SQL chunks have the nice feature of syntax highlighting, but as far as I know they only offer the option to save the...
Read more >
Using SQL String Functions to Clean Data - Mode Analytics
This lesson of the SQL tutorial for data analysis covers SQL string functions to clean data strings and fix date formats.
Read more >
String Functions (Transact-SQL) - SQL Server - Microsoft Learn
All built-in string functions except FORMAT are deterministic. This means they return the same value any time they are called with a specific ......
Read more >
SQL SERVER - Connect Item - Vote for Feature Request ...
At both the times, I have put forth one request to the product team regarding implementing of function Trim(). As per my opinion,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found