Loading…
Attending this event?
TPRC 2024 in beautiful Las Vegas, Nevada! June 25-27th.
Wednesday, June 26 • 1:30pm - 2:20pm
Hold My Place - Automating SQL placeholders by de-interpolating strings

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Creating SQL queries with placeholders is a must. But composing strings with interpolation is easier and better to read.

How about combining the best of both worlds?# Hold My Place - Automating SQL placeholders by de-interpolating strings

Many are still composing their SQL queries dangerously by assembling their queries with string interpolation.

Not only are such queries slow and prone to errors, they are also loopholes for injections.

But many legacy projects are full of such examples. And refactoring is often not easy.

And even today many developers choose interpolation, since it's a core feature in Perl and comfortable to use.

This talk shows a current project to convert such interpolations to placeholders, without losing the benefits of ease and expressiveness.

We will cover and explain some in-depth techniques like

- Callbacks in DBI.pm
- Manipulating variables with PadWalker.pm
- Bind variables with tie
- Overloading operators for objects

This is an extended and updated version of [my talk at YAPC::Europe & KohaCon'23 in Helsinki](https://perlkohacon.fi/Schedule.html#?talk_id=31)Audience: All["Perl", "SQL", "Interpolation", "Placeholder"]

Speakers

Wednesday June 26, 2024 1:30pm - 2:20pm PDT
Track 2

Attendees (2)