[DiscordArchive] when im defining preparestatement if i use multiple ? do i have to provide multiple arguments or if
[DiscordArchive] when im defining preparestatement if i use multiple ? do i have to provide multiple arguments or if
Archived author: Rymercyble • Posted: 2023-11-02T13:17:46.978000+00:00
Original source
when im defining preparestatement if i use multiple ? do i have to provide multiple arguments or if i provide 1 it will be used for all placeholders ?
Archived author: Roboto • Posted: 2023-11-02T13:27:34.339000+00:00
Original source
iirc you have to repeat the argument
Archived author: Rymercyble • Posted: 2023-11-02T13:28:15.971000+00:00
Original source
https://tenor.com/view/annoyed-disappoin...f-26051033
Archived author: Rymercyble • Posted: 2023-11-02T13:28:43.516000+00:00
Original source
```cpp
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL_TALENTS);
stmt->SetData(0, spellId);
stmt->SetData(1, spellId);
stmt->SetData(2, spellId);
CharacterDatabase.Execute(stmt);
```
im enjoying my life choices
Archived author: Natrist • Posted: 2023-11-02T14:46:22.705000+00:00
Original source
*Who* the **fuck** came up with that design
Archived author: wakemeup • Posted: 2023-11-02T15:01:45.463000+00:00
Original source
Of course you have to fill every placeholder by hand Otherwise you'd open the gates of hell. Having to talk with the DB yourself is risky enough and if you put start putting some sort of magic into it, you will never be happy again, I promise you that
Archived author: Rymercyble • Posted: 2023-11-02T15:12:19.342000+00:00
Original source
but there should be way to use same for multiple places otherwise i have to do this and its just pain
Archived author: wakemeup • Posted: 2023-11-02T15:32:38.832000+00:00
Original source
What you could do is to write an abstraction that you can use between you layers. In ancient times people called it the Data Access Layer or DAL
Archived author: wakemeup • Posted: 2023-11-02T15:34:42.891000+00:00
Original source
Also I'm curious, when I look at the prepare statement you're using, I only see one placeholder
Archived author: wakemeup • Posted: 2023-11-02T15:35:28.120000+00:00
Original source
PrepareStatement(CHAR_DEL_INVALID_SPELL_TALENTS, "DELETE FROM character_talent WHERE spell = ?", CONNECTION_ASYNC);