示例#1
0
        public DuckDBDataReader(DuckDbCommand command, CommandBehavior behavior)
        {
            this.command  = command;
            this.behavior = behavior;

            var state = PlatformIndependentBindings.NativeMethods.DuckDBQuery(command.DBNativeConnection, command.CommandText, out queryResult);

            if (state.IsSuccess())
            {
                FieldCount = (int)queryResult.ColumnCount;
            }
            else
            {
                throw new DuckDBException("DuckDBQuery failed", state);
            }
        }
示例#2
0
        public DuckDBDataReader(DuckDbCommand command, CommandBehavior behavior)
        {
            this.command  = command;
            this.behavior = behavior;

            using var unmanagedString = command.CommandText.ToUnmanagedString();
            var state = PlatformIndependentBindings.NativeMethods.DuckDBQuery(command.DBNativeConnection, unmanagedString, out queryResult);

            if (!string.IsNullOrEmpty(queryResult.ErrorMessage))
            {
                throw new DuckDBException(queryResult.ErrorMessage, state);
            }

            if (!state.IsSuccess())
            {
                throw new DuckDBException("DuckDBQuery failed", state);
            }

            HasRows    = queryResult.RowCount > 0;
            FieldCount = (int)queryResult.ColumnCount;
        }