perftools / xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database
1.65k stars 342 forks source link

About PDO JSON support #439

Open fengqi opened 2 years ago

fengqi commented 2 years ago

I want to provide special support based on the drive name, for example, add json_support switch in the PDO config

different db JSON syntax will be different, sql may also need to write multiple

known and commonly used mysql >=5.7, postgresql >=9.2, sql server >=2016

glensc commented 2 years ago

I added the driver name to PdoRepository:

for this merge request:

(...but that author disappeared)

anyway, now driver-specific code is now possible.

this must be enabled in config:

"enable_json" => true // (or something similar)

as even if your db server supports json, you may still may have old schema in place

glensc commented 2 years ago

also, depending on how invasive the changes are, maybe need another PdoRepository, like PdoJsonRepository...

glensc commented 2 years ago

Also, when you start working on it, try to make atomic commits:

makes much easier to rebase, do codereview and apply fixes

(should put this to CONTRIBUTING.md)

fengqi commented 2 years ago

also, depending on how invasive the changes are, maybe need another PdoRepository, like PdoJsonRepository...

Yes, our internal current implementation is for mysql, there is a file PdoMySQLRepository that overrite the buildWhere and initSchema method

fengqi commented 2 years ago

Also, when you start working on it, try to make atomic commits:

makes much easier to rebase, do codereview and apply fixes

(should put this to CONTRIBUTING.md)

ok

glensc commented 2 years ago

also, depending on how invasive the changes are, maybe need another PdoRepository, like PdoJsonRepository...

Yes, our internal current implementation is for mysql, there is a file PdoMySQLRepository that overrite the buildWhere and initSchema method

I prefer composition over inheritance, but anyway, perhaps you submit your code and then I can then refactor to composition and provide fallback to other drivers.

fengqi commented 2 years ago

also, depending on how invasive the changes are, maybe need another PdoRepository, like PdoJsonRepository...

Yes, our internal current implementation is for mysql, there is a file PdoMySQLRepository that overrite the buildWhere and initSchema method

I prefer composition over inheritance, but anyway, perhaps you submit your code and then I can then refactor to composition and provide fallback to other drivers.

you mean like trait

glensc commented 2 years ago

you mean like trait

no. but don't bother if you don't understand, I'll take the refactoring on me.

fengqi commented 2 years ago

you mean like trait

no. but don't bother if you don't understand, I'll take the refactoring on me.

ok

glensc commented 2 years ago

@fengqi seems you have not pushed your code yet

fengqi commented 2 years ago

@glensc sry, our focus is on migrating to the GoLang project recently, so i haven’t had time yet. maybe i can temporarily close this issue and open it again later.

glensc commented 2 years ago

@fengqi but i only asked you push your code to some pull request, and can continue from there.

fengqi commented 2 years ago

@fengqi but i only asked you push your code to some pull request, and can continue from there.

ok

glensc commented 2 years ago

@fengqi just push the changes and share the branch.