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); } }
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; }