Page 1 of 1
difficulty with long string vars
Posted: Thu Aug 23, 2007 6:21 pm
by tboyer
Hi all,
I'm trying to compare some very long strings (document sized) and I get the following error:
FOP 136 failed
The error occurs in the following line, which is comparing a long string to another long string:
<if $text eq $text2>
Sounds like I'm bumping up against a memory limit.
Maybe there's a better way to compare strings? I can avoid trouble by hashing the documents but in this case I would prefer to use the original because I want the result to be definitive.
Thoughts?
Tom
difficulty with long string vars
Posted: Fri Aug 24, 2007 4:06 pm
by Kai
You may very well be running out of memory if the strings are large. You could try using <strcmp>:
<strcmp $text $text2>
<if $ret eq 0>
...
which may or may not use less memory.
difficulty with long string vars
Posted: Fri Aug 24, 2007 4:51 pm
by tboyer
Thanks much.
I also found that presence of a $ in the field (varchar) was getting in the way -- I assume because the program was confusing it for another variable. If I sandr it into $$ it behaves -- and maybe strcmp won't get confused that way?
difficulty with long string vars
Posted: Fri Aug 24, 2007 5:23 pm
by mark
The $ thing doesn't make sense. The content shouldn't matter. Maybe you could open a tech support ticket so we can arrange to get your actual data etc to see what's going on.
difficulty with long string vars
Posted: Fri Aug 24, 2007 5:25 pm
by tboyer
Just FYI <strcmp> does NOT get confused by dollar signs in a text field. Seems to solve the problem elegantly. Thanks.
difficulty with long string vars
Posted: Mon Aug 27, 2007 3:22 pm
by mark
I'm not able to replicate that problem at all.
How big are these fields?
What's your texis version and platform? (full output of texis -version)
difficulty with long string vars
Posted: Tue Aug 28, 2007 12:49 pm
by mark
For the record the problem turned out to be related to data types, not content. A blob should be converted to varchar for the comparison. Sandring and strcmping caused implicit conversions.
difficulty with long string vars
Posted: Tue Aug 28, 2007 1:18 pm
by tboyer
Yes, here's the fix we use:
For a blob field called Textfield
<sql "select id, convert(Texfield,'varchar') Textfield etc