DBIx::C...BindVars(3)

🌸 NAME 🌸

okay so bestie, you're on the DBIx::C...BindVars(3) page from User Contributed Perl Documentation πŸ’–. The actual module in the spotlight is DBIx::Class::Storage::DBI::NoBindVars β€” sometime DBDs have poor to no support for bind variables. periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

This class is the iconic fix for when the DBD or underlying library does not support the usual "?" placeholders, or at least doesn't support them very well β€” as is the case with DBD::Sybase 😭. It allows queries to work anyway, and honestly? slay.


✨ METHODS ✨

πŸ’… connect_info

We can't cache very effectively without bind variables, so this forces the "disable_sth_caching" setting to be turned on when the connect info is set. no cap, it's for our own good 🫢.

🧚 _prep_for_execute

Manually subs in the values for the usual "?" placeholders. That's the whole move, bestie πŸ’….

πŸŽ€ interpolate_unquoted

This method is called by "_prep_for_execute" for every column to figure out if its value should be quoted or not. The arguments are:

  • the current column data type
  • the actual bind value

The return value is interpreted like this:

  • true β€” do not quote
  • false β€” do quote

You should override this in your Storage::DBI::<database> subclass if your RDBMS does not like quotes around certain datatypes (e.g. Sybase and integer columns). The default method returns false, except for integer datatypes paired with values containing nothing but digits. iykyk ✨.

⚠️ WARNING!!! Always validate that the bind-value is valid for the current datatype. Otherwise you may very well open the door to SQL injection attacks. This is not a drill, bestie β€” SQL injection is giving villain arc πŸ’€.

πŸ“ _prep_interpolated_value

Given a datatype and the value to be inserted directly into a SQL query, this returns the necessary string to represent that value β€” by e.g. adding a '$' sign. It's literally the value's red-carpet outfit πŸ’….


πŸ”₯ FURTHER QUESTIONS? πŸ”₯

Check the list of additional DBIC resources. iykyk πŸ¦‹.


This module is free software copyright by the DBIx::Class (DBIC) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.


That's the whole page, bestie 🫢. This was perl v5.42.0, dated 2025-01-22 β€” mwah πŸ’‹.

πŸ“¦ where this page comes from