Changeset 20713

Show
Ignore:
Timestamp:
10/04/08 22:50:33 (3 months ago)
Author:
cocoiti
Message:

Lua拡張に対応した(テストは環境が必要なためコメントアウト)

Location:
lang/php/Net_TokyoTyrant/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/php/Net_TokyoTyrant/trunk/Net/TokyoTyrant.php

    r19380 r20713  
    1010    private 
    1111      $errorNo, $errorMessage; 
     12 
     13    const RDBXOLCKNON = 0; 
     14    const RDBXOLCKREC = 1; 
     15    const RDBXOLCKGLB = 2; 
    1216     
    1317    public function connect($server, $port, $timeout = 10) 
     
    254258    public function putint($key, $num) 
    255259    { 
     260        //This Code is non support 
    256261        $value = pack('V', $num); 
    257262        return $this->put($key, $value); 
     
    260265    public function getint($key) 
    261266    { 
    262         $data = $this->get($key); 
    263         if ($data === false) { 
    264             return false; 
    265         } 
    266         $value =  unpack('V', $data); 
    267         return $value[1]; 
     267        return $this->addint($key, 0); 
    268268    } 
    269269 
     
    278278    } 
    279279 
     280 
     281    public function ext($extname, $key, $value, $option = 0) 
     282    { 
     283        $cmd = pack('c*', 0xC8,0x68); 
     284        $this->_doRequest($cmd, array($extname, $option, $key, $value)); 
     285        if ($this->_getResponse() === false) { 
     286            return false; 
     287        } 
     288        return $this->_getData(); 
     289    } 
     290 
    280291    public function vsize($key) 
    281292    { 
  • lang/php/Net_TokyoTyrant/trunk/tests/tmp_test.php

    r19380 r20713  
    88$data2 = 'the test2 data'; 
    99$count_key = 'count'; 
     10$extname = 'echo'; 
    1011$error = null; 
    1112try { 
     
    7374assert($tt->addint($count_key, -3) === -1); 
    7475 
     76//$value = 'data'; 
     77//assert($tt->ext($extname, $key, $value) === $value); 
     78//assert($tt->ext($extname, $key, $value, Net_TokyoTyrant::RDBXOLCKNON) === $value); 
     79//assert($tt->ext($extname, $key, $value, Net_TokyoTyrant::RDBXOLCKREC) === $value); 
     80//assert($tt->ext($extname, $key, $value, Net_TokyoTyrant::RDBXOLCKGLB) === $value); 
     81 
    7582 
    7683assert($tt->sync() === true);