use strict;
use warnings;
use DBI;
use Data::Dumper;
my $h = DBI->connect();
eval {
$h->do(q/drop table mje/);
};
$h->do(q/create table mje (a varbinary(max))/);
my $t = $h->column_info(undef, undef, 'mje', 'a');
DBI::dump_results($t);
my $x = 'a' x 1000;
my $s = $h->prepare(q/insert into mje values(?)/);
#foreach (1..15) {
# $s->execute($x);
# print "Inserted ", length($x), "\n";
# $x = $x x 2;
#}
$s = $h->prepare("insert into mje values (?)");
# 350kBites -> largest number is 2^(8*350000)-1
for(my $i = 75; $i<2**28000000;$i=$i*2){
print"did";
my $insert='g'x$i;
$s->bind_param(1,$insert,DBI::SQL_VARBINARY);
$s->execute() or print" not ";
$s->finish();
my $sz=length($insert);
print " succeed. size: $sz\n";
}
$Data::Dumper::Indent = 0;
my $r = $h->selectall_arrayref(q/select len(a) from mje/);
print Dumper($r);
##```
##
'master', 'dbo', 'mje', 'a', '-3', 'varbinary', 0, 0, undef, undef, '1', undef, undef, '-3', undef, 0, 1, 'YES', '0', '0', '0', '0', undef, undef, undef, undef, undef, undef, '37'
1 rows
did succeed. size: 75
did succeed. size: 150
did succeed. size: 300
did succeed. size: 600
did succeed. size: 1200
did succeed. size: 2400
did succeed. size: 4800
did succeed. size: 9600
did succeed. size: 19200
did succeed. size: 38400
did succeed. size: 76800
did succeed. size: 153600
did succeed. size: 307200
did succeed. size: 614400
did succeed. size: 1228800
did succeed. size: 2457600
did succeed. size: 4915200
did succeed. size: 9830400
did succeed. size: 19660800
did succeed. size: 39321600
did succeed. size: 78643200
did succeed. size: 157286400
did succeed. size: 314572800
```