Orange-OpenSource / YACassandraPDO

Cassandra PDO Driver fork
Apache License 2.0
85 stars 32 forks source link

Inserts fail while binding a timestamp field in php? #85

Closed jayeshjain24 closed 9 years ago

jayeshjain24 commented 9 years ago
          CREATE TABLE session (
                  entry_date timeuuid,
                  user_id text,
                  check_in timestamp,
                  check_out timestamp,
                  email text,
                  unique_id text,
                  PRIMARY KEY (entry_date, user_id)
           )

This is how my table is structured.

But when i try to insert check_in and check_out,my inserts fail.

            $query ="
    INSERT INTO session
    (entry_date, unique_id, user_id, email,check_in,check_out)
    VALUES
    (now() , :unique_id, :user_id, :email, $check_in, $check_out)";

    parent::queryCassandra($query);

    parent::bindValue(':unique_id', $unique_id, PDO::PARAM_STR);
    parent::bindValue(':user_id', $user_id, PDO::PARAM_STR);
    parent::bindValue(':email', $email, PDO::PARAM_STR);
    parent::bindValue(':check_in', $check_in, PDO::PARAM_STR);
    parent::bindValue(':check_out', $check_out, PDO::PARAM_STR);

            $is_execute=parent::execute();

I even tried inserting timestamp as int,but it wont work.

Any idea?