数据库配置参见:./__project__/php/prj.config.php
,默认给出了连接2个数据库的示例,你可以自行增减
class Dbconfig
{
const db_connect_main=1;
const db_connect_other=99;
const db_connect_configmap=
[
self::db_connect_main=>
[
'db_driver_config'=>
[
'db_driver_type' =>'mysql',
'db_driver_host' =>'127.0.0.1',
'db_driver_port' =>'3306',
'db_driver_charset' =>'utf8',
'db_driver_databasename' =>'xxx.xxx',
'db_driver_user' =>'xxx.xxx',
'db_driver_password' =>'xxx.xxx',
],
'db_table_defaultconfig'=>
[
'db_table_prikey'=>'id',
'db_table_signedfileds'=>false,//指定有正负数的栏位,默认数字类型的栏位会自动调整为unsigned
'db_table_serializedfileds'=>false,//对于指定的fields用序列化存储,查询出来是可能是php标量,通常为数组
'db_table_adjuststruct_enable'=>__online_isonline__?false:true,//是否自动调整表结构,对于数字类型的会调整成unsigned(db_table_signedfileds约定的除外)且默认值为0,varchar会调整成not null且默认值是空字符串
'db_table_adjuststruct_maxrownum'=>1000000,//数据量太多的表不能自动调整表结构
'db_table_triggers'=>false,//false会把数据库中原来的触发器删掉,cmd_ignore则不会同步触发器
],
],
self::db_connect_other=>
[//如果需要第二数据库的话,演示的配置是和第一数据库相同的
'db_driver_config'=>
[
'db_driver_type' =>'mysql',
'db_driver_host' =>'127.0.0.1',
'db_driver_port' =>'3306',
'db_driver_charset' =>'utf8',
'db_driver_databasename' =>'xxx.xxx',
'db_driver_user' =>'xxx.xxx',
'db_driver_password' =>'xxx.xxx',
],
'db_table_defaultconfig'=>
[
'db_table_prikey'=>'id',
'db_table_signedfileds'=>false,
'db_table_serializedfileds'=>false,
'db_table_adjuststruct_enable'=>__online_isonline__?false:true,
'db_table_adjuststruct_maxrownum'=>1000000,
'db_table_triggers'=>false,
],
]
];
}