Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2014
    Posts
    7

    Unanswered: mysql_query() returns error but mysql_errno() returns 0

    Hi

    MySQL 5.6, C interface. An example of offending query (happens randomly with different ones):

    INSERT INTO main_hash_db.main_tbl (sha256, sha1, md5, created, modified, size, ext, path, orig_path) VALUES
    (
    '0688C46B3662AA2D00218DEF7E60863F7B8B006889E4FB4FF 8780600DB5AE60D',
    '63BF82052999F829326C8379BA54262838FADF6B',
    '3E6229A8CA387A49B759466B3CE7A980',
    FROM_UNIXTIME(1363339457),
    FROM_UNIXTIME(1254123985),
    192673,
    'png',
    'd:\\test\\out\\0\\06\\88\\C4\\6B\\36\\0688C46B366 2AA2D00218DEF7E60863F7B8B006889E4FB4FF8780600DB5AE 60D.png',
    'c:\\windows\\ActWin8Serv2012\\OEM_VERSION\\FOUNDE R\\windows\\Web\\Wallpaper\\Windows\\img0.png'
    )


    mysq_error() returns 0, mysql_sqlstate(0) returns '00000'. Other similar queries return success and the offending queris return success in different sessions so it's pretty much random. There is nothing in the .err file. How do I go about this?

  2. #2
    Join Date
    Jul 2014
    Posts
    7

    mysql_query() returns error but mysql_errno() indicates no error

    Sorry, double post.
    Last edited by 1tmips; 09-10-14 at 15:04.

  3. #3
    Join Date
    Jul 2014
    Posts
    7
    One other thing to note is that the offending queries reach the database allright. They also seem to all be duplicates (the sha256, sha1 and md5 rows are defined as UNIQUE). They are reported as duplicates at other times (these offending duplicates occur more than once).
    Maybe it's also worth noting that my app has multiple threads inserting data simultaneously. Can this be because of queries containing duplicate keys being sent to the server simultaneously?

  4. #4
    Join Date
    Jul 2014
    Posts
    7
    In my original post I wrote "the offending queries return success in different sessions". Sorry for misleading you, I meant that in other sessions mysql_errno() returns the expected value for the duplicates, MYSQL_DUPLICATE_KEY_ERROR_CODE.

    And it looks like I narrowed it down. My initial supposition was right: it doesn't happen when only one thread is inserting data. Still, to me this doesn't sound like normal behavior. Or...?

Posting Permissions

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