kaigou: this is what I do, darling (contemplation)
[personal profile] kaigou
I know there's a way to do it, but I'm not sure of that exact way, and I'm pretty sure whatever I come up with is gonna be so convoluted as to be worthless in the end. GAH.

Okay, someone on my flist has got to know this one: if I have a field in a MySQL db that contains an array (say, carrots, tomatoes, squash), I've no problem getting it in and no problem getting it out. (Mostly.) What I don't know is whether the search function to find that array again -- or any like it -- would require precision or could be relatively sloppy.

I mean, if I search for all fields that contain "carrots, tomatoes, squash," would I get back every field that has any of the three, or would I get back all fields with all three only if they're in the same order, or would I get back any in any order plus fields that also contain "kumquat"? (I've always treated arrays like some kinda black hole of SQL, where you put info in and it's only good as long as you don't try to do anything else with it...)

It comes down to not being sure whether I can preempt an existing db's design to insert arrays that I know I can later search/reproduce -- or if I'll need to create a new table and slot these things in separately. Unfortunately, the create-a-new-table operation would be even more hassle, given I've got to deal with WP's functions to get in and out of it, and they're not always quite as intuitive as I'd like.

So. Anyone?

Date: 13 Apr 2009 03:52 pm (UTC)
From: [identity profile] kaigou.livejournal.com
MySQL is mostly like Oracle, at least logic-wise (even if its syntax differs somewhat). I'm trying to think of how I could force a specific order, like alphabetically, and I'm not sure I could do that without a whole 'nother heap of code between getting the input and putting it in the db -- and the more code, the more places for breakage.

Yeah...okay, I guess this means I figure out how to do a new table OR how to herd the input so the results will become a single string (like instead of pick A, pick B, pick C, listing option A, A+B, A+B+C, and it'd be a nuisance but at least consistent, then).

Of course, it goes without saying that if I can't get any of it to hook into Wordpress' existing functions, it'll all blow up in my face anyway. BLEAH. The things I do, I swear, why can't I ever go with the easy options?

whois

kaigou: this is what I do, darling (Default)
锴 angry fishtrap 狗

to remember

"When you make the finding yourself— even if you're the last person on Earth to see the light— you'll never forget it." —Carl Sagan

October 2016

S M T W T F S
      1
2345678
91011 12131415
16171819202122
23242526272829
3031     

expand

No cut tags