Req #81534 [Com]: Math Functions are not working on SQLITE connection.

From: Date: Thu, 21 Oct 2021 01:46:18 +0000
Subject: Req #81534 [Com]: Math Functions are not working on SQLITE connection.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237307@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81534&edit=1

 ID:                 81534
 Comment by:         iyashpal dot dev at gmail dot com
 Reported by:        iyashpal dot dev at gmail dot com
 Summary:            Math Functions are not working on SQLITE connection.
 Status:             Open
 Type:               Feature/Change Request
 Package:            SQLite related
 Operating System:   Windows 11, 10
 PHP Version:        8.0.11
 Block user comment: N
 Private report:     N

 New Comment:

The thing is I am not aware of how I can enable the sqlite3 math functions. I have tried to replace
the sqlite3 extension but PHP isn't working with it. I don't know I have done this wrong
way or not but it wasted my 2 days. When I am unable to fix this, I came here to find a solution but
no luck. Then I posted this issue here. I don't think this is a bug but maybe there should be
some guidelines on the official documentation how we can deal with such problems. I am not able to
find a perfect solution on the web. You are the only hope here. I can't proceed with my Test
Driven Development with php sqlite3. Please help me. And I am sorry for the late reply because I
thought this issue won't get anyone's attention because this is not a bug.

Please help me with a solution. I will be very greatful for this help.

Thank You
Yash Pal


Previous Comments:
------------------------------------------------------------------------
[2021-10-21 01:36:14] iyashpal dot dev at gmail dot com

On a mac, it's working fine without extra effort. On Linux, working smoothly without any extra
effort.

------------------------------------------------------------------------
[2021-10-18 08:13:51] cmb@php.net

These functions need to be explicitly enabled when building
SQLite3[1], what has not been done so far.  Are these usually
available on other systems?

[1] <https://www.sqlite.org/lang_mathfunc.html>

------------------------------------------------------------------------
[2021-10-18 06:16:45] iyashpal dot dev at gmail dot com

PHP files were downloaded from this link : https://windows.php.net/download#php-8.0

I have tested this on Windows 10 Pro and 11 Pro.

------------------------------------------------------------------------
[2021-10-18 06:10:49] iyashpal dot dev at gmail dot com

Description:
------------
PHP Version: 8.0.11
OS Edition: Windows 11 Pro
OS Version: 21H2
OS Build: 22000.258

PHP Framework Used: Laravel 8.63
 

Test script:
---------------
Route::get('/', function () {

    $sqlite = new SQLite3(base_path('sqlite3.dbi'), SQLITE3_OPEN_READWRITE);


    dd($sqlite->query('SELECT SQRT(4)'));
    dd(DB::select("SELECT SQRT(4)"));
    return view('welcome');
});

Expected result:
----------------
Should show 2

Actual result:
--------------
ErrorException
SQLite3::query(): Unable to prepare statement: 1, no such function: SQRT


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81534&edit=1


Thread (12 messages)

« previous php.bugs (#237307) next »