Laravel with SQLite returns error: "SQLSTATE[HY000]: General error: 1 no such function: SQRT" - laravel

I use a SQLite database for a Laravel 8 project. I get an error message when I try to query it.
Query: Model::selectRaw('col1,col2,col3,(6368 * SQRT(2*(1-cos(RADIANS(col1)))))')->get();
Error: SQLSTATE[HY000]: General error: 1 no such function: SQRT.
What am I doing wrong? Or is this query even possible with SQLite? Thank you for help!

According to my comment:
It is possible, you could use sqrt(). But you need to make sure that you have the math library enabled according to the docs: sqlite.org/lang_mathfunc.html#sqrt "but are only active if the amalgamation is compiled using the -DSQLITE_ENABLE_MATH_FUNCTIONS compile-time option."

Related

Toplog error handler React Redux Toolkit Query

sometimes a RTK Query has an error. I cannot find a generic place in the createApi where to handle those errors. I want to log them to my server but I cant now...
I only found a way to find 1 error when I use const {error} = useXYZQuery(), but I just want to write the logging code once.
Any help?
Thx

PHP Fatal error: Call to a member function getColumn() on a non-object in propel-gen diff

When I try to change the table structures using propel I am getting a Fatal error when I try to execute propel-gen diff. So how to resolve the issue?
PHP Fatal error: Call to a member function getColumn() on a non-object in /usr/share/php/data/propel_generator/lib/reverse/mysql/MysqlSchemaParser.php on line 329
This happens when there's a parsing error in your schema. You've probably changed something in your schema and that's now causing the failure. Best you undo whatever change to the last valid schema, then try and re-apply your changes bit by bit and validate as you're making change.
It's difficult thought to point out the issue without your schema.

Joomla 3.0 generic database error handling

Going from Joomla 2.5 to 3.0 with my extension, I'm struggling with how to do the DB error handling (since GetErrorNum is deprecated, see also Joomla! JDatabase::getErrorNum() is deprecated, use exception handling instead).
The way that seems to be the one to go according to the question linked above, is to add the following code for each db->query() code:
if (!$db->query()) {
throw new Exception($db->getErrorMsg());
}
In my opinion, that makes DB error handling more awkward than it was before. So far, I simply called a checkDBError() function after a DB call, which queried the ErrorNum and handled any possible error accordingly.
That was independent from how the DB query was actually triggered - there are different ways to do that, and different results on an error: $db->loadResult() returns null on error, $db->query() returns false. So there will now be different checks for different DB access types.
Isn't there any generic way to handle this, e.g. a way to tell Joomla to throw some exception on DB problems? Or do I have to write my own wrapper around the DatabaseDriver to achieve that? Or am I maybe missing something obvious?
Or should I just ignore the deprecation warning for now and continue with using getErrorNum()? I'd like to make my extension future-proof, but I also don't want to clutter it too much with awkward error handling logic.
Just found this discussion: https://groups.google.com/forum/#!msg/joomla-dev-general/O-Hp0L6UGcM/XuWLqu2vhzcJ
As I interpret it, there is that deprecation warning, but there is no proper replacement yet anyway...
Unless somebody points out any other proper documentation of how to do it in 3.0, I will keep to the getErrorNum method of doing stuff...
Get getErrorNum() function will solve your problem....
$result = $db->loadResult();
// Check for a database error.
if ($db->getErrorNum())
{
JFactory::getApplication()->enqueueMessage($db->getErrorMsg());
return false;
}

Dojo SyntaxError: missing ) in parenthetical

I have had this same error before and posted a question to that effect but unfortunately there was no answer. The previous error occurred under different circumstances ( ie I was triggered when I used the dojo toolkit sdk(Size 19M).
This time I am retrieving data from a couple of tables which have a one to many relationship. I am using Dojo, Doctrine and Zend Framework for my project. I have posted quite an extensive error message at 1 the Link to pastie.org with code and error details and the php and javascript that I identified as being the code involved.
When you look towards the end of the pastie in the FIREBUG ERROR MESSAGE section you will see a piece of JSON like
[{"id":"000001",
"name":"Adam",
"area_id":null,
"registration_date":"2011-03-08",
"loan_cycle":"0","credit_score":"100",
"created_by":null,
"borrowers":[{"id":"00000001",
"first_name":"Test",
"surname":"User",
"dob":"2006-12-09",
"personalid_no":"100000",
"gender":"Male",
"marital_status":"Marrie",
"home_number":"09866678",
"mobile_number":"09877655",
"accomodation_type":"owner",
"current_loan_cycle":"1",
"status":"Active",
"date_created":null,
"date_registered":"2009-12-11",
"created_by":null,
"Groups_id":"000001"}]
}]
Its clear that the data gets pulled from the tables. However the code fails and I get the error message SyntaxError: missing ) in parenthetical. I have battled with this for a long time now. Am at a point where I either have to abandon the application or restart the whole project again. Thanks for your help.

Trouble compiling or dropping an Oracle package

I was trying to compile a PL/SQL package and I got the following error:
ORA-04043: object SYS_PLSQL_77721_489_1 does not exist
After this, I can no longer recompile or drop the package.
Do you have any suggestions?
Try to do this:
DROP TYPE SYS_PLSQL_77721_489_1;
DROP TYPE SYS_PLSQL_77721_DUMMY_1;
DROP PACKAGE BODY xxxx;
DROP PACKAGE xxx;
I've had exactly the same problem and works. Sorry #Vicent but the link you provide does not solve the problem.
if you have access to support, this looks like bug #3744836. A similar bug is described here, related to pipelined functions and synonyms.
One confirmed cause of this problem is the use of pipelined functions with PL/SQL types. It is a bug, and so ought to fixed in more recent or fully patched versions of Oracle. A workaround would be to use SQL types instead (i.e. create type whatever as object ... ).
If this does not apply in your situation please edit your question to include more details.
Try to create the types as mentioned in the error message to resolve error while dropping or compiling packages.
Error :ORA-04043: object SYS_PLSQL_ B1A0D561_1132_1 does not exist
Resolution : CREATE TYPE SYS_PLSQL_B1A0D561_1132_1;
After that one more error came which reads
Error :ORA-04043: object SYS_PLSQL_B1A0D561_1242_1 does not exist
Resolution :CREATE TYPE SYS_PLSQL_B1A0D561_1242_1;
and issues resolved.
create or replace type SYS_PLSQL_77721_489_1 as object
for all erros when you drop
try drop again and again and create type for all erros...

Resources