Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 18 total
Thread Statement termination character in EDBManager
Tue, Nov 17 2015 3:32 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I have just tried to modify a piece of sql from ReaderWare. I decided to alter all the the INSERT VALUES statements by prefixing them with ! (the statement termination character for me) so I had about 2000 lines like

! INSERT INTO READERWARE VALUES('Macroscope (SF classic)','Anthony, Piers','072211177',
'Sphere','2','N','N','1974',NULL,'1',-1,-1,-1,'Y','Y','Y',NULL,NULL,'2003-12-06',
'Amazon [UK]',76,NULL,NULL,'N',NULL,NULL,NULL,NULL,'2003-12-06',-1,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'N',NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)

I did it this way because I didn't fancy going through and amending them all by hand and I'm sure one or two of the book titles contain a )

Unfortunately ! at the start of a line is treated as marking the line as a comment.

My suggestion is to stop this happening.


Roy Lambert

Tue, Nov 17 2015 12:53 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Unfortunately ! at the start of a line is treated as marking the line as a comment. >>

I'm not seeing that here.  What is giving you the impression that the EDB Manager is treating it like a comment ?  Does it show up as green ?

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Nov 17 2015 1:22 PMPermanent Link

Uli Becker

Tim,

> I'm not seeing that here.  What is giving you the impression that the EDB Manager is treating it like a comment ?  Does it show up as green ?

I can confirm that:

----
!select * from users
select * from users
----

works, because the first line with the leading ! is ignored. It doesn't
look like a comment though.

Uli
Wed, Nov 18 2015 2:55 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

><< Unfortunately ! at the start of a line is treated as marking the line as a comment. >>
>
>I'm not seeing that here. What is giving you the impression that the EDB Manager is treating it like a comment ? Does it show up as green ?

Bad phraseology from me - n visual effect its just that the line isn't executed. I watched each line be highlighted in turn and thought - good - then got to the bottom, did a SELECT * FROM READERWARE and found zero rows when there should have been a couple of thousand. A bit more experimenting showed that if the ! was at the start of a line it was simply ignored as though it was commented out.

Uli has come up with a better example.

Roy Lambert
Wed, Nov 18 2015 11:50 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Bad phraseology from me - n visual effect its just that the line isn't executed. I watched each line be highlighted in turn and thought - good - then got to the bottom, did a SELECT * FROM READERWARE and found zero rows when there should have been a couple of thousand. A bit more experimenting showed that if the ! was at the start of a line it was simply ignored as though it was commented out. >>

Selected statements are handled on a line-by-line basis in the editor, they're not handled by the underlying engine.  You're using incorrectly-positioned line terminators at the *beginning* of lines, not at the end.  Therefore, it doesn't work.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Nov 19 2015 3:13 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


>Selected statements are handled on a line-by-line basis in the editor, they're not handled by the underlying engine. You're using incorrectly-positioned line terminators at the *beginning* of lines, not at the end. Therefore, it doesn't work.

That is what I discovered. However, if I'm interpreting your comment correctly I have to disagree with your processing logic. According to your comment the following would only execute one statement:


UPDATE Fred SET Bert = 'One' WHERE Bert = '1' ! UPDATE Fred SET Bert = 'Two' WHERE Bert = '2'

which in my simplistic world view says ! is treated as a comment not a statement terminator.

I haven't tried the above yet - I'll do it later on

If them's the rules I'll play by them - but I reserve the right to disagree with them.

Roy Lambert
Thu, Nov 19 2015 8:21 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tested things out and it seems that the terminator is the designated character PLUS CRLF not just the designated character


This works

update attachments set type = 'X' where type = '8' !
update attachments set type = 'Y' where type = 'a' !

this doesn't

update attachments set type = 'X' where type = '8' ! update attachments set type = 'Y' where type = 'a' !

however, this does work

update attachments set type = 'X' where type = '8' !
!xxxx
update attachments set type = 'Y' where type = 'a' !


Roy Lambert
Thu, Nov 19 2015 10:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Being the annoying little person I am I tried this


update identities set _eddress = 'X';update identities set _eddress = 'Y';

in DBSys - it works but

;update identities set _eddress = '1';update identities set _eddress = '2';

doesn't and this

;
update identities set _eddress = '1';
update identities set _eddress = '2';

fails even more spectacularly


Roy Lambert
Thu, Nov 19 2015 11:12 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

Stick to one statement terminator per statement, and make sure that there aren't any more statements after the terminator, and you'll be fine.  Anything else probably won't work because, as I said, the statement terminator logic is *line-based* and handled in the editor.

In case you're wondering, it *has* to be this way because that's how selected statements work in the editor.  Imagine a green selection arrow next to a line that includes two statements with a terminator between them.  Which line is selected for execution ?

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Nov 20 2015 3:13 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

>Stick to one statement terminator per statement, and make sure that there aren't any more statements after the terminator, and you'll be fine. Anything else probably won't work because, as I said, the statement terminator logic is *line-based* and handled in the editor.
>
>In case you're wondering, it *has* to be this way because that's how selected statements work in the editor. Imagine a green selection arrow next to a line that includes two statements with a terminator between them. Which line is selected for execution ?

I'm missing something here. How do I select a single line to execute? Is this another one for the hidden features list Smiley

Roy Lambert
Page 1 of 2Next Page »
Jump to Page:  1 2
Image