本文整理汇总了PHP中NewDataDictionary函数的典型用法代码示例。如果您正苦于以下问题:PHP NewDataDictionary函数的具体用法?PHP NewDataDictionary怎么用?PHP NewDataDictionary使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewDataDictionary函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
/**
* Destroy the database table for this lookup table.
*/
public static function uninstall()
{
$db = \cge_utils::get_db();
$dict = NewDataDictionary($db);
$sqlarray = $dict->DropTableSQL(static::table_name());
$dict->ExecuteSQLArray($sqlarray, FALSE);
}
示例2: make_db
/**
* This function creates the DB on new installs
*/
function make_db($dbhost, $dbuname, $dbpass, $dbname, $prefix_table, $dbtype, $dbmake)
{
global $db;
echo '<font class="oos-title">' . INPUT_DATA . '</font>';
echo '<table align="center"><tr><td align="left">';
if ($dbmake) {
$db =& NewADOConnection($dbtype);
$dbh = $db->Connect($dbhost, $dbuname, $dbpass);
if (!$dbh) {
$dbpass = "";
die("{$dbtype}://{$dbuname}:{$dbpass}@{$dbhost} failed to connect" . $db->ErrorMsg());
}
$dict = NewDataDictionary($db);
if (!$dict) {
continue;
}
$dict->debug = 1;
// ToDo CREATE DATABASE $dbname DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
$sqlarray = $dict->CreateDatabase($dbname);
$dict->ExecuteSQLArray($sqlarray);
}
oosDBInit($dbhost, $dbuname, $dbpass, $dbname, $dbtype);
if (!$prefix_table == '') {
$prefix_table = $prefix_table . '_';
}
include 'newtables.php';
echo '</td></tr></table>';
}
示例3: prepareSubject
/**
* Prepare a DatabaseConnection subject.
* Used by driver specific test cases.
*
* @param string $driver Driver to use like "mssql", "oci8" and "postgres7"
* @param array $configuration Dbal configuration array
* @return \TYPO3\CMS\Dbal\Database\DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
*/
protected function prepareSubject($driver, array $configuration)
{
/** @var \TYPO3\CMS\Dbal\Database\DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
$subject = $this->getAccessibleMock(\TYPO3\CMS\Dbal\Database\DatabaseConnection::class, array('getFieldInfoCache'), array(), '', false);
$subject->conf = $configuration;
// Disable caching
$mockCacheFrontend = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(), '', false);
$subject->expects($this->any())->method('getFieldInfoCache')->will($this->returnValue($mockCacheFrontend));
// Inject SqlParser - Its logic is tested with the tests, too.
$sqlParser = $this->getAccessibleMock(\TYPO3\CMS\Dbal\Database\SqlParser::class, array('dummy'), array(), '', false);
$sqlParser->_set('databaseConnection', $subject);
$sqlParser->_set('sqlCompiler', GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\SqlCompilers\Adodb::class, $subject));
$sqlParser->_set('nativeSqlCompiler', GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\SqlCompilers\Mysql::class, $subject));
$subject->SQLparser = $sqlParser;
// Mock away schema migration service from install tool
$installerSqlMock = $this->getMock(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class, array('getFieldDefinitions_fileContent'), array(), '', false);
$installerSqlMock->expects($this->any())->method('getFieldDefinitions_fileContent')->will($this->returnValue(array()));
$subject->_set('installerSql', $installerSqlMock);
$subject->initialize();
// Fake a working connection
$handlerKey = '_DEFAULT';
$subject->lastHandlerKey = $handlerKey;
$adodbDriverClass = '\\ADODB_' . $driver;
$subject->handlerInstance[$handlerKey] = new $adodbDriverClass();
$subject->handlerInstance[$handlerKey]->DataDictionary = NewDataDictionary($subject->handlerInstance[$handlerKey]);
$subject->handlerInstance[$handlerKey]->_connectionID = rand(1, 1000);
return $subject;
}
示例4: idxsql
function idxsql($idxname, $table, $idxflds)
{
global $db;
$dict = NewDataDictionary($db);
$sqlarray = $dict->CreateIndexSQL($idxname, $table, $idxflds);
$dict->ExecuteSQLArray($sqlarray);
}
示例5: upgrade_create_sequence_table
function upgrade_create_sequence_table($db, $tablename, $idcol)
{
$num = $db->GetOne("SELECT MAX({$idcol}) FROM {$tablename}");
$db->DropSequence($tablename . "_seq");
$db->CreateSequence($tablename . "_seq", $num + 1);
$dict = NewDataDictionary($db);
$sqlarray = $dict->AlterColumnSQL($tablename, "{$idcol} I");
$dict->ExecuteSQLArray($sqlarray);
}
示例6: idxsql
function idxsql($idxname, $table, $idxflds)
{
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$dict = NewDataDictionary($dbconn);
$sqlarray = $dict->CreateIndexSQL($idxname, $table, $idxflds);
$dict->ExecuteSQLArray($sqlarray);
}
示例7: createTable
function createTable($ctx)
{
$create = 'CREATE TABLE IF NOT EXISTS `' . $ctx . '` (' . '`key` VARCHAR( 60 ) NOT NULL ,' . '`willExpireAt` int NOT NULL DEFAULT 0 ,' . '`lastModified` int NOT NULL DEFAULT 0, ' . '`content` TEXT NULL ,PRIMARY KEY ( `key` ));';
if (strlen($this->stm['before_create']) > 0) {
$this->db->Execute($this->stm['before_create'], array()) or die;
}
$dict = NewDataDictionary($this->db);
$x = $dict->ExecuteSQLArray(array($create)) or die;
return $x;
}
示例8: AkInstaller
function AkInstaller($db_connection = null)
{
if (empty($db_connection)) {
$this->db =& Ak::db();
} else {
$this->db =& $db_connection;
}
$this->available_tables = $this->getAvailableTables();
$this->db->debug =& $this->debug;
$this->data_dictionary = NewDataDictionary($this->db);
}
示例9: connect
/**
* Creates a fake database connection.
*
* @param ux_t3lib_db $db
* @param string $databaseType Type of the database (e.g., 'oracle')
* @param string $driver Driver to use (e.g., 'oci8')
* @return ADOConnection
*/
public static function connect(ux_t3lib_db $db, $driver)
{
// Make sure to have a clean configuration
$db->clearCachedFieldInfo();
$db->_call('initInternalVariables');
include_once t3lib_extMgm::extPath('adodb') . 'adodb/drivers/adodb-' . $driver . '.inc.php';
$handlerKey = '_DEFAULT';
$db->lastHandlerKey = $handlerKey;
$db->handlerInstance[$handlerKey] = t3lib_div::makeInstance('ADODB_' . $driver);
// From method handler_init()
$db->handlerInstance[$handlerKey]->DataDictionary = NewDataDictionary($db->handlerInstance[$handlerKey]);
// DataDictionary being set, a connectionID may be arbitrarily chosen
$db->handlerInstance[$handlerKey]->_connectionID = rand(1, 1000);
}
示例10: createDatabase
function createDatabase($mode)
{
$success = true;
$db = $this->databaseConnection('admin');
if ($db) {
if ($this->getDatabaseType($mode) != 'sqlite') {
$DataDict = NewDataDictionary($db);
if ($this->getDatabaseType($mode) == 'mysql') {
$success = $this->_createMysqlDatabase($db, $mode) ? $success : false;
}
}
return $success;
}
return false;
}
示例11: _checkTables
/**
* @private
*/
function _checkTables()
{
// create the table to keep track of the voters, so that people cannot vote
// more than once
$fields = "\r\n\t\t\t id I(10) NOTNULL PRIMARY AUTOINCREMENT,\r\n\t\t\t recipients TEXT NOTNULL DEFAULT '',\n\t\t\t recipients_cc TEXT NOTNULL DEFAULT '',\n\t\t\t recipients_bcc TEXT NOTNULL DEFAULT '',\r\n\t\t\t subject C(255) NOTNULL DEFAULT '',\r\n\t\t\t body XL NOTNULL DEFAULT '',\r\n\t\t\t\t date T(14) DEFDATE\r\n\t\t\t\t ";
$db =& Db::getDb();
$dbPrefix = Db::getPrefix();
$tableName = $dbPrefix . "mailcentre_sent";
// create the data dictionary and create the table if necessary
$dict = NewDataDictionary($db);
$sqlArray = $dict->ChangeTableSQL($tableName, $fields);
$result = $dict->ExecuteSQLArray($sqlArray);
if (!$result) {
die("There was an error creating the plugin tables!");
}
return true;
}
示例12: createTable
function createTable($table_name, $table_fields, $table_options, $add_sequence_table = true, $table_index_fields = null)
{
if (!isset($this->_db)) {
$db =& Ak::db();
} else {
$db =& $this->_db;
}
$dict = NewDataDictionary($db);
$sqlarray = $dict->CreateTableSQL($table_name, $table_fields, $table_options);
$dict->ExecuteSQLArray($sqlarray);
if (isset($table_index_fields)) {
$sqlarray = $dict->CreateIndexSQL('idx_' . $table_name, $table_name, $table_index_fields);
$dict->ExecuteSQLArray($sqlarray);
}
if ($add_sequence_table) {
$db->CreateSequence('seq_' . $table_name);
}
}
示例13: connect
/**
* Connects to the database using options in the given configuration array.
*
* @param array $config Configuration array for connecting
*/
function connect()
{
$config = $this->config;
$persistent = strrpos($config['connect'], '|p');
if ($persistent === false) {
$adodb_driver = $config['connect'];
$connect = 'Connect';
} else {
$adodb_driver = substr($config['connect'], 0, $persistent);
$connect = 'PConnect';
}
$this->_adodb = NewADOConnection($adodb_driver);
$this->_adodbDataDict = NewDataDictionary($this->_adodb, $adodb_driver);
$this->startQuote = $this->_adodb->nameQuote;
$this->endQuote = $this->_adodb->nameQuote;
$this->connected = $this->_adodb->{$connect}($config['host'], $config['login'], $config['password'], $config['database']);
$this->_adodbMetatyper =& $this->_adodb->execute('Select 1');
return $this->connected;
}
示例14: _verifyTable
function _verifyTable()
{
$fields = "\n id I(11) NOTNULL PRIMARY AUTOINCREMENT,\n blogId I(11) NOTNULL KEY,\n active C(1) NOTNULL KEY,\n subject TEXT NOTNULL,\n responses TEXT NOTNULL,\n responsedata TEXT NOTNULL,\n dateadded I(11) NOTNULL";
$fields2 = "\n id I(11) NOTNULL KEY,\n ip I8 NOTNULL KEY,\n date I(11) NOTNULL KEY";
$db =& Db::getDb();
$dbPrefix = Db::getPrefix();
$tableName = $dbPrefix . "plogpoll_polls";
$tableName2 = $dbPrefix . "plogpoll_voterips";
$dict = NewDataDictionary($db);
$sqlAry = $dict->ChangeTableSQL($tableName, $fields);
$result = $dict->ExecuteSQLArray($sqlAry);
if (!$result) {
die("There was an error creating/updating plogpoll plugin tables!");
}
$sqlAry = $dict->ChangeTableSQL($tableName2, $fields2);
$result = $dict->ExecuteSQLArray($sqlAry);
if (!$result) {
die("There was an error creating/updating plogpoll plugin tables!");
}
}
示例15: perform
function perform()
{
if (empty($this->loop)) {
$this->loop = 1;
}
if ($this->prepareParameters() === FALSE) {
$this->result = INSTALLER_ACTION_FAIL;
return $this->result;
}
if (!is_readable($this->schema_file)) {
$this->result = INSTALLER_ACTION_FAIL;
$this->result_message = "Could not read file sql {$this->schema_file}.";
$this->loop = 2;
return $this->result;
}
# Connect to the DB
$db = $this->connect();
if ($db === FALSE) {
return $this->result;
}
# Create empty ADOdb connection
$conn = ADONewConnection($this->type);
# Create new ADO Schema object
$schema = new adoSchema($conn);
# Build the SQL query from the Schema file
$sql = $schema->ParseSchema($this->schema_file);
# Execute the SQL query
# "2" is status returned by ExecuteSQLArray()
$dict = NewDataDictionary($db);
@($ok = 2 == $dict->ExecuteSQLArray($sql, FALSE));
if ($ok) {
$this->result = INSTALLER_ACTION_SUCCESS;
$this->result_message = "DB schema loaded successfully";
$this->loop = 3;
} else {
$this->result = INSTALLER_ACTION_FAIL;
$this->result_message = "Errors on execution of the schema SQL: " . $db->ErrorMsg();
$this->loop = 2;
}
return $this->result;
}