int conversion in for each stops the program without error

Posted by Dominik Loewenstein on 20-Sep-2017 03:26

FOR EACH table WHERE INT(table.field) = 1916 NO-LOCK:
END.

MESSAGE "end"
VIEW-AS ALERT-BOX INFO BUTTONS OK.

With this easy example i dont get to the line of my message box, when i try to debug i cant see any error's.
I try to reproduce it with sample strings like non integer "abc" or emty char "" or undef ? or very long strings.

Nothing gives me the same problem.

Posted by George Potemkin on 21-Sep-2017 01:05

I guess the reason is: INTEGER(table.field) is resolved on a server's side. And remote client server does write the error 76 (Invalid character in numeric input) to a db log.

With both connection types (shared-memory and network) query generates the trappable STOP condition.

All Replies

Posted by James Palmer on 20-Sep-2017 04:17

Is it possible that table.field contains a non-integer value somewhere?

That being said, this query is really bad. As soon as you put a function on the left hand side of the predicate the compiler cannot select an index properly and you'll get a whole table read.

Posted by Dominik Loewenstein on 20-Sep-2017 04:27

This is only an easy example to show the problem. Yes in my field are some strings that are non-integer values, but i tryed it with non-int values like int("abc") and get no problems to reach the end.

i can fix my problem when i convert the int to a string and compare both, but i really want to know what the problem is with the int conversion.

Posted by James Palmer on 20-Sep-2017 05:13

Surely the solution lies in reworking the query to not need the integer conversion? Then you don't need an answer to this question, and your query /should/ perform a lot better as well.

Posted by Brian K. Maher on 20-Sep-2017 05:48

Hi Dominik,
 
Are you using the -debugalert startup parameter?  If so, try removing it.
 
Brian

Posted by George Potemkin on 20-Sep-2017 06:46

_UserTableStat will give you the number of records the query retrieved before it stopped. So you will know a record to suspect.

Posted by Laura Stern on 20-Sep-2017 08:46

Is the program crashing?  I.e., Do you get a procore/protrace file?

Posted by Dominik Loewenstein on 20-Sep-2017 08:51

[quote user="James Palmer"]

Surely the solution lies in reworking the query to not need the integer conversion? Then you don't need an answer to this question, and your query /should/ perform a lot better as well.

[/quote]

But i am interested in an answer, maybe it is not the last time i see this problem, so it is better to know next time what really happend.

Posted by Dominik Loewenstein on 20-Sep-2017 08:56

[quote user="Brian K. Maher"]

Hi Dominik,
 
Are you using the -debugalert startup parameter?  If so, try removing it.
 
Brian

[/quote]Yes, but removing it didn't changed anything

Posted by Dominik Loewenstein on 20-Sep-2017 08:58

[quote user="Brian K. Maher"]

Hi Dominik,
 
Are you using the -debugalert startup parameter?  If so, try removing it.
 
Brian

[/quote]

Yes, but removing it didn't changed anything

Posted by Dominik Loewenstein on 20-Sep-2017 09:07

[quote user="Brian K. Maher"]

Hi Dominik,

Are you using the -debugalert startup parameter?  If so, try removing it.

Brian

[/quote]

Yes, but removing it didn't changed anything

[quote user="George Potemkin"]

_UserTableStat will give you the number of records the query retrieved before it stopped. So you will know a record to suspect.

[/quote]

When i debug, the first record causes the problem

[quote user=" Laura Stern"]

Is the program crashing?  I.e., Do you get a procore/protrace file?

[/quote]

nope, i get no protrace file

has anybody tryed to reconstruct the problem ?

Posted by James Palmer on 20-Sep-2017 09:15

Which Progress version is this?

Posted by George Potemkin on 20-Sep-2017 09:18

> the first record causes the problem

What is the value of table.field in the record?

Does 'FOR FIRST table WHERE INT(table.field) = 1916 NO-LOCK' show the same behavior?

Posted by James Palmer on 20-Sep-2017 09:19

Sports2000 DB

for each employee no-lock

 where int(employee.DeptCode) eq 500:

end.

That works fine in 11.6. I've not run it recently, but it's an example I've used as to why it's bad to use functions on the left.

And to be honest, if you find the same situation again, you should fix the query again. It'll work ok for small tables, but trust me, it will be horrible for any table of significant size.

Posted by Tim Kuehn on 20-Sep-2017 09:36

it will be horrible for any table of significant size.

or a small table that's hit on a lot. 

Posted by Dominik Loewenstein on 20-Sep-2017 09:39

it is progress 11.4

i checked some records, every record with non int conform input couses the problem like "abc" or something.

But when i put int("abc") into the query without the field it is no problem.

For first shows the same behavior.

Posted by James Palmer on 20-Sep-2017 10:10

abldojo.services.progress.com:443/

That gives a runtime error.

Are you handling errors within your actual code that is suppressing it going to screen?

Posted by Brian K. Maher on 20-Sep-2017 10:50

What happens if you switch it around?  where table.field = “string value”
 

Posted by Stefan Drissen on 20-Sep-2017 11:59

Using a temp-table hides the issue (and directly throws the run time error).

Using a shared-memory connection (which abldojo uses) also hides the issue (I think )

Using a networked connection the issue is easily reproducible (I'm using 11.7.1 x64 on Windows

Posted by George Potemkin on 21-Sep-2017 01:05

I guess the reason is: INTEGER(table.field) is resolved on a server's side. And remote client server does write the error 76 (Invalid character in numeric input) to a db log.

With both connection types (shared-memory and network) query generates the trappable STOP condition.

Posted by Dominik Loewenstein on 21-Sep-2017 01:10

[quote user="Stefan Drissen"]

Using a temp-table hides the issue (and directly throws the run time error).

Using a shared-memory connection (which abldojo uses) also hides the issue (I think )

Using a networked connection the issue is easily reproducible (I'm using 11.7.1 x64 on Windows

[/quote]

Yes, i tryed the tt example with my local 11.4 version and get the error with the connected DB i get nothing.

Posted by Dominik Loewenstein on 21-Sep-2017 01:52

[quote user="George Potemkin"]

I guess the reason is: INTEGER(table.field) is resolved on a server's side. And remote client server does write the error 76 (Invalid character in numeric input) to a db log.

With both connection types (shared-memory and network) query generates the trappable STOP condition.

[/quote]

I started my local server with the web based open edge management concole.

[2017/09/21@08:48:36.128+0200] P-10344      T-5788  I SRV     1: (76)    ** Ungültiges Zeichen in num. Eingabe s.

My logFile gives me the same error as i saw with the temp table test.

This thread is closed