frioux / DBIx-Class-Helpers

https://metacpan.org/pod/DBIx::Class::Helpers
20 stars 38 forks source link

add dt_SQL_subtract to DateMethods1 #95

Closed domm closed 5 years ago

domm commented 5 years ago

Hi!

This pull request adds the new method dt_SQL_subtract to DBIx::Class::Helper::ResultSet::DateMethods1

It works exactly like dt_SQL_add, but subtracts dates (surprise!).

While one can pass negative values to dt_SQL_add to subtract a literal value ($amount), this does not work when the value is not passed as a literal value but as the name of another column where the actual value is stored. Hence this new method.

Besides the code and some docs I've added test for sqlite and postgres. As I don't have access to other database engines (and could not figure out how to connect the tests to mysql running in Docker), I did not add tests for those engines.

Please note that this work was sponsored by ctrlo.com. I have not added a note to the docs yet, but maybe it would be a nice touch to honor their support for open source software.

Greetings, domm

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.05%) to 98.729% when pulling 0cf72132164ab0ced7c5a7fd9fb4d565b3e18768 on domm:master into ba9ab1bee7e9af1f6a849bb562ad45550f47388e on frioux:master.

frioux commented 5 years ago

Thanks! Go ahead and credit ctrlo for this. Then could you squash all commits except the maint/explain one, since as far as I can tell they are all part of a single unit?

frioux commented 5 years ago

??

-- Sent from a rotary phone rented from Ma Bell

On Mon, Jul 22, 2019, 11:24 AM Thomas Klausner notifications@github.com wrote:

Closed #95 https://github.com/frioux/DBIx-Class-Helpers/pull/95.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/frioux/DBIx-Class-Helpers/pull/95?email_source=notifications&email_token=AAAB7Y6G7X3X76VZ5TNPFRTQAX3OBA5CNFSM4IFOF3E2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOSUGXTJQ#event-2500688294, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAB7YYPFR5QENUMFTLZUYLQAX3OBANCNFSM4IFOF3EQ .

domm commented 5 years ago

Hi!

On Mon, Jul 22, 2019 at 11:27:25AM -0700, fREW Schmidt wrote:

??

While squashing the commits I removed an old branch which the pull req was based on. I guess this also closed this pull req. But I've opened another one: https://github.com/frioux/DBIx-Class-Helpers/pull/96

Sorry for the confusion..

Greetings, domm

--

!/usr/bin/perl http://domm.plix.at

for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}