Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9021409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:14:57+00:00 2026-06-16T05:14:57+00:00

In my PHP unit tests, I am using an SQLite in-memory database, which contains

  • 0

In my PHP unit tests, I am using an SQLite in-memory database, which contains the following table:

CREATE TABLE "battlegroup_request" (
  "id" INTEGER NULL PRIMARY KEY AUTOINCREMENT,
  "battlegroupID" INTEGER NULL,
  "inviterID" INTEGER NULL,
  "inviteeID" INTEGER NULL
)

When I execute the following query with two integer bindings;

SELECT *
FROM "battlegroup_request"
WHERE "inviteeid" = ? AND
  "inviter" IS NOT NULL AND
  "battlegroupid" = ?
LIMIT 1

The query returns one result, but I expect it to throw an error, since the column inviter does not exist. Is this expected behaviour of SQLite? Am I doing something wrong?

I am using PDO, the connection was created as follows:

new PDO(
    'sqlite::memory:',
    null,
    null,
    array(
        PDO::ATTR_CASE => PDO::CASE_LOWER,
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
        PDO::ATTR_STRINGIFY_FETCHES => false,
        PDO::ATTR_EMULATE_PREPARES => false,
    )
);

(These options are Laravel‘s default, which is the framework we’re using.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:14:59+00:00Added an answer on June 16, 2026 at 5:14 am

    If you use something like:

    SELECT "inviter" IS NOT NULL FROM battlegroup_request
    

    it will return TRUE if column inviter did not exist, because SQLite will treat "inviter" as simply string value (and it is certainly not NULL here).

    However, if you drop double quotes:

    SELECT inviter IS NOT NULL FROM battlegroup_request
    

    it will raise exception if column inviter did not exist.

    EDIT: Using backticks also forces SQLite to treat it as name (not a string):

    SELECT `inviter` IS NOT NULL FROM battlegroup_request
    

    will raise an exception if column inviter did not exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing unit tests for a project (written in PHP, using PHPUnit) that have
We're currently having issues with memory leaks when using unit tests with Symfony 1.x
i am using simpletest as my php unit test framework. i put all my
I am used to writing unit tests in Zend Framework 1.9 using PHPUnit_Framework_TestCase for
I'm trying to run Symfony 2 PHP unit tests for a REST API in
I am getting this exception when trying to run my PHP unit tests: Fatal
I am writing a small script for watchr that runs my PHP unit tests.
I am currently performing unit tests on my code (using PHPUnit and Jenkins) but
I'm using PHPUnit to try to unit test some PHP files that are part
I'm new to php and using APC framework. I'm trying to write some unit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.