Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Looking for some way to check data

Quote Reply
Looking for some way to check data
Hi:

The way my links install is set up, I have many fields that it is important that they end in the last character of the entry- my templates supply a period after the data. Now and again, I get a little sloppy, and a final space get's in there- let's face it, a space is not too easy to spot. But that space looks really ugly in the page view- a space between the enty and the period just looks sloppy!

Is there some quick and dirty code I can run (perl orMySQL) on specific fields that will return all ID numbers of links that the field ends in a space?
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Looking for some way to check data In reply to
From the mysql docs:

Quote:

Values in VARCHAR columns are variable-length strings. You can declare a VARCHAR column to be any length from 0 to 255, just as for CHAR columns. (Before MySQL 4.0.2, the length of VARCHAR may be from 1 to 255.) However, in contrast to CHAR, VARCHAR values are stored using only as many characters as are needed, plus one byte to record the length. Values are not padded; instead, trailing spaces are removed when values are stored. (This space removal differs from the standard SQL specification.) No case conversion takes place during storage or retrieval.



Quote:

TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str) [/url]Returns the string str with all remstr prefixes and/or suffixes removed. If none of the specifiers BOTH, LEADING or TRAILING is given, BOTH is assumed. If remstr is not specified, spaces are removed. mysql> SELECT TRIM(' bar '); -> 'bar' mysql> SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx'); -> 'barxxx' mysql> SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx'); -> 'bar' mysql> SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz'); -> 'barx'


on a test set of data (not your live data)

Try something like:

update prefix_Links
set field_name = TRIM(TRAILING ' ' FROM field_name)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Looking for some way to check data In reply to
Thanks Pugdog-
dave

Big Cartoon DataBase
Big Comic Book DataBase