Ticket #278 (new enhancement)

Opened 4 years ago

Last modified 10 months ago

Abstract vendor-specific implementations such as Concat

Reported by: VexedPanda Owned by: somebody
Priority: important Milestone: 2.2
Component: QQuery Version: 1.0.0 Stable
Keywords: database, concat, abstraction Cc:

Description

There are a number of SQL functions that do not have standard-based usage patters among the large server vendors. We should still allow the use of these within QQ.

An example is concat, where each DB supports it, but each has different syntax to accomplish it.

Change History

Changed 4 years ago by alex94040

  • milestone changed from 1.1 to 2.0

To get this started, we should create a list of these functions. I also don't think that this should be a part of the 1.1 release - let's push it out.

Changed 4 years ago by VexedPanda

Case sensitive like statements are also different between vendors (ie: oracle)

Changed 3 years ago by alex94040

  • milestone changed from 2.0 to Far Far Away

Changed 3 years ago by VexedPanda

  • milestone changed from Far Far Away to 2.1.0

Changed 10 months ago by olegabr

I'm solving this problem for myself in this way:

	//QQuery.class.php:

	// Used to wrap databse specific strings like "now()::time + interval '60 seconds'" for PostgreSQL
	// to prevent hiding of ' with slashes
	class QDbSpecific {
		protected $strDbSpecificValue;
		public function __construct($strDbSpecificValue) {
			$this->strDbSpecificValue = $strDbSpecificValue;
		}
		public function __toString() {
			return $this->strDbSpecificValue;
		}
	}
	class QQ {
		/////////////////////////
		// QQCondition Factories
		/////////////////////////

		static public function DbSpecific() {
			return new QDbSpecific(implode(func_get_args()));
		}

		// ... //
	}

Usage:

	$condTime = QQ::LessOrEqual(QQN::Request()->TimeBegin,
		QQ::DbSpecific("(now()::time + interval '" . $intSeconds . " seconds')"));

It allows to use any DB-specific constructs in the "value" part of QQ-conditions.

Note: See TracTickets for help on using tickets.