Page 1 of 1
SQL wildcard character and deck methods
Posted: 07 April 2022, 22:44
by emily_nicole
my deck is set up so the locations are pos1, pos2, pos3 and so on
I want to ouse the method getCardsInLocation() but I want to get all the cards that have pos_. In sql I would be able to grab this using the wildcard characters but can I send a wildcard character through the deck methods?
Re: SQL wildcard character and deck methods
Posted: 08 April 2022, 10:55
by RicardoRix
Have you tried using the % wildcard with that function? 'pos%'
If it doesn't work, then as you've already hinted, you can just use the sql functions directly. I don't think the helper functions like getCardsInLocation() are anything more magical than just wrapper functions.
Re: SQL wildcard character and deck methods
Posted: 08 April 2022, 12:29
by robinzig
Indeed, the Deck component is just a very simple wrapper round some basic SQL. The methods it has just do the most common kind of queries. You can just write a direct SQL query to do anything more complex, like what you're talking about - you know the name of the table, plus the columns, even though you didn't create it directly in SQL. (Yes that means the Deck component is a bit of a leaky abstraction, but good engineering practices often don't go with BGA framework development anyway

)