Today, I was trying to write down an SQL insert statement. It took a huge amount of time, mainly because how it needs to be typed is so different from what it is based upon and yet it's so very strictly coupled syntaxwise. Let me give an example. The statement could be something in the form of:
insert into bloob (a, b c) values (x, y, z);
Simple, no? until the field names and values are not so simple any more.
Usually, the source is a description of a database table. Suppose you can get it into a form of tab delimited rows separated by newlines. In short: a plain tab delimited file. For this file the structure would look like:
bloob
a x
b y
c z
All pretty standard, and likely, it's quite easy to get the data from other sources into this shape, using standard tools.
Now, what I'd like to be able to, is to paste this data into the shape of the SQL statement, plain and simple. That is: it should make use of a template like, for example
insert into $table (@fields) values (@values)
given that array items would be joined by a comma (can be parameterized) and that there's a way to link the variables to the source data fields. It would be nice if extra formatting could be applied to each array item (as if with map) before it gets inserted such as wrapping quotes around them.
How? I don't know. I haven't thought that through yet.
And no, I don't want to write a dedicated little script to do each specific case for me.
If, by any chance, you know of an editor that has this or a similar feature, I'd like to know about it.
Alternative: replace text by templated text (Score:2)
with
with the default text (here the URL) selected, ready to be overtyped by a different text.
Or, supposing you have the database table data, formatted as described in the root post, as part of the text document, and you can select it, and apply the S