默认头像
路人甲
路人甲
  • 注册日期2004-07-09
  • 发帖数38
  • QQ24938384
  • 铜币276枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1391回复:0

ArcSDE C-API 开发:添加新要素

楼主#
更多 发布于:2007-02-12 14:50

基本步骤:

  1. Connect to a database.

  2. Initiate the insert statement on the stream.

  3. For each row to be inserted
    {
       Set the data values.
       Insert row by executing statement.
    }

  4. Disconnect from the database.

代码:

* Define the columns to be filled in on insert */

num_cols = 4;

attrs = (CHAR **) malloc (num_cols * sizeof(CHAR *));

attrs[0] = "city_name";

attrs[1] = "area";

attrs[2] = "population";

attrs[3] = "boundary";

/* Tell the stream that you are inserting new records into the table */

rc = SE_stream_insert_table (Stream, "cities", num_cols, attrs);

/* See Error handling section for check_error function code. */

check_error(NULL, Stream, rc, "SE_stream_insert_table");

/* For each record to be inserted into the table */

while (more data exists for insert;ldots;)

{

   rc = SE_stream_set_string (Stream, 1, city_name);

   check_error(NULL, Stream, rc, "SE_stream_set_string");

   rc = SE_stream_set_double (Stream, 2, area);

   check_error(NULL, Stream, rc, "SE_stream_set_double");

   rc = SE_stream_set_integer (Stream, 3, population);

   check_error(NULL, Stream, rc, "SE_stream_set_integer");

   rc = SE_stream_set_shape (Stream, 4, shape);

   check_error(NULL, Stream, rc, "SE_stream_set_shape");

   rc = SE_stream_execute (Stream);

   check_error(NULL, Stream, rc, "SE_stream_execute");

}

喜欢0 评分0
Sam.Zhou/GIS系统架构师
默认头像

返回顶部