I'm working on a static method that I want to use to query mysql; I'd like the option of handing a char in but I'm only seeing string or int, what if I want to use a wildcard? '_' or an int '1', anyone have a clever solution?

Recommended Answers

All 3 Replies

Not sure what you mean. Please elaborate what you want to do? Give a sample code or input/output would be better.

Sorry; in a PreparedStatement pstmt.setChar() or setString(). I was hoping to be able to pass either an int OR and wildcard _ or %.; I ended up using an overloaded method and determined the required method prior to calling it.

Oh I see. If you want to add that functionality which PreparedStatement doesn't have, you could extend the class and add that functionality to your new class. I don't think it is a standard way because allowing wild card could cause security problems (more flexibilily with less secure). If you don't understand that, you may go to most websites that allow you to search the site, enter a search with wild card character, and you will see what I mean. Many web developers don't handle wild card character very well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.