Prepares all statements to be used.

@throws DatabaseException thrown if there is an error preparing the
statements
974644
private void prepareStatements() throws DatabaseException {
        for (PreparedStatementCveDb key : values()) {
            PreparedStatement preparedStatement = null;
            try {
                final String statementString = statementBundle.getString(key.name());
                if (key == INSERT_VULNERABILITY || key == INSERT_CPE) {
                    preparedStatement = connection.prepareStatement(statementString, new String[]{"id"});
                } else {
                    preparedStatement = connection.prepareStatement(statementString);
                }
            } catch (SQLException ex) {
                throw new DatabaseException(ex);
            } catch (MissingResourceException ex) {
                if (!ex.getMessage().contains("key MERGE_PROPERTY")) {
                    throw new DatabaseException(ex);
                }
            }
            if (preparedStatement != null) {
                preparedStatements.put(key, preparedStatement);
            }
        }
    }
1274749
public function execute()
    {
        
        if (null === $this->statement) {
            throw new Exception('The database statement resource is not currently set.');
        }
        if ($this->statement->execute()) {
            
            if (($metaData = $this->statement->result_metadata()) !== false) {
                foreach ($metaData->fetch_fields() as $col) {
                    ${$col->name}   = null;
                    $results[]      = &${$col->name};
                    $cols[]         = $col->name;
                }
                
                call_user_func_array([$this->statement, 'bind_result'], $results);
                
                $this->stmt_results = $results;
                $this->stmt_cols = $cols;
            }
            return true;
        }
        return false;
    }
472398
public function init()
    {

        // initialize the prepared statements
        $this->productDatetimesStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::PRODUCT_DATETIMES));
    }
234856
public static void setArguments(PreparedStatement statement,
			Object[] selectionArgs) throws SQLException {
		if (selectionArgs != null) {
			for (int i = 0; i < selectionArgs.length; i++) {
				statement.setObject(i + 1, selectionArgs[i]);
			}
		}
	}
21944
public static PreparedStatement prepareStatement(Connection conn, SqlBuilder sqlBuilder) throws SQLException {
		return prepareStatement(conn, sqlBuilder.build(), sqlBuilder.getParamValueArray());
	}
1339964
public static PreparedStatement prepareStatement(Connection conn, String sql, Collection<Object> params) throws SQLException {
		return prepareStatement(conn, sql, params.toArray(new Object[params.size()]));
	}
517368
protected function _prepare($sql)
    {
        $connection = $this->_adapter->getConnection();

        $this->_stmt = sqlsrv_prepare($connection, $sql);

        if (!$this->_stmt) {
            // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
            throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
        }

        $this->_originalSQL = $sql;
    }
335114
protected function _executeStatement($statement, $sql, $params) {
        if ((!$statement->execute($params))) {
            throw new DbException($this->_pdoObject->errorInfo(), $sql, $params, $this->_errorReporting);
        }

        if ($statement->errorCode() == '00000') {
            return;
        }
        throw new DbException($statement->errorInfo(), $sql, $params, $this->_errorReporting);
    }
1194707
public PreparedStatement prepareStatement(final String sql) throws SQLException {
    return internalPrepareStatement(sql,
        ResultSet.TYPE_FORWARD_ONLY,
        ResultSet.CONCUR_READ_ONLY,
        Statement.NO_GENERATED_KEYS);
  }
