I found variants frustrating when I first dug into them, too. However, this is no different than other languages that have peculiar handling of certain types; for instance VB requires you use 'SET' when assigning an object to variable or property. This is just part of learning the language and the libraries one uses.
What language was used when developing the applications that expect ADO date field values to return a string? I see this problem a lot when people attempt to port a VB example to Perl. ADO is made to work most easily with VB. The Win32::OLE::Variant module handles the datatypes in VB that in part make ADO so easy to use in VB.
Perl and ADO can co-exist and I find them very useful (especially when calling stored procedures with many arguments)--but using Perl and ADO together is harder than the other usual combinations of Perl/DBI or VB/ADO.
In short, I wouldn't guage my decision whether to continue using Perl on how difficult is was to get Perl/ADO working properly.
That said (and since this is PM, it had to be said first) there is another option. You can craft your SQL queries to solve this problem for you.
select CONVERT(varchar(30),date_fieldname,120) as date_fieldname from
+...
By using CONVERT (use CAST if ANSI compatible--check syntax), you can return a datefield as a string and should be able to avoid changing lots of code (as you indicated you would have to). I think there is an implicit conversion during updates, so strings can be used when writing to a date field.
If your data provider/data source doesn't support ANSI or TSQL, this SQL fix may not be possible.
Update: added bits about non-TSQL databases.
--
May the Source be with you.
You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
| [reply] [d/l] |