Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/LightningDB.Tests/TransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void can_get_transaction_id()

env.RunTransactionScenario((tx, _) =>
{
tx.Id.ShouldBeGreaterThan(0);
tx.Id.ShouldBeGreaterThan((nuint)0);
});
}

Expand Down
6 changes: 4 additions & 2 deletions src/LightningDB/LightningCursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,11 @@ public MDBResultCode Renew(LightningTransaction txn)
/// </summary>
/// <param name="value">Output parameter where the duplicate count will be stored.</param>
/// <returns>Returns <see cref="MDBResultCode"/></returns>
public MDBResultCode Count(out int value)
public MDBResultCode Count(out long value)
{
return mdb_cursor_count(_handle, out value);
var result = mdb_cursor_count(_handle, out var count);
value = checked((long)count);
return result;
}

private bool ShouldCloseCursor()
Expand Down
2 changes: 1 addition & 1 deletion src/LightningDB/LightningTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public Stats GetStats(LightningDatabase db)
/// <summary>
/// Gets the transaction ID.
/// </summary>
public int Id => mdb_txn_id(_handle);
public nuint Id => mdb_txn_id(_handle);

/// <summary>
/// Compares two data items according to the database's key comparison function.
Expand Down
8 changes: 4 additions & 4 deletions src/LightningDB/Native/Lmdb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static partial class Lmdb
/// <returns>The transaction ID</returns>
[LibraryImport(MDB_DLL_NAME)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int mdb_txn_id(nint txn);
public static partial nuint mdb_txn_id(nint txn);

/// <summary>
/// Commits all the operations of a transaction into the database.
Expand Down Expand Up @@ -388,7 +388,7 @@ public static partial class Lmdb
/// <returns>A result code indicating success or failure</returns>
[LibraryImport(MDB_DLL_NAME)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial MDBResultCode mdb_cursor_count(nint cursor, out int countp);
public static partial MDBResultCode mdb_cursor_count(nint cursor, out nuint countp);

/// <summary>
/// Stores key/data pairs in a database.
Expand Down Expand Up @@ -872,7 +872,7 @@ internal static MDBResultCode mdb_env_open(nint env, string path, EnvironmentOpe
/// <param name="txn">A transaction handle</param>
/// <returns>The transaction ID</returns>
[DllImport(MDB_DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
public static extern int mdb_txn_id(nint txn);
public static extern nuint mdb_txn_id(nint txn);

/// <summary>
/// Commits all the operations of a transaction into the database.
Expand Down Expand Up @@ -1040,7 +1040,7 @@ public static MDBResultCode mdb_env_copy2(nint env, string path, EnvironmentCopy
/// <param name="countp">Address where the count will be stored</param>
/// <returns>A result code indicating success or failure</returns>
[DllImport(MDB_DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
public static extern MDBResultCode mdb_cursor_count(nint cursor, out int countp);
public static extern MDBResultCode mdb_cursor_count(nint cursor, out nuint countp);

/// <summary>
/// Stores key/data pairs in a database.
Expand Down