As we saw in many other cases like support for mssql or oracle it
would be fine to be able to override it for the db-type. In d6 you need to write a query backend to support it, also for d7 you only can support the other databases if you can alter views_date_sql_field.

So this patch

* moves views_date_sql_field to the query backend.
* keeps views_date_sql_field as a wrapper.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
8.1 KB

The same for views_date_sql_extract and views_date_sql_format

miro_dietiker’s picture

Looks straightforward to me and makes the backend more pluggable.

dawehner’s picture

FileSize
9.98 KB

Do the same for views_get_timezone

Perhaps this functions could be removed and the query backend could directly call $this->$function

merlinofchaos’s picture

Status: Needs review » Needs work

Recent commits cause this to not apply. Whoops.

That said, I'm in favor of this; please make sure we do some actual testing of it to make sure existing date stuff does not break?

dawehner’s picture

Status: Needs work » Needs review
FileSize
10.55 KB

Rerole

#needs more testing

miro_dietiker’s picture

looks (visually) fine to me. no application and coderun tested.

merlinofchaos’s picture

Assigned: Unassigned » dawehner
Status: Needs review » Needs work

What's the possibility of these functions being called without a view?

Well, in Views itself, the answer is 'never'. Obviously we can't know what people outside Views are doing. But we should probably have a fallback condition for that case.

Additionally, a quick grep shows that everywhere Views calls any of these functions, we have a view already. We should shortcut things and call directly to $view->query->$function so we don't have to go through the global wrapper function.

We can then mark the global wrapper function as @deprecated, and just remove it in D7 and require all contrib modules to use the new functions.

dawehner’s picture

What's the possibility of these functions being called without a view?

Well, in Views itself, the answer is 'never'. Obviously we can't know what people outside Views are doing. But we should probably have a fallback condition for that case.

We could call the method statically.

MustangGB’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)