>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 1/18/01, 9:20:15 PM, Bhavin Turakhia <[EMAIL PROTECTED]> wrote 
regarding RE: [midgard-user] Cannot create Attachments: Internal error:

> PLEASE CHECK AT BOTTOM FOR THE LATEST UPDATE - i tried what you said 
Armand
> but it still does not work. Chck below

> For all the above additions the Mysql entries work percfectly. ie there 
is
> no problem in MySQL. For instance for every host i have added or 
attachment
> i have added there have been entries made in the hosts and the blobs 
table.
> I checked that through the mysql client.

> The version i am running is 3.22.32 which i think is ok.

> As per your suggestions i also started logging and did a tail -f and then
> went ahead and added an attachment and got this -

>    398 Query      INSERT INTO blobs (ptable,pid,name,title,loca
> tion,mimetype,author,created,score, sitegroup) VALUES
> ('page',36,'uio','oiu','3/
> 7/7c757c8b0700726e09e62af93d2f710a','image/gif',1,Now(),0, 0)
> 010118 12:49:10     398 Query      INSERT INTO repligard
> (realm,guid,id,changed,
> action) VALUES
> ('blobs','d2d81167a2c29964de8226622e9ba99e',1082438592,NULL,'crea
> te')

> Both these queries went in successfully as i checked the database and 
these
> rows have been inserted.

> So I am back to square 1.

Hmm.. I'm at a loss here. The 'Internal error' and the attachments not 
being created are certainly connected. I was guessing that mysql somehow 
performs the queries successfully, but still returns an error according 
to midgard-lib. It makes sense not to save the actual blob if it looks 
like the blob-record could not be created.

So the question boils down to why you get the internal error. I've 
searched the source for midgard-php, which is where the error is 
generated from. I've only found one instance of 
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL) in the code (mgd_main.c) that 
pertains to a create statement (lot's of disclaimers, I'm not too good at 
reading c):

void php_midgard_create(pval * return_value, const char *table,
      const char *fields, const char *values, ...)
{
  va_list args;
  int id;
  CHECK_MGD;

  va_start(args, values);
  id = mgd_vcreate(MGD_RCFG->mgd, table, fields, values, args);
  va_end(args);

   if (!id) {
      RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
      ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO,
         GLOBAL(php3_rqst),
         "Midgard: create of %s failed",
            table ? table : "<null class>");
   }

  RETURN_LONG(id);
}

so mgd_vcreate does not return the id of the created record. mgd_vcreate 
lives in midgard.c (from midgard-lib)

int mgd_vcreate(midgard * mgd, const char *table,
    const char *fields, const char *values, va_list args)
{
  const char *command = NULL;
  int rv;
  midgard_pool *pool;

  pool = mgd_alloc_pool();
  if (!pool)
    return 0;
  /* format command */
#if HAVE_MIDGARD_SITEGROUPS
  if (strcmp(table, "sitegroup") == 0) {
    if (mgd->root)
      command = mgd_format(mgd, pool,
               "INSERT INTO $s ($s) VALUES ($s)",
               table, fields, values);
  }
  else
    command = mgd_format(mgd, pool,
             "INSERT INTO $s ($s, sitegroup) VALUES ($s, $d)",
             table, fields, values, mgd->sitegroup);
#else
  command = mgd_format(mgd, pool,
           "INSERT INTO $s ($s) VALUES ($s)",
           table, fields, values);
#endif
  if (!command) {
    mgd_free_pool(pool);
    return 0;
  }

  /* execute command */
  rv = mgd_vexec(mgd, command, args);

  mgd_free_pool(pool);
  return rv ? mysql_insert_id(mgd->mysql) : 0;
}

So I'm still at your mysql installation not returning the expected return 
value. I haven't seen this before, and I would look at stray libraries 
(older version of libmysqlclient or some such). Beyond that I am afraid I 
can't be of any more help. CC-ing this one to the development list, 
hoping that someone will confirm/correct my findings.

Armand.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to