Skip to content

Commit a92bdf9

Browse files
committed
TODO, wip, processing @dfishburn code review results
1 parent d55a540 commit a92bdf9

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

autoload/dbext_dbi.vim

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,12 @@ sub db_vim_print
543543
$line_txt = "";
544544
}
545545

546-
# ans, 2022-04-08 - allow to print from dbms_output empty lines
547546
my @lines = ();
548547
if (!defined ($line_txt) || length($line_txt) == 0) {
549-
@lines = ("");
548+
# from dbms_output it is possible to get empty lines to print
549+
@lines = ("");
550550
} else {
551-
@lines = split("\n", $line_txt);
551+
@lines = split("\n", $line_txt);
552552
}
553553

554554
foreach my $line (@lines) {
@@ -973,9 +973,8 @@ sub db_connect
973973
LongTruncOk => 1,
974974
RaiseError => 0,
975975
PrintError => 0,
976-
## hello from ans
977-
ora_charset => 'AL32UTF8',
978-
ora_ncharset => 'AL32UTF8',
976+
ora_charset => 'AL32UTF8',
977+
ora_ncharset => 'AL32UTF8',
979978
PrintWarn => 0 }
980979
);
981980
# or die $DBI::errstr;
@@ -1288,10 +1287,9 @@ sub db_query
12881287
return 0;
12891288
}
12901289

1291-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1292-
# 2021-09-19 ans: fetch all rows of dbms_output
1293-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1294-
sub fetch_dbms_output {
1290+
# Fetches all available rows of dbms_output from server
1291+
sub fetch_dbms_output
1292+
{
12951293
my ($conn_local) = (@_);
12961294

12971295
my $max_line_size = 32768; # anything we put here can be too short...
@@ -1306,7 +1304,7 @@ sub fetch_dbms_output {
13061304
$get_lines_st->bind_param_inout(':n', \$num_lines, 50, {ora_type => 1});
13071305

13081306
$get_lines_st->execute();
1309-
db_debug("executed get_lines() ok. num_lines = $num_lines");
1307+
db_debug("executed get_lines() ok. num_lines fetched = $num_lines");
13101308

13111309
my @text_2 = ();
13121310
if ($num_lines) {
@@ -1323,7 +1321,6 @@ sub fetch_dbms_output {
13231321
}
13241322
}
13251323

1326-
#push @text_2, "WARNING: please not foget to close the statement, debug version only!!!";
13271324
$get_lines_st = undef;
13281325

13291326
## max_line_size exceeded {
@@ -1699,7 +1696,7 @@ sub db_print_results
16991696
db_vim_print($last_line, "(".scalar(@result_set)." rows)");
17001697
if (@dbms_output) {
17011698
$last_line++;
1702-
# ans: we need this "join and afterwards split" trick because otherwise
1699+
# ans: we used to need this "join and afterwards split" trick because otherwise
17031700
# individual rows from @dbms_output are coming encoded differently, see as well
17041701
# exploit Perl_Oracle_DBD_dbms_output/perl_dbd_oracle_dbms_output__inside_vim__simple.vim
17051702
# call :so % | call Check_my_perl__load()
@@ -1710,9 +1707,8 @@ sub db_print_results
17101707
db_debug("db_print_results: \@dbms_output size: ".scalar(@dbms_output));
17111708
my @dbms_output_remade = @dbms_output;
17121709
for my $dol0 (@dbms_output_remade) {
1713-
#### THIS IS MAGIC !!!!!!!
1714-
#### THIS_IS_MAGIC !!!!!!!
1715-
#### THIS IS MAGIC !!!!!!!
1710+
# needed due to (DBI?) encoding problems when receiving from oracle with plsql
1711+
# in/out table, see
17161712
my $dol = decode('utf8', ($dol0 // ''));
17171713
db_debug("db_print_results: printed dbms_output[i] (raw non-splitted) : ".$dol);
17181714
#chomp($dol);

0 commit comments

Comments
 (0)