--oyUTqETQ0mS9luUI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 17, 2002 at 11:53:19PM +0900, Gavin Sinclair wrote: > From: "Philipp Meier" <meier / meisterbohne.de> > > > > For now, I am resorting to storing my date information as strings in the > > database. Does anyone know about the logistics of database-independentate > > handling? > > I use DBI with Mysql and prepared statements: > > stm = dbh.prepare("intert into test values (?)") > stm.execute(Time.now) > > -billy. > > Hmmm.... I can't test right now, but I'll give it a try. Just so this post is > not a totally information-free zone, let me pass on a curious result. > > SQL> create table test_date (test DATE); > SQL> insert into test_date values ('01-OCT-2002'); > > % ruby <<EOF > require "dbi" > DBI.connect(...) do |dbi| > date = dbi.select_one("select * from test_date").to_h["TEST"] > puts date > puts date.class > end > EOF > > 01-OCT-02 > String > > === > > So, DATE information in the database in returned through either DBI or the > Oracle driver as a String. I'll try the method you posted shortly, but I'm not > confident. (It's probably the Oracle driver.) Yes, indeed. DBI _returns_ every column as String. You can use dbh.columns(table)[0].sql_type to determine the sql type an convert it yourself. -billy. -- Meisterbohne Söælinger StraÝÆ 100 Tel: +49-731-399 499-0 eLungen 89077 Ulm Fax: +49-731-399 499-9 --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQE9rurYfBriNoqItSYRAiVhAJ0VZNYUbmkrHQOhOKx8o17DqBGnMgCfT0lG QKgbGhYSLH2gkDFWuiz46d4qg -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--