[support] Database query cache issue

Richard Damon Richard at Damon-Family.org
Mon Aug 27 01:55:31 UTC 2012


On 8/26/12 9:32 PM, Kamal Palei wrote:
> Hi Jamie Holly
> Thanks for kind reply.
>  
> You are right, I just deleted the entry and added a new entry in files
> table, it looks fine.
>  
> I have a small concern. The 'fid' column in files is of type serial.
> But I do not want unnecessary  increment of fid values. For that
> purpose, while inserting new record, I am just making use of last fid
> value of that user. Code as below
>  
>
> db_query("INSERT INTO {files} (fid, uid, filename, filepath, filemime,
> filesize, status, timestamp) VALUES (%d, %d, '%s', '%s', '%s', %d, %d,
> %d)", $LastFID, $file->uid, $file->filename, $file->filepath,
> $file->filemime, $file->filesize, $file->status, $file->timestamp);
>
> Hope I am not doing any mistake while re-using last FID value.
>
>  
>
> Regards
>
> Kamal
>
> NECS, Bangalore
>
>
One other option, is if the user has already updated a file, rather than
deleting the database record and inserting a new one, do a replace or
update query to change the existing one.

Reusing a deleted serial value should be ok too.

-- 
Richard Damon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120826/7477997e/attachment.html 


More information about the support mailing list