Php Postgres兼容Joomla组件
因为Joomla2.5在本地支持PostgreSQL,我们非常支持这一点。当我为我们的系统开发一个组件时,我想知道使它兼容的确切语义是什么Php Postgres兼容Joomla组件,php,postgresql,joomla,Php,Postgresql,Joomla,因为Joomla2.5在本地支持PostgreSQL,我们非常支持这一点。当我为我们的系统开发一个组件时,我想知道使它兼容的确切语义是什么 对于MySQL,我的安装脚本位于admin/sql/install.MySQL.utf8.sql中。PostgreSQL会有什么好处?我可以将#用作数据库前缀吗?额外的数据库支持意味着尽可能透明,以便您可以保持大部分代码不变 如果你一直在用Joomla!”在PHP中,您应该像这样构造查询: /* (example php may not actual
对于MySQL,我的安装脚本位于
admin/sql/install.MySQL.utf8.sql
中。PostgreSQL会有什么好处?我可以将#
用作数据库前缀吗?额外的数据库支持意味着尽可能透明,以便您可以保持大部分代码不变
如果你一直在用Joomla!”在PHP中,您应该像这样构造查询:
/* (example php may not actually work)
Get the factory DB object */
$db = JFactory::getDbo();
// Get a new JDatabaseQuery object
$query = $db->getQuery(true);
// Build our query...
$query->select('id');
$query->from('#__mycomponents_table');
$query->where('id=99');
// Attach the query to the DB object
$db->setQuery($query);
// Run it and check the result...
if (!$db->loadResult()){...}
正如您所确定的,像安装/卸载SQL脚本这样的事情需要特定于数据库。这意味着对清单XML进行一个小的更新。。。这里有一个例子
<install>
<sql>
<file charset="utf8" driver="mysql">sql/install.mysql.sql</file>
<file charset="utf8" driver="postgresql">sql/install.postgresql.sql</file>
</sql>
</install>
sql/install.mysql.sql
sql/install.postgresql.sql
我建议查看com\u finder
代码,因为它确实有一个针对Postgres的安装/卸载SQL的特定示例