Dave Rolsky > Fey-0.11 > Fey::SQL::Update

Download:
Fey-0.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View Bugs
Report a bug
Source   Latest Release: Fey-0.34

NAME ^

Fey::SQL::Update - Represents a UPDATE query

SYNOPSIS ^

  my $sql = Fey::SQL->new_update();

  # UPDATE Part
  #    SET quantity = 10
  #  WHERE part_id IN (1, 5)
  $sql->update($Part);
  $sql->set( $quantity, 10 );
  $sql->where( $part_id, 'IN', 1, 5 );

  print $sql->sql($dbh);

DESCRIPTION ^

This class represents a UPDATE query.

METHODS ^

This class provides the following methods:

Constructor

To construct an object of this class, call $query->update() on a Fey::SQL object.

$update->update()

This method specifies the UPDATE clause of the query. It expects one or more Fey::Table objects (not aliases). Most RDBMS implementations only allow for a single table here, but some (like MySQL) do allow for multi-table updates.

$update->set(...)

This method takes a list of key/value pairs. The keys should be column objects, and the value can be one of the following:

$update->where(...)

See the Fey::SQL section on WHERE Clauses for more details.

$update->order_by(...)

See the Fey::SQL section on ORDER BY Clauses for more details.

$update->limit(...)

See the Fey::SQL section on LIMIT Clauses for more details.

$update->sql($dbh)

Returns the full SQL statement which this object represents. A DBI handle must be passed so that identifiers can be properly quoted.

$update->bind_params()

See the Fey::SQL section on Bind Parameters for more details.

ROLES ^

This class does Fey::Role::SQL::HasWhereClause, Fey::Role::SQL::HasOrderByClause, and Fey::Role::SQL::HasLimitClause roles.

AUTHOR ^

Dave Rolsky, <autarch@urth.org>

BUGS ^

See Fey for details on how to report bugs.

COPYRIGHT & LICENSE ^

Copyright 2006-2008 Dave Rolsky, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.