QuickBooks/Driver/Sql.php
protected function _recurEnqueue($user, $run_every, $action, $ident, $replace = true, $priority = 0, $extra = null, $qbxml = null)
	{
		$errnum = 0;
		$errmsg = '';

		// By default, it has *never* occured
		$recur_lasttime = (time() - $run_every - 60);

		if ($replace)
		{
			if ($existing = $this->_fetch($this->_query("
					SELECT
						recur_lasttime
					FROM
						" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_RECURTABLE) . "
					WHERE
						qb_username = '" . $this->_escape($user) . "' AND
						qb_action = '" . $this->_escape($action) . "' AND
						ident = '" . $this->_escape($ident) . "' ", $errnum, $errmsg)))
			{
				$this->_query("
					DELETE FROM
						" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_RECURTABLE) . "
					WHERE
						qb_username = '" . $this->_escape($user) . "' AND
						qb_action = '" . $this->_escape($action) . "' AND
						ident = '" . $this->_escape($ident) . "' ", $errnum, $errmsg);

				$recur_lasttime = $existing['recur_lasttime'];
			}
		}

		if ($extra)
		{
			$extra = serialize($extra);
		}

		return $this->_query("
			INSERT INTO
				" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_RECURTABLE) . "
			(
				qb_username,
				qb_action,
				ident,
				extra,
				qbxml,
				priority,
				run_every,
				recur_lasttime,
				enqueue_datetime
			) VALUES (
				'" . $this->_escape($user) . "',
				'" . $this->_escape($action) . "',
				'" . $this->_escape($ident) . "',
				'" . $this->_escape($extra) . "',
				'" . $this->_escape($qbxml) . "',
				" . (int) $priority . ",
				" . (int) $run_every . ",
				" . $recur_lasttime . ",
				'" . date('Y-m-d H:i:s') . "'
			) ", $errnum, $errmsg);
	}
protected function _recurEnqueue($user, $run_every, $action, $ident, $replace = true, $priority = 0, $extra = null, $qbxml = null)
	{
		$errnum = 0;
		$errmsg = '';

		// By default, it has *never* occured
		$recur_lasttime = (time() - $run_every - 60);

		if ($replace)
		{
			if ($existing = $this->_fetch($this->_query("
					SELECT
						recur_lasttime
					FROM
						" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_RECURTABLE) . "
					WHERE
						qb_username = '" . $this->_escape($user) . "' AND
						qb_action = '" . $this->_escape($action) . "' AND
						ident = '" . $this->_escape($ident) . "' ", $errnum, $errmsg)))
			{
				$this->_query("
					DELETE FROM
						" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_RECURTABLE) . "
					WHERE
						qb_username = '" . $this->_escape($user) . "' AND
						qb_action = '" . $this->_escape($action) . "' AND
						ident = '" . $this->_escape($ident) . "' ", $errnum, $errmsg);

				$recur_lasttime = $existing['recur_lasttime'];
			}
		}

		if ($extra)
		{
			$extra = serialize($extra);
		}

		return $this->_query("
			INSERT INTO
				" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_RECURTABLE) . "
			(
				qb_username,
				qb_action,
				ident,
				extra,
				qbxml,
				priority,
				run_every,
				recur_lasttime,
				enqueue_datetime
			) VALUES (
				'" . $this->_escape($user) . "',
				'" . $this->_escape($action) . "',
				'" . $this->_escape($ident) . "',
				'" . $this->_escape($extra) . "',
				'" . $this->_escape($qbxml) . "',
				" . (int) $priority . ",
				" . (int) $run_every . ",
				" . $recur_lasttime . ",
				'" . date('Y-m-d H:i:s') . "'
			) ", $errnum, $errmsg);
	}
Register a recurring event for a particular user

@param string $user
@param integer $run_every
@param string $action
@param mixed $ident
@param boolean $replace
@param integer $priority
@param mixed $extra
@return boolean