[RE][jifty-devel] UPDATE in SQL

Jesse Vincent jesse at bestpractical.com
Mon Dec 4 22:44:58 EST 2006




On Tue, Dec 05, 2006 at 12:40:24PM +0900, In-Suk Joung wrote:
>    I answer to my question. I did this way. If anybody knows a fancier way,   
>    please let me know.                                                        
                                                                               

Hi! Sorry for the delay in my reply. I've been working a bit too hard of
late ;)

It should be as easy as 

$object->__set( column => 'column_name',
		value => 'column_name +1'
		is_sql_function => 1);

Best,

Jesse


>                                                                               
>    my $db_handle = $self->_handle;                                            
>    my $table = $self->table;                                                  
>    $db_handle->simple_query(                                                  
>        "UPDATE $table SET column_name = column_name + 1"                      
>        ." WHERE column_name >= ?",                                            
>        $certain_number,                                                       
>                                                                               
>    );                                                                         
>                                                                               
>                                                                               
>                                                                               
>      ---------[ ^1THA-o ,THAI ^3>>?e ]----------                              
>      A|,n : [jifty-devel] UPDATE in SQL                                       
>      ^3-AYEN : Mon, 04 Dec 2006 14:01:01 +0900 (KST)                          
>      -o,^3 1/2AI : "In-Suk Joung" <jmarch at hanmail.net>                        
>      ^1TH'AAI : <jifty-devel at lists.jifty.org>                                 
>                                                                               
>      Could anybody show me a quick example how to replace the SQL below in    
>      Jifty?                                                                   
>                                                                               
>      UPDATE table_name SET column_name = column_name + 1 WHERE column_name >= 
>      $certain_number                                                          
>                                                                               
>      I guess probably I need to use some methods in Jifty::DBI::Handle. But I 
>      have no clue, yet.                                                       
>                                                                               
>      -----------                                                              
>      InSuk Joung                                                              
>      -----------                                                              
>                                                                               
>      [IMG]                                                                    
>      "?`i,(R) AIAAI^3Y, Daum" http://www.daum.net !-oAEo>>y 3/4^2'A ^1<<.a    
>      C,N,THAI^3Y!>>                                                           
>      [IMG]                                                                    
>      [IMG]                                                                    
> 
>    -----------
>    InSuk Joung
>    -----------
> 
>    [IMG]
>    "?`i,(R) AIAAI^3Y, Daum" http://www.daum.net !-oAEo>>y 3/4^2'A ^1<<.a
>    C,N,THAI^3Y!>>
>    [IMG]
>    [IMG]

> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel


-- 


More information about the jifty-devel mailing list