Open DrtyByt opened 3 years ago
you can use triple backticks to format
and this suggestion is very good, i back it up
What happens if we need a custom column in that table for some reason, we have to redo the procedure?
Also, are there any benefits from this? e.g better performance..etc, or just cosmetic?
Lets changes to the DB and App be insulated from each other. Performance tuning is one aspect as you can make changes to the DB for performance without requiring changes to the App. If you need a custom column on its own then no changes needed for the procedure, if you wanted to return the new column then yes. This does mean that you can do things like remove unused columns from the DB and just stub them in the procedure for columns that always return the same value or Null, this cleans up the DB. You can also rename the tables/columns in the DB itself to whatever you want to make them more descriptive without affecting how the App needs the data/names returned.
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Tue, Dec 8, 2020 at 12:27 PM FALL1N1 notifications@github.com wrote:
What happens if we need a custom column in that table for some reason, we have to redo the procedure?
Also, are there any benefits from this? e.g better performance..etc, or just cosmetic?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/azerothcore/azerothcore-wotlk/issues/3682#issuecomment-740980526, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPUFJZ2FT4U4GJBVRUIBDST2D45ANCNFSM4TSNJVNQ .
Not really, the table's columns are returned as an array to the core and the keys of this array will be the values, for example if you swap the name/level entries in the procedure or the table - the worldserver will never boot up. I personally think that we should leave it as-is, none of the leaked cores has procedures neither does Trinity/Mangos.
Yes - for web apps or other kind of queries it'd be awesome - logs for example, but not for major queries within the core.
That's the point, you never have to change what gets sent back to the worldserver, the output back from the procedure is always the same. The procedure's output stays the same, if you change the columns or tables that have the information you still send the data back to the worldserver as it's expecting to get it.
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Tue, Dec 8, 2020 at 3:34 PM FALL1N1 notifications@github.com wrote:
Not really, the table's columns are returned as an array to the core and the keys of this array will be the values, for example if you swap the name/level entries in the procedure or the table - the worldserver will never boot up. I personally think that we should leave it as-is, none of the leaked cores has procedures neither does Trinity/Mangos.
Yes - for web apps or other kind of queries it'd be awesome - logs for example, but not for major queries within the core.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/azerothcore/azerothcore-wotlk/issues/3682#issuecomment-741233574, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPUFNF75DTKHY2RQYC3HDST2ZXRANCNFSM4TSNJVNQ .
@DrtyByt thanks for posting this suggestion
While the current method works this does make any database structure changes breaking
you meant this doesn't
right?
meant that the current method of direct queries does, but using a semantic layer makes it so they are not.
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Dec 10, 2020 at 12:50 PM Francesco Borzì notifications@github.com wrote:
@DrtyByt https://github.com/DrtyByt thanks for posting this suggestion
While the current method works this does make any database structure changes breaking
you meant this doesn't right?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/azerothcore/azerothcore-wotlk/issues/3682#issuecomment-742790504, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPUFJPXQAWS53X6EQB47LSUEYA7ANCNFSM4TSNJVNQ .
@DrtyByt ok, got it. I like your idea in general, however I'm not sure if this could bring unwanted side effects but definitely worth it a try.
Would you like to provide a proof of concept of this? i.e. a PR that implements and uses one view or stored procedure in the core so we can give it a try
There is a draft PR out there showing the idea on the auth db. There is an issue though with it because of some of the code in how it calls for information in a fetch queue, then calls again with stuff still in the fetch queue. Here is the Stack question for it. https://stackoverflow.com/questions/65191535/how-to-clear-the-db-fetch-queue-before-next-query-is-called
Draft PR https://github.com/azerothcore/azerothcore-wotlk/pull/3768/files
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Dec 10, 2020 at 2:09 PM Francesco Borzì notifications@github.com wrote:
@DrtyByt https://github.com/DrtyByt ok, got it. I like your idea in general, however I'm not sure if this could bring unwanted side effects but definitely worth it a try.
Would you like to provide a proof of concept of this? i.e. a PR that implements and uses one view or stored procedure in the core so we can give it a try
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/azerothcore/azerothcore-wotlk/issues/3682#issuecomment-742831185, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPUFPZQPNCPD5PZKDCNWLSUFBJTANCNFSM4TSNJVNQ .
@DrtyByt I see, have you tested it in game already?
tried, but the server won't stay online because of the error. I've been trying to resolve the error but no luck so far. The easiest way I know to fix the error is to just clear the fetch queue before it goes to the next query, but I'm not familiar with the library being used to connect to MySQL so I don't know how to do that.
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Dec 10, 2020 at 2:24 PM Francesco Borzì notifications@github.com wrote:
@DrtyByt https://github.com/DrtyByt I see, have you tested it in game already?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/azerothcore/azerothcore-wotlk/issues/3682#issuecomment-742838417, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPUFO5ZPP5FEUJK2OJT7TSUFDDTANCNFSM4TSNJVNQ .
Is your feature request related to a problem? Please describe. There is no direct issue, this is more an optimization and cleanup task
Describe the solution you'd like Creating a layer of views/sproc to retrieve and update data from the database. This would be done to all methods of get/set to the database for core, and modules could follow. For backwards compat concerns any breaking changes can be surfaced with views to make things look as they did before. See Additional context for examples.
Describe alternatives you've considered While the current method works this does make any database structure changes breaking. It would also allow the db engine to use cached plans for the procedures.
Additional context Example1: (simple example of just data retrieval) Current call: (From CharacterDatabase.cpp)
In the DB:
Example2: (insulation vs db change Current call: (From CharacterDatabase.cpp)