RSS Git Download  Clone
Raw Blame History
use strict;

# just a test script for testing Rose functions

use Rose::DB;
use Rose::DateTime::Util qw(:all);

Rose::DB->register_db(
  driver   => 'mysql',
  database => 'test',
  username => 'raj',
  password => 'adm1n',
);

#-------------------------------------------------------------------------------
package Foo;

use base qw(Rose::DB::Object);

__PACKAGE__->meta->setup(
  table => 't1',
  columns => [
    id => { type => 'int' },
    ts => { type => 'timestamp' },
  ],
);

#-------------------------------------------------------------------------------
package main;

$Rose::DB::Object::Debug = 1;

my $f = Foo->new(id => 123, ts => parse_date('now') );
$DB::single=1; # perl -d script/test_script.pl, c , x $f
$f->save;

# Output:
#
# INSERT INTO t1
# (
#   id,
#   ts
# )
# VALUES
# (
#   ?,
#   ?
# ) - bind params: 123, 2009-05-14 15:26:31