-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBD::Sponge corrected and lazy default PRECISION #12
base: master
Are you sure you want to change the base?
Conversation
sub _max_columnar_lengths {
my ($numFields, $rows) = @_;
my @precision = map { max map { length ($_||"") } @$_ } @$rows;
return wantarray ? @precision : \@precision;
} Nope. That gives us the max data length in each row, one per row. We want the column-wise max data length. (Also see second commit — I renamed sub, and just want to make sure you are looking at final form of this PR.) |
Wilco. On Tuesday, December 9, 2014, Jens Rehsack [email protected] wrote:
|
@rehsack, I updated the branch against current DBI and added some explanatory comments to the tests and changes. (I also documented DBD-Sponge's default TYPE.) @Tux, @mjegh, it's been a while on this PR, but the basic issue is that a Spongey data set incorrectly defaults PRECISION to the length of the name of fields rather than the length of the data. To correct this, if the user does not specify PRECISION but later requests that attribute, we loop through the rows and remember the longest length for each column. The |
I agree the current behaviour is broken. The DBI docs for PRECISION say:
So I see two problems:
|
OK I'll revisit. -Mike On Sat, Jul 18, 2015 at 7:04 AM, Tim Bunce [email protected] wrote:
|
Thanks @pilcrow! |
Any news on this @pilcrow ? |
@pilcrow ? |
I’ll take a look thanks.
…On Sun, Aug 11, 2024 at 3:48 AM H.Merijn Brand ***@***.***> wrote:
@pilcrow <https://github.com/pilcrow> ?
—
Reply to this email directly, view it on GitHub
<#12 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA5IOUTDVGGCFAN42WYDL3ZQ4QOZAVCNFSM6AAAAABMKSEYC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSGY3TSNJZHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
DBD::Sponge defaults statement handle PRECISION to the length of column NAMEs, which means that a result set's PRECISION can be nonsensically smaller than would actually be required for the data:
This request changes that default to the columnar maximum lengths of the data, computed only if needed. Test cases and small POD update. (Noticed this playing with yet another DBI::Shell alternative.)