The length of string parameters

Started by AdamDevis, June 14, 2018, 09:24:13 AM

Previous topic - Next topic

AdamDevis

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!

Arantor

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.

Advertisement: