...的索引对象: ~~~ [php] require '$prefix/sdk/php/lib/XS.php'; $xs = new XS('demo'); // 建立 XS 对象,项目名称为:demo $index = $xs->index; // 获取 索引对象 ~~~ 索引的维护包括数据修改/更新、数据删除、添加数据等操作,由后面的篇幅分开详细讲...
...port']) ? $param['port'] : ini_get('mysqli.default_port'); $this->obj = new mysqli($host, $user, $pass, '', $port); if ($this->obj->connect_error) { throw new XSException("Can not connect to mysql server: '$user@$host'"); } if (!$this->obj->select_db($param['dbname'])) { $t...
... $config = null){ if (!$field instanceof XSFieldMeta) { $field = new XSFieldMeta($field, $config); } if (isset($this->_fields[$field->name])) { throw new XSException('Duplicated field name: `' . $field->name . '\''); } if ($field->isSpeical()) { if (isset($this->_...
...me); if ($ff->type !== XSFieldMeta::TYPE_STRING) { throw new XSException("Field `$name' cann't be used for facets search, can only be string type"); } $buf .= chr($ff->vno); } $cmd = array('cmd' => XS_CMD_SEARCH_SET_FACETS, 'buf' => $buf); $cmd['arg1'] = $exa...
... isset($param['pass']) ? $param['pass'] : ''; try { $this->obj = new PDO($dsn, $user, $pass); } catch (PDOException $e) { throw new XSException($e->getMessage()); }} 连接数据库 具体的每个类必须实现 makeDsn 来将参数转换为 dsn 参见 makeDsn mak...
... } if (!$ioerr && !($this->_flag & self::FILE)) { $cmd = new XSCommand(XS_CMD_QUIT); fwrite($this->_sock, $cmd); } fclose($this->_sock); $this->_flag |= self::BROKEN; }} 关闭连接 附带发送发送 quit 命令
...php://stdin'; } if (!($this->fd = fopen($file, 'r'))) { throw new XSException("Can not open input file: '$file'"); } $this->line = 0; if (isset($_SERVER['XS_CSV_DELIMITER'])) { $this->delim = $_SERVER['XS_CSV_DELIMITER']; }}
...ed'; $msg .= ' property: ' . get_class($this) . '::$' . $name; throw new XSException($msg);} 魔术方法 __get 取得模拟属性的值, 内部实际调用 getXxx 方法的返回值
... if (($this->link = sqlite_open($param['path'])) === false) { throw new XSException("Can not open sqlite file: '{$param['path']}'"); }} 打开数据库 query() 方法 public mixed query(string $sql) $sql string 要执行的 SQL 语句 {return} mixed 源...
...ed'; $msg .= ' property: ' . get_class($this) . '::$' . $name; throw new XSException($msg);} 魔术方法 __set 设置模拟属性的值, 内部实际是调用 setXxx 方法