总有人间一两风,填我十万八千梦

PHP udm_alloc_agent 用法 手册 | 示例代码

PHP开发手册 归档 452℃ 0评论

udm_alloc_agent

(PHP 4 >= 4.0.5, PHP 5 < 5.1.0, PECL mnogosearch >= 1.0.0)

udm_alloc_agentAllocate mnoGoSearch session

说明

udm_alloc_agent ( string $dbaddr [, string $dbmode ] ) : resource

Allocate a mnoGoSearch session.

参数

dbaddr

dbaddr – URL-style database description, with options (type, host, database name, port, user and password) to connect to SQL database. Do not matter for built-in text files support. Format for dbaddr: DBType:[//[DBUser[:DBPass]@]DBHost[:DBPort]]/DBName/. Currently supported DBType values are: mysql, pgsql, msql, solid, mssql, oracle, and ibase. Actually, it does not matter for native libraries support, but ODBC users should specify one of the supported values. If your database type is not supported, you may use unknown instead.

dbmode

dbmode – You may select the SQL database mode of words storage. Possible values of dbmode are: single, multi, crc, or crc-multi. When single is specified, all words are stored in the same table. If multi is selected, words will be located in different tables depending of their lengths. "multi" mode is usually faster, but requires more tables in the database. If "crc" mode is selected, mnoGoSearch will store 32 bit integer word IDs calculated by CRC32 algorithm instead of words. This mode requires less disk space and it is faster comparing with "single" and "multi" modes. crc-multi uses the same storage structure with the "crc" mode, but also stores words in different tables depending on words lengths like in "multi" mode.

Note:

dbaddr and dbmode must match those used during indexing.

返回值

Returns a mnogosearch agent identifier on success, FALSE on failure. This function creates a session with database parameters.

注释

Note:

In fact this function does not open a connection to the database and thus does not check the entered login and password. Establishing a connection to the database and login/password verification is done by udm_find().

用户贡献的笔记

cmv at php dot net

For what it's worth, the following PHP code won't work:

<?  $U = udm_alloc_agent('mysql://localhost/example'); ?>

But this will:

<?  $U = udm_alloc_agent('mysql://localhost/example/'); ?>

That trailing slash is all-important.

stuart at horuskol dot co dot uk

The function appears to ignore the second parameter completely -
and the default mode is "blob", which is not even mentioned in this page.

In order to be able to select the right mode, do the following:

<?php

  $this->agent =
udm_alloc_agent("mysql://host/database/?DBMode=multi");

?>

转载请注明:悠然品鉴 » PHP udm_alloc_agent 用法 手册 | 示例代码

喜欢 (0)or分享 (0)
发表我的评论
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址