Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Error’d: Pickup Sticklers

      September 27, 2025

      From Prompt To Partner: Designing Your Custom AI Assistant

      September 27, 2025

      Microsoft unveils reimagined Marketplace for cloud solutions, AI apps, and more

      September 27, 2025

      Design Dialects: Breaking the Rules, Not the System

      September 27, 2025

      Building personal apps with open source and AI

      September 12, 2025

      What Can We Actually Do With corner-shape?

      September 12, 2025

      Craft, Clarity, and Care: The Story and Work of Mengchu Yao

      September 12, 2025

      Cailabs secures €57M to accelerate growth and industrial scale-up

      September 12, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Using phpinfo() to Debug Common and Not-so-Common PHP Errors and Warnings

      September 28, 2025
      Recent

      Using phpinfo() to Debug Common and Not-so-Common PHP Errors and Warnings

      September 28, 2025

      Mastering PHP File Uploads: A Guide to php.ini Settings and Code Examples

      September 28, 2025

      The first browser with JavaScript landed 30 years ago

      September 27, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured
      Recent
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: All Locked Up

    CodeSOD: All Locked Up

    July 7, 2025

    Dan was using a third-party database which provided a PHP API. At one point, Dan was running into an issue where he actually needed locks on the database. Fortunately for him, the vendor documentation told him that there was a method called obtainRowLock.

    obtainRowLock($table, $where) – Attempt to lock a row, will escalate and lock the table if row locking is not supported, will escalate and lock the database if table locking is not supported; returns true on success, false on failure
    $table – name of table to lock
    $where – WHERE clause to define rows, ex: “WHERE id=52”. If left empty, function will assume a table lock

    That was exactly what Dan needed, so he called it. It returned false, implying a failure. He changed the parameters. He discarded his where clause. He tried all sorts of things, and it always returned false. So he dug into the source code, to see how it actually worked.

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">obtainRowLock</span>(<span class="hljs-params"><span class="hljs-variable">$table</span>, <span class="hljs-variable">$where</span></span>)
    </span>{
      <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    }
    

    Is it truly a failure if you don’t even try?

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleThe Movie Speeds Past $300M—Apple’s First True Box Office Breakthrough
    Next Article FinTech App Development Cost in 2025: Features, Factors & Pricing Guide

    Related Posts

    News & Updates

    Building personal apps with open source and AI

    September 12, 2025
    News & Updates

    What Can We Actually Do With corner-shape?

    September 12, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    The Rise of AI-Generated Video: Transforming the Future of Marketing Strategy🎬

    Web Development

    JetBrains AI Assistant : Revolutionizing Tech Solutions

    Development

    Build rich, interactive web apps with an updated Gemini 2.5 Pro

    Artificial Intelligence

    Industry Oriented Best UI UX Design Course in Pune – Get Job Ready! 2025

    Web Development

    Highlights

    AI Color Palette Generator

    April 29, 2025

    Create stunning color palettes instantly with AI. Enter any name, keyword or theme to generate…

    Yes, you need a firewall on Linux – here’s why and which to use

    August 4, 2025

    Google Chrome 0-Day Vulnerability Exploited by APT Hackers in the Wild

    June 17, 2025

    Four trends reshaping Kubernetes platform engineering

    May 13, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.