If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Can anyone help How do I add a limit on size

Im working on a small code and am trying to limit the size of the mysql databse string its pulling.
It can only be 119 characters, or less if its more i would like to do nothing, but if its meets the requirements it runs the script.

Re: Can anyone help How do I add a limit on size

Igor's advice is very good - just restrict the SQL query so it only returns results with message size < 120. Simple - do it in the query code so you don't need to do it in C++.

Along these lines, why not also only store valid entries in the database? So if the data doesn't meet the criteria, don't store it in the database to begin with. Remember, with databases, it's garbage in; garbage out.

So if you only store 'clean' data in the database, you've got less work to 'fix-up' the data when you use it later.

Such a simple concept, but many developers miss this and cause themselves a lot of work and more complicated code base because they allow bad data to be stored in the database.