public static void GetLayerInfos(SE_CONNECTION connection, GetLayerInfosCallBack call) { if (call == null) { return; } try { unsafe { //Pointer2Pointer ptr = new Pointer2Pointer(); //System.Int32 num = 0; //System.Int32 status = Wrapper10.SE_layer_get_info_list(connection,ref ptr, ref num); //if (status != 0) //{ // return; //} //IntPtr* layerInfo = (System.IntPtr*)ptr.pointer[0]; //for (int i = 0; i < num; i++) //{ // call(layerInfo[i]); //} //if (num > 0) Wrapper10.SE_layer_free_info_list(num, ptr.pointer[0]); } } catch (Exception ex) { return; } }
public static SE_ERROR GetExtError(SE_CONNECTION connection) { SE_ERROR error = new SE_ERROR(); Int32 err_no = SE_connection_get_ext_error(connection, ref error); return(error); }
public static string[] TableNames(SE_CONNECTION connection) { try { unsafe { Pointer2Pointer ptr = new Pointer2Pointer(); System.Int32 num = 0; if (Wrapper10.SE_registration_get_info_list(connection, ref ptr, ref num) != 0) { return(null); } IntPtr *reginfo = (System.IntPtr *)ptr.pointer[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < num; i++) { Int32 result = Wrapper10.SE_reginfo_has_layer(reginfo[i]); if (result != 0) { byte[] buffer = new byte[CONST.SE_QUALIFIED_TABLE_NAME]; Wrapper10.SE_reginfo_get_table_name(reginfo[i], buffer); string table = System.Text.Encoding.ASCII.GetString(buffer).Replace("\0", ""); sb.Append(table); /* * buffer = new byte[CONST.SE_MAX_DESCRIPTION_LEN]; * Wrapper10.SE_reginfo_get_description(reginfo[i], buffer); * string descr = System.Text.Encoding.ASCII.GetString(buffer).Replace("\0", ""); * sb.Append(" ("+descr+")" + ";"); * */ } Wrapper10.SE_reginfo_free(reginfo[i]); } return(sb.ToString().Split(';')); } } catch (Exception ex) { return(null); } }
public static string GetErrorMsg(SE_CONNECTION connection, Int32 err_no) { try { byte[] buffer = new byte[CONST.SE_MAX_MESSAGE_LENGTH]; if (SE_connection_get_error_string(connection, err_no, buffer) == 0) { return(ASCIIEncoding.ASCII.GetString(buffer).Replace("\0", "")); } else { return("SDE ERROR: Unknown sde error!!"); } } catch (Exception ex) { return("SDE ERROR: GetErrorMsg - " + ex.Message); } }
public static extern System.Int32 SE_layer_get_info_list(SE_CONNECTION connection, ref IntPtr layer_list, ref System.Int32 count_addr);
public static extern System.Int32 SE_registration_get_info(SE_CONNECTION connection, string table, IntPtr reginfo);
public static extern System.Int32 SE_registration_get_info_list(SE_CONNECTION connection, ref Pointer2Pointer reg_list_addr, ref System.Int32 count_addr);
public static string GetErrorMsg(SE_CONNECTION connection, SE_ERROR error) { return(GetErrorMsg(connection, error.sde_error)); }
public static extern System.Int32 SE_connection_get_ext_error(SE_CONNECTION connection, ref SE_ERROR error);
public static extern System.Int32 SE_connection_get_error_string(SE_CONNECTION connection, System.Int32 error_code, [MarshalAs(UnmanagedType.LPArray)] byte[] error_string);
public static extern System.Int32 SE_stream_create(SE_CONNECTION connection, ref SE_STREAM stream);
public static extern System.Int32 SE_connection_free(SE_CONNECTION conn);
public static extern System.Int32 SE_table_describe(SE_CONNECTION connection, string table, ref System.Int16 num_columns, ref IntPtr column_defs);
public static extern System.Int32 SE_layer_get_info(SE_CONNECTION connection, string table, string column, SE_LAYERINFO layer);
public static extern System.Int32 SE_connection_create(string server, string instance, string database, string username, string password, ref SE_ERROR error, ref SE_CONNECTION conn);