DB-Handy

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    .dat formats are otherwise unchanged and remain readable.
  - $sth->execute() with the wrong number of bind values now returns
    undef with errstr set instead of running a statement with an
    unsubstituted placeholder or a dropped value.
  - ORDER BY <number> is now a select-list position rather than a
    constant.  A query that passed a literal number expecting it to be
    ignored will now sort, or fail if the position does not exist.

  Tests:
  - t/1022_names.t: new, 33 assertions covering the identifier check.
    The central case builds a victim directory next to base_dir, puts a
    file in it, and asserts that drop_database('../victim') is refused
    and the file survives.  The rest covers every guarded method, the
    three errstr messages, that ordinary names with digits, underscores
    and mixed case still work end to end, and that the SQL layer is
    unchanged.
  - t/1001_dbms.t .. t/1016_unsupported.t: the scratch directory was
    hard-coded as /tmp/<name>_$$.  On Windows that resolves to the root
    of the current drive (C:\tmp), which a standard user account may not
    be able to write to, and everywhere it ignored TMPDIR/TEMP and so
    wrote outside a smoker's working area.  All sixteen now build the
    path with File::Spec->catdir(File::Spec->tmpdir, ...), matching
    t/1017 onwards.
  - t/1001_dbms.t .. t/1016_unsupported.t: the plan line was a
    hard-coded "1..N" that had to be recounted by hand whenever an
    assertion was added or removed.  ok()/is() now buffer their output
    and the plan is printed from the number of assertions that actually
    ran, so it cannot drift.  The plan still comes first in the stream,
    which is what the Test::Harness shipped with 5.005_03 expects.  If
    the body dies before the plan is emitted, an END block flushes what
    did run and appends one failing assertion, so the harness gets a
    complete and definitely-failing stream instead of no plan at all.
  - t/1001_dbms.t .. t/1021_integrity.t: the scratch directory was
    removed by a statement at the end of the file, which never ran if
    the script died part way through.  All twenty-one now remove it from
    an END block instead.
  - t/1021_integrity.t: new, 46 assertions covering PRIMARY KEY and
    UNIQUE enforcement and their index names, NULL exemption from
    UNIQUE, JOIN parsing without table aliases (INNER, LEFT, LEFT
    OUTER), the execute() bind-count check, err/errstr clearing, and
    ORDER BY by position across the single-table, SELECT *, GROUP BY,
    JOIN and derived-table paths.
  - t/1008_constraints.t: the PRIMARY KEY block asserted the old
    behaviour (a duplicate key being accepted) and now asserts that it
    is rejected and that the index id_pk was created.
  - t/1020_sql_layer.t: new, 31 assertions covering whitespace
    preservation inside literals across INSERT/SELECT/WHERE/LIKE/
    UPDATE/DELETE and index lookups, statement layout normalisation
    outside literals, aggregates over derived tables, GROUP BY /
    HAVING / ORDER BY / LIMIT on a derived table, and the AutoCommit
    attribute.
  - t/1019_types.t: new, 37 assertions covering the INT range check,
    the values that stay accepted, DATE validity including the leap
    year rules, NULL handling, the same checks on UPDATE, and byte
    transparency of the .dat file.
  - t/1018_hardening.t: new, 33 assertions covering the second-round
    fixes: comment stripping and literal protection, index integrity
    across INSERT/UPDATE/DELETE/vacuum, the new statement attributes,
    placeholder handling, the documented fetchall_arrayref slice
    behaviour, and I/O failure reporting on the write paths.  The
    last group is skipped when chmod does not stop the test process
    from writing (running as root, or a file system without it).
  - t/1017_regression.t: new, 29 assertions covering each of the eight
    fixes above.  Its plan count is derived from the list of test
    closures rather than hard-coded, and the runner turns a die inside
    a closure into a single "not ok" so that one crashing case does not
    truncate the report.

  Code:
  - lib/DB/Handy.pm: _load_schema() builds the schema as a hash
    reference from the start instead of taking \%sch of a named hash.
    Behaviour is unchanged -- the cached entry in $self->{_tables} and
    the returned value are still the same reference -- but the house
    style rule "use { %hash } instead of \%hash" now holds with no
    per-distribution exemption, which 'pmake dist' requires.
  - t/9080-cheatsheets.t: substr($raw,$i,1) respaced to
    substr($raw, $i, 1) (K1: a comma is followed by whitespace).
  - lib/DB/Handy.pm: the Fcntl import is now qw(:flock).  The :DEFAULT
    tag brought in the O_* constants, none of which is used -- every
    open() in the module is the two-argument mode-string form.

  Documentation:
  - lib/DB/Handy.pm: DIAGNOSTICS gains the three "Invalid ... name"
    messages, and METHODS - Low-level API opens with the identifier
    rule and the reason it is there.
  - lib/DB/Handy.pm, README: DIAGNOSTICS said that the error variables
    are "set on every failed operation and cleared on success".  That
    holds for $dbh->errstr and $sth->errstr but not for the
    package-level $DB::Handy::errstr, which is only ever overwritten by
    the next error and so still holds a stale message after a success.
    Both now say so and point at the handle accessor instead.
  - eg/crud_sample.pl: the script leaves ./sample_db behind on purpose,
    so that eg/db_dump.pl has something to read, but said nothing about
    it.  The header comment now explains this and the closing message
    gives the db_dump.pl command line and the one-liner that removes the
    directory.
  - Contact address changed from ina@cpan.org to ina.cpan@gmail.com
    throughout lib/DB/Handy.pm, README, Makefile.PL, META.yml,
    META.json and SECURITY.md.
  - lib/DB/Handy.pm: POD =head1 VERSION corrected from "Version 1.07"
    to "Version 1.09" (was not updated at the 1.08 release).
  - lib/DB/Handy.pm: the Subqueries section documents what the outer
    query of a derived table accepts, including aggregates and the
    order in which LIMIT is applied.  The feature list notes that
    whitespace inside a quoted value is preserved.  =head1 ATTRIBUTES
    documents AutoCommit, which is no longer listed as unimplemented.
  - lib/DB/Handy.pm: =head1 DATA TYPES describes the INT range check
    and the DATE validity rules, and no longer claims that no date
    validation is performed.  The FLOAT entry now distinguishes the
    order-preserving encoding used for index keys from the native
    double written to the .dat file.
  - lib/DB/Handy.pm: corrected seven POD passages that described the
    array-ref column order as alphabetical.  It is the SELECT list
    order for a named column list and the CREATE TABLE declaration
    order for SELECT * (qualified, table by table, for a JOIN); the
    =head2 NAME entry already said so, so the POD contradicted itself.
  - lib/DB/Handy.pm: fetchall_arrayref documents that a column-index
    slice such as [0, 2] is ignored and every column is returned.
  - lib/DB/Handy.pm: DBI COMPATIBILITY and =head1 ATTRIBUTES list the
    new NAME_lc / NAME_uc / NUM_OF_PARAMS / Statement attributes, and
    Statement is no longer listed as unimplemented.



( run in 0.780 second using v1.01-cache-2.11-cpan-9789f410c06 )