Skip to content

Commit e890a65

Browse files
authored
Merge pull request #83 from bubach/patch-1
Updated SQLite UUID generator
2 parents 58475b0 + 1ee7b2c commit e890a65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/Universal/Query/UUIDQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function toSql(BaseDriver $driver, ArgumentArray $args)
3131
return 'SELECT UUID_GENERATE_V4();';
3232
}
3333
if ($driver instanceof SQLiteDriver) {
34-
return 'SELECT hex(randomblob(16));';
34+
return 'SELECT SUBSTR(u, 1, 8)||'-'||SUBSTR(u, 9, 4)||'-4'||SUBSTR(u, 13, 3)|| '-'||v||SUBSTR(u, 17, 3)||'-'||SUBSTR(u, 21, 12) as uuid from (select LOWER(HEX(RANDOMBLOB(16))) as u, SUBSTR('89ab', ABS(RANDOM()) % 4 + 1, 1) as v);';
3535
}
3636
throw new UnsupportedDriverException($driver, $this);
3737
}

0 commit comments

Comments
 (0)
close