• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

slBuildBindDat Replacements

Started by cj, March 18, 2024, 03:33:47 PM

Previous topic - Next topic

cj

Optimizing insert statements using binding discovered PowerBASIC could run of out stack space around 256K using CHR$ statement.

FUNCTION binds(s AS STRING) AS STRING
 LOCAL sb AS ISTRINGBUILDERA
 sb = CLASS "StringBuilderA"
 sb.add MKDWD$(LEN(s)+1)
 sb.add "T"
 sb.add s
 FUNCTION = sb.string
END FUNCTION

FUNCTION bindb(s AS STRING) AS STRING
 LOCAL sb AS ISTRINGBUILDERA
 sb = CLASS "StringBuilderA"
 sb.add MKDWD$(LEN(s)+1)
 sb.add "B"
 sb.add s
 FUNCTION = sb.string
END FUNCTION

FUNCTION PBMAIN AS LONG
 LOCAL s,sbind AS STRING
 s = STRING$(300000,"A")
 sbind = binds(s)
 sbind = bindb(s)
 'sbind = CHR$( MKDWD$(LEN(s)+1), "T", s ) 'crash around 258729 bytes
 ? "Have a crash-free day"
END FUNCTION