Exemplo n.º 1
0
        public static int cci_execute_batch(int conn_handle, string[] sql_stmt, ref T_CCI_QUERY_RESULT[] query_result, ref T_CCI_ERROR err_buf)
        {
            IntPtr qr_ptr     = IntPtr.Zero;
            int    n_executed = cci_execute_batch_internal(conn_handle, sql_stmt.Length, sql_stmt, ref qr_ptr, ref err_buf);

            if (n_executed < 0)
            {
                query_result = null;
            }
            else
            {
                query_result = new T_CCI_QUERY_RESULT[n_executed];
                for (int i = 0; i < n_executed; i++)
                {
                    T_CCI_QUERY_RESULT tmp = (T_CCI_QUERY_RESULT)Marshal.PtrToStructure((IntPtr)((UInt32)qr_ptr + i * Marshal.SizeOf(typeof(T_CCI_QUERY_RESULT))), typeof(T_CCI_QUERY_RESULT));
                    query_result[i] = tmp;
                }
                cci_query_result_free(qr_ptr, n_executed);
            }
            return(n_executed);
        }
Exemplo n.º 2
0
 public static int cci_execute_batch(int conn_handle, string[] sql_stmt, ref T_CCI_QUERY_RESULT[] query_result, ref T_CCI_ERROR err_buf)
 {
     IntPtr qr_ptr = IntPtr.Zero;
     int n_executed = cci_execute_batch_internal(conn_handle, sql_stmt.Length, sql_stmt, ref qr_ptr, ref err_buf);
     if (n_executed < 0)
     {
         query_result = null;
     }
     else 
     {
         query_result = new T_CCI_QUERY_RESULT[n_executed];
         for (int i = 0; i < n_executed; i++) {                    
             T_CCI_QUERY_RESULT tmp = (T_CCI_QUERY_RESULT) Marshal.PtrToStructure((IntPtr)((UInt32)qr_ptr + i * Marshal.SizeOf(typeof(T_CCI_QUERY_RESULT))), typeof(T_CCI_QUERY_RESULT));
             query_result[i] = tmp;
         }
         cci_query_result_free(qr_ptr, n_executed);
     }
     return n_executed;
 }