Author Topic: The length of string parameters  (Read 379 times)

Offline AdamDevis

  • Newbie
  • *
  • Posts: 3
The length of string parameters
« on: June 14, 2018, 09:24:13 AM »
I noticed that when using $smcFunc['db_insert'] there is an option of restricting the length of string parameters (eg string-255). But that option isn't available when using $smcFunc['db_query']. And then I did a little digging and found that db_insert cuts the string to size and then re-labels it as just 'string' before sending the query off to db_query, at least for mysql anyway.

So I guess I'm just curious as to why the option to limit the length isn't there when using db_query. I'm sorry if there's something obvious about this which I've missed.

Thanks in advance!

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,655
    • StoryBB/StoryBB on GitHub
Re: The length of string parameters
« Reply #1 on: June 15, 2018, 06:39:41 AM »
Mostly because there hasn’t historically been much reason to bother. If you want to cut the string, do it with string slicing in the SQL itself.
Please don’t PM me for paid work, I’m not for hire, and even if I was, I doubt you could afford me.
USD$150 per hour. Typical waiting list 3 months.