SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL - Returning Blob Length

    How would I go about returning the current length of a blob field, in a specific row, in bytes?

    Any way to accomplish this via straight SQL?
    My name is Steve, and I'm a super-villian.

  2. #2
    public static void brain Gybbyl's Avatar
    Join Date
    Jun 2002
    Location
    Montana, USA
    Posts
    647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use 'crooked' SQL and do it in php

    Then again, that wouldn't be portable. But who cares? You would never need to port it, anyway.
    Ryan

  3. #3
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was about to ask what implementation supported "crooked" SQL, then reread my first post....

    But really, I mean like, I always search google before asking *any*thing, but I can't find this anywhere! Yet PHPMyAdmin does this without thinking... I was going to look through the source code to try to find it, though I don't know which module to start it

    Cheers!!
    My name is Steve, and I'm a super-villian.

  4. #4
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    phpMyAdmin does it with SHOW TABLE STATUS FROM database_name; but this shows per database status. So it doesn't count each row and add up...

    Can't you do it with SELECT LENGHT(blob_field) FROM table_name WHERE id = 1?

    I can.

  5. #5
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're kidding me, right?

    The keyword was "Length"!!!!!!!

    Arg, after hours of searching "Size", "Blob size" "mysql column size".......arghh

    I even looked under misc. functions, and didn't see length....

    Thanks!
    My name is Steve, and I'm a super-villian.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •