mevdschee / php-crud-api

Single file PHP script that adds a REST API to a SQL database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use UUID as primary key and return it

chattago2002 opened this issue · comments

Hi everyone.

I'm trying to use UUIDv4 as "id" field (primary key). I set it as CHAR(36) and tha value is created via MySQL trigger "before insert". The value is set in the right way but it's not returned.

I read other issues here about this case but solutions seems not to work.

P.S. I would prefer to create UUIDv4 server-side and not client-side as written in some of the above mentioned issues.

I read other issues

Why are you opening a new one then?

The value is set in the right way but it's not returned.

Only auto increment values are returned.

I would prefer to create UUIDv4 server-side

Why? There is no technical reason to do so. UUID values can be generated decentralized, that's one of their advantages.

See also #932 and #586 and especially:

#586 (comment)