Skip to content

Cross-Database GUID function #1616

Closed
wants to merge 2 commits into from

4 participants

@okonomiyaki3000

generates 8-4-4-4-12 hexadecimal unique id

@LouisLandry

Do you have a solve for SQLite ?

@okonomiyaki3000

SQLLite doesn't have a function like this. It should be possible to duplicate the functionality with something like hex(randomblob(32)) or some such thing but I don't exactly know the best approach at the moment as I have no SQLLite experience at all.

I did notice that the SQLLite Query class seems incomplete as it is. The base query class has functions like year, month, etc. but, based on my quick check of SQLLite available functions, these do not seem to exist and the SQLLite query class doesn't provide alternatives.

@pasamio pasamio commented on an outdated diff Oct 19, 2012
libraries/joomla/database/query/sqlazure.php
@@ -29,4 +29,19 @@ class JDatabaseQuerySqlazure extends JDatabaseQuerySqlsrv
* @since 11.1
*/
protected $name_quotes = '';
+
+ /**
+ * Generates a Globally Unique Identifier (32 hexadecimal digits separated by hyphens as 8-4-4-4-12).
+ *
+ * Usage:
+ * $query->set('guid = '.$query->GUID());
@pasamio
pasamio added a note Oct 19, 2012

You should put spaces between this like we would normally have in properly formatted code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@okonomiyaki3000

Fixed the formatting and rebased as a single commit.

@okonomiyaki3000

Ah, there are a couple of test classes that extend JDatabaseQuery so, if it has an abstract method, they will need to implement it. This is all well and good but doesn't actually make much sense. Are we going to need test classes for each subclass of JDatabaseQuery? They each have to implement that function in a different way so...

@eddieajau

Closing because this PR cannot be merged.

@eddieajau eddieajau closed this Mar 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.