Results 1 to 5 of 5
  1. #1
    Silent's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    5,070
    Reputation
    2172
    Thanks
    8,474
    My Mood
    Bitchy

    MySQL LAST_INSERT_ID w/ persistent connection

    Anyone know how you should handle getting LAST_INSERT_ID with a persistent connection? From what I understand, it can be extremely dangerous. Anyone got a bodge fix, without opening another connection?
    Click Here to visit the official MPGH wiki! Keep up with the latest news and information on games and MPGH! To check out pages dedicated to games, see the links below!











    dd/mm/yyyy
    Member - 31/01/2015
    Premium - 12/09/2016
    Call of Duty minion - 05/11/2016 - 05/11/2019
    BattleOn minion - 28/02/2017 - 05/11/2019
    Battlefield minion - 30/05/2017 - 05/11/2019
    Other Semi-Popular First Person Shooter Hacks minion - 21/09/2017 - 17/09/2019
    Publicist - 07/11/2017 - 02/08/2018
    Cock Sucker - 01/12/2017 - Unknown
    Minion+ - 06/03/2018 - 05/11/2019
    Fortnite minion - 08/05/2018 - 05/11/2019
    Head Publicist - 08/10/2018 - 10/01/2020
    Developer Team - 26/10/2019 - 10/01/2020
    Former Staff - 10/01/2020



  2. #2
    Dave84311's Avatar
    Join Date
    Dec 2005
    Gender
    male
    Location
    The Wild Wild West
    Posts
    35,837
    Reputation
    5782
    Thanks
    41,292
    My Mood
    Devilish
    Why use a persistent connection? I never use those. Just open up a connection for a transaction and close it. Let mysql handle the concurrency.





    THE EYE OF AN ADMINISTRATOR IS UPON YOU. ANY WRONG YOU DO IM GONNA SEE, WHEN YOU'RE ON MPGH, LOOK BEHIND YOU, 'CAUSE THATS WHERE IM GONNA BE


    "First they ignore you. Then they laugh at you. Then they fight you. Then you lose.” - Dave84311

    HAVING VIRTUAL DETOX

  3. The Following User Says Thank You to Dave84311 For This Useful Post:

    MikeRohsoft (11-05-2018)

  4. #3
    Silent's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    5,070
    Reputation
    2172
    Thanks
    8,474
    My Mood
    Bitchy
    Quote Originally Posted by Dave84311 View Post
    Why use a persistent connection? I never use those. Just open up a connection for a transaction and close it. Let mysql handle the concurrency.
    Why open tens of connections when you can simply open one? and dw, i got around it. i don't believe there is a way to do it.
    Click Here to visit the official MPGH wiki! Keep up with the latest news and information on games and MPGH! To check out pages dedicated to games, see the links below!











    dd/mm/yyyy
    Member - 31/01/2015
    Premium - 12/09/2016
    Call of Duty minion - 05/11/2016 - 05/11/2019
    BattleOn minion - 28/02/2017 - 05/11/2019
    Battlefield minion - 30/05/2017 - 05/11/2019
    Other Semi-Popular First Person Shooter Hacks minion - 21/09/2017 - 17/09/2019
    Publicist - 07/11/2017 - 02/08/2018
    Cock Sucker - 01/12/2017 - Unknown
    Minion+ - 06/03/2018 - 05/11/2019
    Fortnite minion - 08/05/2018 - 05/11/2019
    Head Publicist - 08/10/2018 - 10/01/2020
    Developer Team - 26/10/2019 - 10/01/2020
    Former Staff - 10/01/2020



  5. #4
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Does MySQL not have connection pooling? closing/reopening is probably more efficient than keeping one open for extended periods of time.
    Ah we-a blaze the fyah, make it bun dem!

  6. #5
    Jafii's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    4
    I don't recommend using pconnection, under all circumstances though, you just have to make a failsafe for the possible case of an erronous return, meaning you should always have the call return a row, no matter what.

    I mean the whole idea of "One connection vs. Unlimited" seems to be the only ever, EVER, argument, and it is so stupid that you should not use it.

    Sure, you can have one OBJECT to handle all the tasks of any other object you would use, I mean why can't an object contain the neccessary information to substitute for all other objects? Right? Well, sure, that's a good way to put it, but no it's stupid and you know it, so why must you persistently push for something similarly stupid when you as a developer understand the underlying problem of an insecurity...

    I hope I don't offend anyone, and I'm not particularly fond of persistent connections, never felt the need to use it... There is a way to make it safe, but it would defeat the overall purpose. That is to have a non-persistent connection to a persistent connection that is encapsulated and only accessible when needed, well it's a stupid idea anyway, but good luck on your issues.

  7. The Following User Says Thank You to Jafii For This Useful Post:

    [MPGH]Dave84311 (11-09-2018)

Similar Threads

  1. [Help] having trouble connecting to mysql database from VB
    By franzyx in forum Visual Basic Programming
    Replies: 2
    Last Post: 09-01-2012, 06:41 PM
  2. [Help] make a Register/Login System in Visual studio connect to a FTP mysql server
    By selex2808 in forum Visual Basic Programming
    Replies: 3
    Last Post: 05-30-2012, 10:53 PM
  3. [Help] login system that connects to a MYSQL database
    By justiman in forum Visual Basic Programming
    Replies: 4
    Last Post: 04-12-2011, 10:40 AM
  4. [Help] Connect VB2010 > Navicat for MySQL
    By D3t0N4t3 in forum Visual Basic Programming
    Replies: 6
    Last Post: 12-18-2010, 06:02 AM
  5. [Help] Connect to MySQL
    By tuve2 in forum C# Programming
    Replies: 0
    Last Post: 07-09-2010, 09:32 AM