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

    Racing beyond DeepRacer: Debut of the AWS LLM League

    Racing beyond DeepRacer: Debut of the AWS LLM League

    Machine Learning

    Automate AIOps with SageMaker Unified Studio Projects, Part 2: Technical implementation

    Machine Learning

    Smashing Security podcast #411: The fall of Troy, and whisky barrel scammers

    Development

    Enable Flexible Pattern Matching with Laravel’s Case-Insensitive Str::is Method

    Development

    Highlights

    Hidden Costs of Inefficient Online Testing and How to Stop the Money Drain

    April 9, 2025

    We all know that online testing is supposed to make life easier, right? It should…

    Complete Beginner’s Guide to Creating AI Applications with OpenAI

    May 30, 2025

    Your Marketing Automation Platform Evaluation Guide

    June 19, 2025

    Accessibility Analyzer

    July 9, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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