Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-26 11:13:53

azw
Member
Registered: 2007-01-29
Posts: 279

When should we use safe_pfx()?

From studying the txplib_db.php file, it looks like most of the database functions incorporate safe_pfx() within the function.

I’m guessing that safe_query requires safe_pfx():

Is that right? Are there others?

Offline

#2 2009-02-26 18:00:29

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: When should we use safe_pfx()?

You don’t need to use it for any of the functions that accept $table, but you do need it for the ones that use safe_query() internally (getRow|s, startRows, getThing|s).

Offline

#3 2009-02-26 19:59:12

azw
Member
Registered: 2007-01-29
Posts: 279

Re: When should we use safe_pfx()?

That helps! Thanks JM.

Is there some place where things like this are documented? I couldn’t find it.

Offline

#4 2009-02-26 20:04:38

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: When should we use safe_pfx()?

Unfortunately, the undocumented source code is all we really have. Using ack or PHPXref can help you figure out how to use some of the DB and misc functions.

Offline

#5 2009-02-26 20:14:47

azw
Member
Registered: 2007-01-29
Posts: 279

Re: When should we use safe_pfx()?

Okay, I’ll try those.

I thought you’d also like to know that posting here helps. Earlier I had found a message from you in another thread that got me started in the right direction. I’m sure this one will help someone else!

Wow, PHPXref looks like it’ll be very helpful! Now I’ll have an easy way to find variables, functions, etc. Thanks again, Jon.

Last edited by azw (2009-02-26 20:17:53)

Offline

#6 2009-02-26 21:53:15

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: When should we use safe_pfx()?

Glad to be of help.

Offline

Board footer

Powered by FluxBB