931568
public function execute()
	{
		$this->connect();

		if (!is_object($this->connection))
		{
			$this->log(
				Log\LogLevel::ERROR,
				'Database query failed (error #{code}): {message}',
				array('code' => $this->errorNum, 'message' => $this->errorMsg)
			);
			throw new \RuntimeException($this->errorMsg, $this->errorNum);
		}

		// Take a local copy so that we don't modify the original query and cause issues later
		$sql = $this->replacePrefix((string) $this->sql);

		if ($this->limit > 0 || $this->offset > 0)
		{
			// @TODO
			$sql .= ' LIMIT ' . $this->offset . ', ' . $this->limit;
		}

		// Increment the query counter.
		$this->count++;

		// If debugging is enabled then let's log the query.
		if ($this->debug)
		{
			// Add the query to the object queue.
			$this->log(
				Log\LogLevel::DEBUG,
				'{sql}',
				array('sql' => $sql, 'category' => 'databasequery', 'trace' => debug_backtrace())
			);
		}

		// Reset the error values.
		$this->errorNum = 0;
		$this->errorMsg = '';

		// Execute the query.
		$this->executed = false;

		if ($this->prepared instanceof \PDOStatement)
		{
			// Bind the variables:
			if ($this->sql instanceof PreparableInterface)
			{
				$bounded =& $this->sql->getBounded();

				foreach ($bounded as $key => $obj)
				{
					$this->prepared->bindParam($key, $obj->value, $obj->dataType, $obj->length, $obj->driverOptions);
				}
			}

			$this->executed = $this->prepared->execute();
		}

		// If an error occurred handle it.
		if (!$this->executed)
		{
			// Get the error number and message before we execute any more queries.
			$errorNum = (int) $this->connection->errorCode();
			$errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());

			// Check if the server was disconnected.
			if (!$this->connected())
			{
				try
				{
					// Attempt to reconnect.
					$this->connection = null;
					$this->connect();
				}
				catch (\RuntimeException $e)
				// If connect fails, ignore that exception and throw the normal exception.
				{
					// Get the error number and message.
					$this->errorNum = (int) $this->connection->errorCode();
					$this->errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());

					// Throw the normal query exception.
					$this->log(
						Log\LogLevel::ERROR,
						'Database query failed (error #{code}): {message}',
						array('code' => $this->errorNum, 'message' => $this->errorMsg)
					);
					throw new \RuntimeException($this->errorMsg, $this->errorNum);
				}

				// Since we were able to reconnect, run the query again.
				return $this->execute();
			}
			else
			// The server was not disconnected.
			{
				// Get the error number and message from before we tried to reconnect.
				$this->errorNum = $errorNum;
				$this->errorMsg = $errorMsg;

				// Throw the normal query exception.
				$this->log(
					Log\LogLevel::ERROR,
					'Database query failed (error #{code}): {message}',
					array('code' => $this->errorNum, 'message' => $this->errorMsg)
				);
				throw new \RuntimeException($this->errorMsg, $this->errorNum);
			}
		}

		return $this->prepared;
	}
192397
public function init()
    {

        // initialize the prepared statements
        $this->productMediaGalleryStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::PRODUCT_MEDIA_GALLERY));
        $this->productMediaGalleriesBySkuStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::PRODUCT_MEDIA_GALLERIES_BY_SKU));
    }
549585
public function init()
    {

        // initialize the prepared statements
        $this->productSuperLinkStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::PRODUCT_SUPER_LINK));
    }
658196
public function init()
    {

        // initialize the prepared statements
        $this->productSuperAttributeStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::PRODUCT_SUPER_ATTRIBUTE));
    }
1305621
function _prepareStatement()
    {
        $this->_statement = $this->_db->prepare($this->_sql);

        /* Return success if we didn't generate an error. */
        return (DB::isError($this->_statement) === false);
    }
589728
protected function _prepare($sql)
    {
        $connection = $this->_adapter->getConnection();
        $this->_stmt = @oci_parse($connection, $sql);
        if (!$this->_stmt) {
            /**
             * @see Zend_Db_Statement_Oracle_Exception
             */
            // require_once 'Zend/Db/Statement/Oracle/Exception.php';
            throw new Zend_Db_Statement_Oracle_Exception(oci_error($connection));
        }
    }
728486
protected function prepareIgnoreTables()
    {
        if (isset($this->params['ignore_tables'])) {
            foreach ($this->params['ignore_tables'] as $ignoreTable) {
                if ($this->params['all_databases']) {
                    if (false === strpos($ignoreTable, '.')) {
                        throw new \LogicException(
                            'When dumping all databases both database and table must be specified when ignoring table'
                        );
                    }
                    $this->ignoreTables .= sprintf('--ignore-table=%s ', $ignoreTable);
                } else {
                    $this->ignoreTables .= sprintf('--ignore-table=%s.%s ', $this->params['database'], $ignoreTable);
                }
            }
        }
    }
290620
@Override
    public void prepare(final AbstractSQLInsertUpdate<?> _insertUpdate,
                        final Attribute _attribute,
                        final Object... _values)
        throws SQLException
    {
        checkSQLColumnSize(_attribute, 2);
        final Rate value = eval(_values);
        _insertUpdate.column(_attribute.getSqlColNames().get(0), value.getNumerator());
        _insertUpdate.column(_attribute.getSqlColNames().get(1), value.getDenominator());
    }