Strings are limited in size? set doesn't work on long string

Old posts that have not been replied to for several years.
Locked
M
MikePT

Strings are limited in size? set doesn't work on long string

Post by MikePT »

Hi,

I need to set a variable with an SQL statement (Very long one) to execute in MySQL but it seams that long strings doesn't work.

Even this doesnt work:

set testing "(Imagine that this string is 500 chars in length)"

What's the deal, is there any kind of limitation in string length?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

works for me

Code: Select all

proc longstring l {
  set i 0 ; set s ""
  while { $i < $l } {
    append s a
    incr i
  }
  puts $s
  puts [string length $s]
}
% longstring 1000
"a x 1000"
1000
%
edit: had to sidescroll a bunch with all them a's
photon?
M
MikePT

Post by MikePT »

Works for me like this:

Code: Select all

  
  set l 100
  set i 0 
  set s ""
  while { $i < $l } {
    append s a
    incr i
  }
  puts $s
  puts [string length $s]
if do this doesn't work

Code: Select all

  
  set l 1000
  set i 0 
  set s ""
  while { $i < $l } {
    append s a
    incr i
  }
  puts $s
  puts [string length $s]
It seams that strings have a limit :(
i am using Activetcl 8.4.7 for Windows and Windrop (eggdrop for windows)
M
MikePT

Post by MikePT »

Does anyone have this problem? I am getting out of options, i cant compact my sql statement (MySQL 4.0 does not support nested selects) :cry:
M
MikePT

Post by MikePT »

correction, this works with tclsh

Code: Select all

  set l 1000
  set i 0
  set s ""
  while { $i < $l } {
    append s a
    incr i
  }
  puts $s
  puts [string length $s]
This doesn't work with windrop:

Code: Select all

 set l 500
  set i 0
  set s ""
  while { $i < $l } {
    append s a
    incr i
  }
  putserv "NOTICE $nick : $s" 
So it must be a windrop problem, or a cygwin problem, any thoughts?
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

I'm not sure about other ircds, but IRCnet version limit maximum characters, which can be send to server in one line to 480.
Que?
M
MikePT

Post by MikePT »

KrzychuG wrote:I'm not sure about other ircds, but IRCnet version limit maximum characters, which can be send to server in one line to 480.
I guess that it the problem... i changed my code to this:

Code: Select all

  putserv "NOTICE $nick : Test..."

  set l 500
  set i 0
  set s ""
  while { $i < $l } {
    append s a
    incr i
  }
  set dimension [string length $s]
  putserv "NOTICE $nick : $dimension"
  putserv "NOTICE $nick : $s"
And it sent two NOTICES:

Test...
500

I guess it's solved, thanks :wink:
Locked