execute_array() #2

Merged
merged 7 commits into from Oct 10, 2012

4 participants

@chiselwright

We've recently started using DBI's execute_array() at work.

Out testing used DBD::Mock which doesn't support execute_array().

This set of commits adds the failing test, then implements execute_array() in DBD::Mock.

The testing is a bit sparse, but should be easy enough to extend as and when other users of the module require it.

Behaviour is as we (currently) expect from our test suite with this addition.

chiselwright added some commits Sep 27, 2012
@chiselwright chiselwright Add git-repo url to meta-data
This saves people hunting around github on the offchange that there's a
git-repo of the project. Now it's in the meta data and should be a lot easier
for people to find.
a6f8fa8
@chiselwright chiselwright Add failing test for execute_array()
This is something we've tried using, and hence mocking in tests at $work
recently.
This script fails with the same error we're seeing, so is a good starting
point for adding the functionality:

    $ prove -lv t/030_st_execute_array.t
    t/030_st_execute_array.t ..
    ok 1 - use DBD::Mock;
    ok 2 - use DBI;
    DBD::Mock::st execute_array failed: 3 bind values supplied but 0 expected at t/030_st_execute_array.t line 28.
    not ok 3 - Called execute_array() ok

    #   Failed test 'Called execute_array() ok'
    #   at t/030_st_execute_array.t line 30.
    1..3
    # Looks like you failed 1 test of 3.
    Dubious, test returned 1 (wstat 256, 0x100)
    Failed 1/3 subtests
c9d7bd7
@chiselwright chiselwright git: ignore vi* swap files 62e4f4a
@chiselwright chiselwright execute_array(): don't test single scalar value c51ed6e
@chiselwright chiselwright execute_array(): diag any errors in test 9c5a03a
@chiselwright chiselwright Add bind_param_array() method
This seems to behave the same as bind_param() in our mocked world, so we just
pass the call on.
09e5fb9
@chiselwright chiselwright Add execute_array() method to DBD::Mock::st
This is an early prototype that no longer dies when we call execute_array() on
a mocked $dbh - but the testing doesn't yet have very high coverage to prove
that it behaves as expected.
8729225
@ginesr
Collaborator

@bluescreen10 i'm merging this change, looks good to me!

@ginesr ginesr merged commit efc9492 into bluescreen10:master Oct 10, 2012
@bluescreen10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment