Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: Pandos on February 5th, 2014, 02:12 AM

Title: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Pandos on February 5th, 2014, 02:12 AM

After changing symbol of my gallery folder and reuploaded another image:

The database value you're trying to insert does not exist: id_file
Function: aeva_resetTransparency
 File: /usr/local/var/www/gz/app/media_Subs-Media.php
Line: 3590

Pictures still there but not accessible
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Nao on February 5th, 2014, 10:15 AM
Well... It's certainly there in install.sql... id_file int(10) auto_increment...
What do you mean by 'symbol'..? The icon?
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Pandos on February 5th, 2014, 10:17 AM
Yes.

Posted: February 5th, 2014, 10:16 AM

It all works as expected. I can create new albums, etc. But editing this album caused the error.
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Nao on February 5th, 2014, 11:11 AM
One particular album..?
Maybe it's a problem that was born at import time..? Or even at SMF+AeMe time?
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Pandos on February 5th, 2014, 11:17 AM
New setup with latest version :(
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Nao on February 5th, 2014, 11:17 AM
One particular album, or any album?
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Pandos on February 5th, 2014, 11:22 AM
It's only one album.
So I tracked it down:
It was: for the first album. Error occures when I tried to change the icon. It gives me error 500 (see other post).
So I came to the conclusion that it updated the table with the new file but can't find it.
I'll play a bit in db to get it to work again.
Will report.
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Nao on February 5th, 2014, 11:32 AM
Thanks. All of the forums I did my testing on were imported. The last test forum I installed from scratch I removed yesterday. :(
Hopefully you can find out what's wrong.

Don't forget that db_aeva.sql (from the AeMe package at SMF) was never imported into Wedge, and as such there may be things missing.
I know that all generic icons except for the big 4 are missing. :-/
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: live627 on February 15th, 2014, 08:27 AM
Quote from Nao on February 5th, 2014, 10:15 AM
Well... It's certainly there in install.sql... id_file int(10) auto_increment...
Woah woah woah. Not a SQL error.
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on April 3rd, 2016, 05:15 AM
Although the issue is so old. The bug is still. I could solve it for SMF and for Wedge.

SMF
Aeva-Subs.php (Version 2.10) line 3721
Code: [Select]
WHERE id_file = {int:id_file}',
change to
Code: [Select]
WHERE id_file = id_file',

Wedge
Subs-Media.php line 3600
Code: [Select]
WHERE id_file = {int:id_file}',
change to
Code: [Select]
WHERE id_file = id_file',
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: CerealGuy on April 11th, 2016, 09:03 AM
Quote from Franky on April 3rd, 2016, 05:15 AM
Although the issue is so old. The bug is still. I could solve it for SMF and for Wedge.

SMF
Aeva-Subs.php (Version 2.10) line 3721
Code: [Select]
WHERE id_file = {int:id_file}',
change to
Code: [Select]
WHERE id_file = id_file',

Wedge
Subs-Media.php line 3600
Code: [Select]
WHERE id_file = {int:id_file}',
change to
Code: [Select]
WHERE id_file = id_file',
Even if it's just some small changes, would you mind to make a pull request or push it on github?
The reason behind this is that I think we have bigger chances that those fixes get merged into the main branch if we make as little work for Nao as possible and it would be easier to keep track of the bugs and its fixes/changes.

PS: I actually don't think that this fixes the real problem, because with replacing {int:id_file} the argument to the query doesn't get insert any more. So maybe you have no error any more, but maybe the query is now doing nothing any more too.
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on April 11th, 2016, 10:05 AM
It does not address the cause, only the error message no longer appears. The cause of the error is the bug with outsource to the root gz.

http://wedge.org/pub/bugs/8781/aeva-cache-of-aeva-sites/msg297060/#msg297060
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on April 13th, 2016, 07:38 AM
Have now the source identified that causes the bug. It is the function of the aeva media gallery.:
Quote
Added transparency flag to pictures, and functions to determine transparency
This is the error message:
Quote
The database value you're trying to insert does not exist: id_file
Function: aeva_resetTransparency
The value id_file but is available, see attachment database_transparency.JPG
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: CerealGuy on April 23rd, 2016, 01:33 PM
Try to debug it, check what's the content of $id_file by inserting something like
Code: [Select]
log_error($id_file);
before the query gets fired. And then check your error logs in the wedge acp. You should get some number(s). If you only get empty errors, there is something wrong with how the function gets executed, if you get a numer, there is something wrong with the query/db part.
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on April 23rd, 2016, 03:39 PM
Thanks ^_^ , I will try.
The error comes only with version 2.10 with the introduction of the function transparency flag to pictures.
Quote
New with 2.10  Added transparency flag to pictures, and functions to determine transparency
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on April 23rd, 2016, 09:54 PM
Go to Media over the menu button

Database error
File: /xxxxxxxxxxxxxxxxxxxxxxxxxxx/wedge/gz/app/media_Subs-Media.php  (root =>gz => http://wedge.org/pub/bugs/8781/aeva-cache-of-aeva-sites/msg297060/#msg297060)
Line: 3605

Code: (php) [Select]
3594function aeva_resetTransparency($id_file, $path)
3595{
3596 $is_transparent = aeva_isTransparent($path);
3597 wesql::query('
3598 UPDATE {db_prefix}media_files
3599 SET transparency = {string:transparency}
3600 WHERE WHERE id_file = id_file',
3601 array(
3602 'id_file' => $id_file,
3603 'transparency' => $is_transparent ? 'transparent' : 'opaque',
3604 )
3605 );
3606 return $is_transparent;
3607}
Line 3605:    
Code: (php) [Select]
);
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on July 25th, 2017, 05:40 PM
Fixed => https://wedge.org/pub/feats/6108/new-revs/msg297748/#new
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Nao on July 25th, 2017, 07:35 PM
Apologies for missing out on this topic for so long... I posted in it at the beginning, then forgot about it, and it came at a time when I was putting Wedge behind me and moving on to my next venture (which, at the time, didn't involve Wedge... But ended up involving it, because that's who I am.)
The worst thing here, is that it was a very straightforward fix (just testing if $id_file is empty before calling the query), but I wanted to know WHY it happened in the first place. Now I have my answer because it happened at Wedge.org (uploading a link to an embedded video.)
Still, I hope there aren't more game-breaking bugs like this one... (?)
Title: Re: [AeMe] The database value you're trying to insert does not exist: id_file
Post by: Franky on July 25th, 2017, 08:17 PM
No Problem, i have embed the video :)

I could have done it before, But I did not do it sooner. Now it is fixed, and that counts :cool: