Hooking up data loading
[Plugin] Awards »

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
The way it's meant to be

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Hooking up data loading
« Reply #31, on September 26th, 2011, 09:15 AM »
Oh hahaha, yes, now I remember. I think I wrote that! :lol:
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Hooking up data loading
« Reply #33, on September 26th, 2011, 09:36 AM »
I like it provided that it only executes a single query otherwise there's no benefit to using a UNION.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Hooking up data loading
« Reply #34, on September 26th, 2011, 09:37 AM »
Quote from Arantor on September 26th, 2011, 09:36 AM
I like it provided that it only executes a single query otherwise there's no benefit to using a UNION.
Yes ofcourse, it just combines those 2 queries into one and runs it.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Hooking up data loading
« Reply #36, on September 26th, 2011, 10:21 AM »
As live asked, how would someone add multiple inner joins, or left joins or complex wheres with and/or combinations? (e.g where a=1 and (b=2 or c=3))

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Hooking up data loading
« Reply #38, on September 26th, 2011, 10:42 AM »
That's what I suspected. Can I suggest, then, that (at the very least), WHERE, and the JOINS should always be supplied as arrays to avoid add-ons having to test and coerce values to array just so they can add them in?

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Hooking up data loading
« Reply #39, on September 26th, 2011, 10:44 AM »
Even if a string is supplied, internally it's converted into an array. An Add-on wouldn't need to test anything in order to add into the existing values.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Hooking up data loading
« Reply #42, on September 26th, 2011, 11:18 AM »
I don't think the syntax needs to change at all (to be honest I'm not sure what else you could do with it anyway) and as for ease of use, I can't see any comparable way of making big queries extensible - it's harder to use than a bare query, until you're used to it, but it's extensible in a way that bare queries aren't.

And since I don't envisage most add-ons having to write them I doubt it'll be a problem, provided there is sufficient documentation and examples of using said setup to extend queries.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Hooking up data loading
« Reply #43, on September 26th, 2011, 11:28 AM »
Quote from Arantor on September 26th, 2011, 11:18 AM
I don't think the syntax needs to change at all (to be honest I'm not sure what else you could do with it anyway) and as for ease of use, I can't see any comparable way of making big queries extensible - it's harder to use than a bare query, until you're used to it, but it's extensible in a way that bare queries aren't.
Thanks, I've been trying to keep the syntax as simple as possible.
Quote from Arantor on September 26th, 2011, 11:18 AM
And since I don't envisage most add-ons having to write them I doubt it'll be a problem, provided there is sufficient documentation and examples of using said setup to extend queries.
I believe only some major add-ons would like to use those queries in some major part, but even then that'd be rare. Using the hooks to extend existing queries would be a lot more common, especially around loadMemberData, Display and a few other areas. Still, providing documentation won't be hard for this. I've tried to keep the structure logical and easy to understand. Plus it offers the ability to declare custom data types(Something which should be backported to traditional queries honestly).

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Hooking up data loading
« Reply #44, on September 26th, 2011, 11:46 AM »
I can, for example, see my adding a couple of hook able queries into WedgeDesk for my own use later.

But as far as 'custom datatypes', what do you have in mind? Data types that have their own rules and/or validation but that ultimately fit into standard MySQL typing? (e.g. WHERE column = {email:address} and inject address in?)

[Plugin] Awards »