public function prepareStatements()
    {
        $addUpdateQuery = '';
        $addInsertQueryFields = '';
        $addInsertQueryValues = '';

        // create vars to keep statements dynamic
        foreach ($this->additionalFields as $value) {
            $addUpdateQuery .= ', ' . $value . ' = ?';
            $addInsertQueryFields .= ', ' . $value;
            $addInsertQueryValues .= ', ?';
        }

        // Statement to check if record already exists in db
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE searchStmt FROM "
			SELECT *
			FROM tx_kesearch_index
			WHERE orig_uid = ?
			AND pid = ?
			AND type = ?
			AND language = ?
			LIMIT 1
		"');

        // Statement to update an existing record in indexer table
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE updateStmt FROM "
			UPDATE tx_kesearch_index
			SET pid=?,
			title=?,
			type=?,
			targetpid=?,
			content=?,
			tags=?,
			params=?,
			abstract=?,
			language=?,
			starttime=?,
			endtime=?,
			fe_group=?,
			tstamp=?' . $addUpdateQuery . '
			WHERE uid=?
		"');

        // Statement to insert a new records to index table
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE insertStmt FROM "
			INSERT INTO tx_kesearch_index
			(pid, title, type, targetpid, content, tags, params, abstract, language,'
            . ' starttime, endtime, fe_group, tstamp, crdate' . $addInsertQueryFields . ')
			VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?' . $addInsertQueryValues . ', ?)
		"');

        // disable keys only if indexer table was truncated (has 0 records)
        // this speeds up the first indexing process
        // don't use this for updating index table
        // if you activate this for updating 40.000 existing records, indexing process needs 1 hour longer
        $queryBuilder = Db::getQueryBuilder('tx_kesearch_index');
        $countIndex = $queryBuilder
            ->count('*')
            ->from('tx_kesearch_index')
            ->execute()
            ->fetchColumn(0);
        if ($countIndex == 0) {
            Db::getDatabaseConnection('tx_kesearch_index')->exec('ALTER TABLE tx_kesearch_index DISABLE KEYS');
        }
    }
public function prepareStatements()
    {
        $addUpdateQuery = '';
        $addInsertQueryFields = '';
        $addInsertQueryValues = '';

        // create vars to keep statements dynamic
        foreach ($this->additionalFields as $value) {
            $addUpdateQuery .= ', ' . $value . ' = ?';
            $addInsertQueryFields .= ', ' . $value;
            $addInsertQueryValues .= ', ?';
        }

        // Statement to check if record already exists in db
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE searchStmt FROM "
			SELECT *
			FROM tx_kesearch_index
			WHERE orig_uid = ?
			AND pid = ?
			AND type = ?
			AND language = ?
			LIMIT 1
		"');

        // Statement to update an existing record in indexer table
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE updateStmt FROM "
			UPDATE tx_kesearch_index
			SET pid=?,
			title=?,
			type=?,
			targetpid=?,
			content=?,
			tags=?,
			params=?,
			abstract=?,
			language=?,
			starttime=?,
			endtime=?,
			fe_group=?,
			tstamp=?' . $addUpdateQuery . '
			WHERE uid=?
		"');

        // Statement to insert a new records to index table
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE insertStmt FROM "
			INSERT INTO tx_kesearch_index
			(pid, title, type, targetpid, content, tags, params, abstract, language,'
            . ' starttime, endtime, fe_group, tstamp, crdate' . $addInsertQueryFields . ')
			VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?' . $addInsertQueryValues . ', ?)
		"');

        // disable keys only if indexer table was truncated (has 0 records)
        // this speeds up the first indexing process
        // don't use this for updating index table
        // if you activate this for updating 40.000 existing records, indexing process needs 1 hour longer
        $queryBuilder = Db::getQueryBuilder('tx_kesearch_index');
        $countIndex = $queryBuilder
            ->count('*')
            ->from('tx_kesearch_index')
            ->execute()
            ->fetchColumn(0);
        if ($countIndex == 0) {
            Db::getDatabaseConnection('tx_kesearch_index')->exec('ALTER TABLE tx_kesearch_index DISABLE KEYS');
        }
    }
public function prepareStatements ( ) { $ addUpdateQuery = '' ; $ addInsertQueryFields = '' ; $ addInsertQueryValues = '' ; // create vars to keep statements dynamic foreach ( $ this -> additionalFields as $ value ) { $ addUpdateQuery .= ', ' . $ value . ' = ?' ; $ addInsertQueryFields .= ', ' . $ value ; $ addInsertQueryValues .= ', ?' ; } // Statement to check if record already exists in db $ databaseConnection = Db :: getDatabaseConnection ( 'tx_kesearch_index' ) ; $ databaseConnection -> exec ( 'PREPARE searchStmt FROM "
			SELECT *
			FROM tx_kesearch_index
			WHERE orig_uid = ?
			AND pid = ?
			AND type = ?
			AND language = ?
			LIMIT 1
		"' ) ; // Statement to update an existing record in indexer table $ databaseConnection = Db :: getDatabaseConnection ( 'tx_kesearch_index' ) ; $ databaseConnection -> exec ( 'PREPARE updateStmt FROM "
			UPDATE tx_kesearch_index
			SET pid=?,
			title=?,
			type=?,
			targetpid=?,
			content=?,
			tags=?,
			params=?,
			abstract=?,
			language=?,
			starttime=?,
			endtime=?,
			fe_group=?,
			tstamp=?' . $ addUpdateQuery . '
			WHERE uid=?
		"' ) ; // Statement to insert a new records to index table $ databaseConnection = Db :: getDatabaseConnection ( 'tx_kesearch_index' ) ; $ databaseConnection -> exec ( 'PREPARE insertStmt FROM "
			INSERT INTO tx_kesearch_index
			(pid, title, type, targetpid, content, tags, params, abstract, language,' . ' starttime, endtime, fe_group, tstamp, crdate' . $ addInsertQueryFields . ')
			VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?' . $ addInsertQueryValues . ', ?)
		"' ) ; // disable keys only if indexer table was truncated (has 0 records) // this speeds up the first indexing process // don't use this for updating index table // if you activate this for updating 40.000 existing records, indexing process needs 1 hour longer $ queryBuilder = Db :: getQueryBuilder ( 'tx_kesearch_index' ) ; $ countIndex = $ queryBuilder -> count ( '*' ) -> from ( 'tx_kesearch_index' ) -> execute ( ) -> fetchColumn ( 0 ) ; if ( $ countIndex == 0 ) { Db :: getDatabaseConnection ( 'tx_kesearch_index' ) -> exec ( 'ALTER TABLE tx_kesearch_index DISABLE KEYS' ) ; } }
prepare sql-statements for indexer
@return void
prepare sql - statements for indexer