src/dbs/atrshmlogreaderd_db.c
int atrshmlog_write_transfer(atrshmlog_dbsession_t *i_db, mb_t* ob)
{
  int o_length;

  o_length = ob->head.tlen;
  
  if (o_length > 0)
    {
      int dbret = atrshmlog_begin_db(i_db);

      if (dbret != 0 )
	return -1;
      
      size_t lcount;

      lcount = (size_t)o_length;
          
      char *start = ob->ob;

      int hcount = 0;
      int ucs2count = 0;
      int ccount = 0;
      
      if (operate(i_db,
		  start,
		  ob->head,
		  0,
		  &hcount,
		  &ucs2count,
		  &ccount) != 0)
	{
	  dbret = atrshmlog_rollback_db(i_db);
	
	  return -1;
	}

      dbret = atrshmlog_commit_db(i_db);

      g_hcount += hcount;
      g_ucs2count += ucs2count;
      g_ccount += ccount;
    }

  return 0;
}
/**
 * we write one buffer to database
 */
we write one buffer to database
we write one buffer to database
int atrshmlog_write_transfer(atrshmlog_dbsession_t *i_db, mb_t* ob)
{
  int o_length;
  o_length = ob->head.tlen;
  if (o_length > 0)
    {
      int dbret = atrshmlog_begin_db(i_db);
      if (dbret != 0 )
	return -1;
      size_t lcount;
      lcount = (size_t)o_length;
      char *start = ob->ob;
      int hcount = 0;
      int ucs2count = 0;
      int ccount = 0;
      if (operate(i_db,
		  start,
		  ob->head,
		  0,
		  &hcount,
		  &ucs2count,
		  &ccount) != 0)
	{
	  dbret = atrshmlog_rollback_db(i_db);
	  return -1;
	}
      dbret = atrshmlog_commit_db(i_db);
      g_hcount += hcount;
      g_ucs2count += ucs2count;
      g_ccount += ccount;
    }
  return 0;
}
int atrshmlog_write_transfer ( atrshmlog_dbsession_t * i_db , mb_t * ob ) { int o_length ; o_length = ob -> head . tlen ; if ( o_length > 0 ) { int dbret = atrshmlog_begin_db ( i_db ) ; if ( dbret != 0 ) return -1 ; size_t lcount ; lcount = ( size_t ) o_length ; char * start = ob -> ob ; int hcount = 0 ; int ucs2count = 0 ; int ccount = 0 ; if ( operate ( i_db , start , ob -> head , 0 , & hcount , & ucs2count , & ccount ) != 0 ) { dbret = atrshmlog_rollback_db ( i_db ) ; return -1 ; } dbret = atrshmlog_commit_db ( i_db ) ; g_hcount += hcount ; g_ucs2count += ucs2count ; g_ccount += ccount ; } return 0 ; }
we write one buffer to database
we write one buffer to database