-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CraueGeoBundle & sqlite3: SQLSTATE[HY000]: General error: 1 no such function: ASIN #12
Comments
I'm afraid I cannot help you with this. SQLite is currently not supported and I guess that won't change due to these missing math functions. |
Hi Christian, thanx for the feedback. I was afraid that would be your answer. :-/ If I manage to work around the problem (e.g. install the extensions), I'll Cheers, 2016-04-22 5:40 GMT+02:00 Christian Raue [email protected]:
|
@azine I think you're on the right way. |
@azine I investigated little bit further. It seems that you first have to install the extension and then load the extension via load_extension() Following library uses extension loading: |
Hi @robertfausk, I already managed to get the math functions from "extension-functions.c" loaded into sqlite. Instructions are inside the extension-functions.c file... I used I can now call the new math functions by executing a "native query" through Doctrine. But there is still one step missing, because Doctrine does not yet know that sqlite is able to handle those math functions. The functions are not part of the doctrine-sqlite-mapping. So I'll have to look into "teaching" Doctrine that sqlite is now able to calculate asin and acos etc. When I managed to get all the pieces to work, I'll post some instructions here. Cheers, |
Hi, I managed to get the asin/acos functions working in sqlite and also in doctrine by compiling the extension as described above, placing it in protected function initializeContainer() {
parent::initializeContainer();
if ('test' !== $this->getEnvironment()) {
return;
}
// load the math function for sqlite
$manager = $this->getContainer()->get('doctrine.orm.entity_manager');
if($manager->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform){
$extensionFile = realpath(__DIR__."/../bin/sqlite-extension/libsqlitefunctions.so");
$statement = $manager->getConnection()->prepare("SELECT load_extension('$extensionFile');");
if(!$statement->execute()){
throw new \Exception("unable to load libsqlitefunctions.so from $extensionFile");
}
$statement = $manager->getConnection()->prepare("SELECT ASIN(1) as a;");
$statement->execute();
$result = $statement->fetchAll();
if($result[0]['a'] !== "1.5707963267949"){
throw new \Exception("unable to execute the asin function, loading libsqlitefunctions.so from $extensionFile probably failed.");
}
}
} It's probably not the nicest way, but for now it works. Cheers, |
For Windows users: My PHP on my Windows machine also complained about the missing "ASIN" function when using SQLite. I was able to fix this by replacing the "libsqlite3.dll" file found in my PHP directory with the sqlite3.dll (rename to libsqlite3.dll) found in the .zip file on the official SQLite download page (https://www.sqlite.org/download.html) under the section "Precompiled Binaries for Windows". |
Hi,
thank you very much for the cool bundle. Works like a charm with my MySQL backend.
...unfortunately it does not with my installation of sqlite3 (on Ubuntu 15.04) that I use to run unit-tests on.
I always get the following error "SQLSTATE[HY000]: General error: 1 no such function: ASIN".
Googling around I found out the cause could be, that I need to install an extension for sqlite (=> http://www.sqlite.org/contrib/download/extension-functions.c?get=25).
As I didn't manage to install it on my Ubuntu machine, I wanted to ask two things:
Thanx a lot for your help.
Dominik
The text was updated successfully, but these errors were encountered: