(OT) Parsing SQL space padded results in Rev]
len-morgan at crcom.net
Wed Oct 17 07:43:25 EDT 2007
At last maybe I can give back a little of the help I've gotten from this
Where is this output coming from:
apples | ti plant | prestidigitator | key
key | prestidigitator | ti plant | apples
That looks a lot like the output of the psql command and not the Rev
database commands. Psql is for command line
use but it CAN be used to extract data. I think the specific option you
want is \a ("Toggle alignment"). You can use
\? from within psql to get a complete list.
Just in case that is NOT the problem, what are the field types for the
columns you're looking at? If they are varchar(xx)
or text, you won't get any padding (by Postgres anyway). If they are
char(xx), they will always be padded out to
the length of xx.
If you don't have too many queries to rewrite (and you HAVE to use
psql), you can always CAST the return values.
SELECT charField1, TRIM(charField1) FROM mytable ;
The first field will be padded, the second not. You can of course leave
off the first field in the query.
Hope that helps.
Sannyasin Sivakatirswami wrote:
> (I'm reading in the Rev use list on this one. I'm
> sure this has been tackled and solved 1000
> Times already, getting clean data back from SQL queries)
>> At 12:23 PM 10/14/2007, SKTS wrote:
>>> but the number of spaces varies...
>> Sadhunathan Nadesan wrote:
>> huh, are you sure? seems like that would be consistent ... or,
>> couldn't vary too much .. how many different patterns? two, three?
>> maybe i will try this when i get a chance
> Ummm, what am I missing:
> Space padding must *always* be infinitely variable,
> n'est ce pas? otherwise how do you get
> apples | ti plant | prestidigitator | key
> key | prestidigitator | ti plant | apples
> to line up?
> Anyway, this sure seems a hack anyway you cut it.
> PostGreSQL *must* have a -* parameter to return results
> without any space padding.
> Select * from trivia where fld_whatever = 'key';
> should be able to return:
> apples|ti plant|prestidigitator|key
> key|prestidigitator| ti plant|apples
> from Kauai, where we now have a daily temperature running
> around 68-74 with light breezes from the east and a bit
> more rain than we might like but Waialeale need to
> keep up it's reputation as the rainest place on the plant
> (1000+ inches in 2005) Oh and did I say that we have
> a family of wild boar now living on the land? digging
> up everything in sight...(smile)
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode