示例#1
0
/*!
  \brief Receive value

  \param value
  \param Ctype

  \return
*/
int db__recv_value(dbValue * value, int Ctype)
{
    DB_RECV_CHAR(&value->isNull);
    if (value->isNull)
	return DB_OK;

    switch (Ctype) {
    case DB_C_TYPE_INT:
	DB_RECV_INT(&value->i);
	break;
    case DB_C_TYPE_DOUBLE:
	DB_RECV_DOUBLE(&value->d);
	break;
    case DB_C_TYPE_STRING:
	DB_RECV_STRING(&value->s);
	break;
    case DB_C_TYPE_DATETIME:
	DB_RECV_DATETIME(&value->t);
	break;
    default:
	db_error(_("send data: invalid C-type"));
	return DB_FAILED;
    }
    return DB_OK;
}
示例#2
0
/*!
  \brief Receive datetime

  \param t pointer to dbDateTime

  \return DB_OK
*/
int db__recv_datetime(dbDateTime * t)
{
    DB_RECV_CHAR(&t->current);
    if (!t->current) {
	DB_RECV_INT(&t->year);
	DB_RECV_INT(&t->month);
	DB_RECV_INT(&t->day);
	DB_RECV_INT(&t->hour);
	DB_RECV_INT(&t->minute);
	DB_RECV_DOUBLE(&t->seconds);
    }

    return DB_OK;
}
示例#3
0
int db__recv_index(dbIndex * index)
{
    int i, ncols;

    db_init_index(index);
    DB_RECV_STRING(&index->indexName);
    DB_RECV_STRING(&index->tableName);
    DB_RECV_CHAR(&index->unique);

    DB_RECV_INT(&ncols);

    if (db_alloc_index_columns(index, ncols) != DB_OK)
	return db_get_error_code();

    for (i = 0; i < ncols; i++) {
	DB_RECV_STRING(&index->columnNames[i]);
    }

    return DB_OK;
}