当前位置: 首页>>代码示例>>PHP>>正文


PHP DBC::create方法代码示例

本文整理汇总了PHP中DBC::create方法的典型用法代码示例。如果您正苦于以下问题:PHP DBC::create方法的具体用法?PHP DBC::create怎么用?PHP DBC::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBC的用法示例。


在下文中一共展示了DBC::create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: error_reporting

 * the GNU General Public License version 3 license (the "GPLv3"), in which
 * case the provisions of the GPLv3 are applicable instead of the above.
 * 
 * @author	Tim Kurvers <tim@moonsphere.net>
 */
error_reporting(E_ALL | E_STRICT);
require '../lib/bootstrap.php';
/**
 * This example shows how to create a DBC-file from scratch using DBC mappings
 */
// File we'll be using in this example
$file = './dbcs/Sample.dbc';
// Load map from given INI-file (ensure read-access)
$map = DBCMap::fromINI('./maps/Sample.ini');
// Attempt to create a new DBC at given path (ensure write-access) with given map
$dbc = DBC::create($file, $map);
// Adding a single record
$dbc->add(1, 'John', 100, 1.8, 2, 0);
// Adding multiple records in one call
$dbc->add(array(2, 'Tim', 1337, 1.8, 1, 0), array(3, 'Pete', -10, 1.55, 1, 2));
// Failing to match the defined fields in the map (six, in this example) will silently and gracefully continue
// The following will leave 100, 200, 0, 'Hello' out of the actual record
$dbc->add(11, 'I am providing too many fields', 123, 1.2, 0, 0, 100, 200, 0, 'Hello');
// The following will append 0, 0, 0, 0 to the actual record
$dbc->add(12, 'I am providing too little fields');
// Setting up a collection of records
$records = array();
$records[] = array(4, 'Helen', 100, 1.8, 0, 0);
$records[] = array(8, 'Frank', 1337, 1.73, 0, 0);
$records[] = array(10, 'Brad', -10, 1.55, 0, 0);
// Adding a collection of records in bulk
开发者ID:xianyinchen,项目名称:EventAI-to-SmartAI,代码行数:31,代码来源:creation.php


注:本文中的DBC::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。