Re: DBD::mysql path forward

[email protected] ("H.Merijn Brand") Thu, 14 Sep 2017 08:21:42 +0200
Newsgroups perl.dbi.dev,perl.dbi.users
Message-ID <[email protected]>
On Wed, 13 Sep 2017 13:27:58 -0700, Darren Duncan
<[email protected]> wrote:

> On 2017-09-13 12:58 PM, Dan Book wrote:
> > On Wed, Sep 13, 2017 at 3:53 AM, Peter Rabbitson wrote:
> >
> >     On 09/12/2017 07:12 PM, [email protected] wrote:
> >         And here is promised script:
> >     <snip>
> >
> >     The script side-steps showcasing the treatment of BLOB/BYTEA columns, which
> >     was one of the main ( albeit not the only ) reason the userbase lost data.
> >
> >     Please extend the script with a BLOB/BYTEA test.
> >
> > I'm not sure how to usefully make such a script, since correct insertion of BLOB
> > data (binding with the SQL_BLOB type or similar) would work correctly both
> > before and after the fix.  
> 
> Perhaps the requirement of the extra tests is to ensure that BLOB/BYTEA data is 
> NOT mangled during input or output, that on input any strings with a true utf8 
> flag are rejected and that on output any strings have a false utf8 flag.  Part 
> of the idea is to give regression testing that changes regarding Unicode 
> handling with text don't inadvertently break blob handling. -- Darren Duncan

BYTE/BLOB/TEXT tests require three types of data

• Pure ASCII
• Correct UTF-8 (with complex combinations)
• Pure binary
  - random bytes ranging 0x00..0xFF
  - Images (png, jpg, gif, tiff)

None of those is hard to generate.

1. create two tables with a field of the type to check
2. insert the data in table 1
3. use SQL to copy the data to table 2
4. extract data from table 2
5. compare to original data
6. drop tables
7. goto 1

If MySQL support different ways to do this, test all ways (in the
string, placeholders, bind_columns, bind_params, other ...)

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.27   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/
signature.asc (application/pgp-signature, 473 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJZuh//AAoJEAOhR6E+XcCYZ3IIAJccDRKTPr0s1G1vlIIbN8+I
3h2jMFF5CTLln0a5cXg51Qcet9Rl9dT6FSJk6ZlIcD50OTtPCobibrd5g7cVtw7H
+cmXfeU/EulYKkZ2vyYIE7RELpihhcxQTWdqKweaDbdrJykB/tnuwYy8w3631vhm
I2i9eKaOS98n6iQq0zi7wBgYjqabFtKs/Fwxz5IAb76GQ3RVvhPjNSL+ZfwCuT1Q
j2JMGb8Mn3Czuzk8LZfN5F/7WrKgo/bY0OpRKb5Bq7YALDAXXGT9v4pyF86uJWPI
dXsVXqqqWgQD2cOOMoSL1Ny9EhMcWym3bPJb639MnzFsUpeYWF/HAK9TkUmxoGs=
=YXYm
-----END PGP SIGNATURE-----