コード例 #1
0
ファイル: noSQLite.php プロジェクト: macinnir/php-noSQLite
 public function __construct($table)
 {
     $this->table = $table;
     $this->location = self::DAT_DIR . $table . self::DATA_FILE_EXT;
     if (!($this->dataHandle = fopen($this->location, self::OPEN_MODE))) {
         throw new Exception('Could not open dat file.');
     }
     if (filesize($this->location) > 0) {
         index::init();
         fseek($this->dataHandle, 0);
         $b_headerLength = fread($this->dataHandle, self::sumSizes(self::T_HEADER_LENGTH));
         $unpack = unpack(self::unpackString('HEADER_LENGTH'), $b_headerLength);
         $b_header = fread($this->dataHandle, $unpack['HEADER_LENGTH']);
     }
     $b_meta = $b_headerLength . $b_header;
     $this->meta = new meta($b_meta);
 }