Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed blobs greater than 65535 bytes #161

Merged
merged 1 commit into from
Nov 27, 2024
Merged
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
21 changes: 12 additions & 9 deletions rsfbclient-native/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,18 @@ fn binary_to_blob<T: IBase>(
// Assert that the handle is valid
debug_assert_ne!(handle, 0);

unsafe {
if ibase.isc_put_segment()(
&mut status[0],
&mut handle,
bytes.len() as u16,
bytes.as_ptr() as *mut std::os::raw::c_char,
) != 0
{
return Err(status.as_error(ibase));
// Max segment size: 65535
for b in bytes.chunks(65535) {
unsafe {
if ibase.isc_put_segment()(
&mut status[0],
&mut handle,
b.len() as u16,
b.as_ptr() as *mut std::os::raw::c_char,
) != 0
{
return Err(status.as_error(ibase));
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/tests/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@

let rstr: Vec<u8> = rand::thread_rng()
.sample_iter::<u8, _>(Standard)
.take(10000)
.take(1024 * 1024)
.collect();

conn.execute("DROP TABLE PBIGBLOBBIN", ()).ok();
Expand All @@ -261,7 +261,7 @@

let rstr: String = rand::thread_rng()
.sample_iter::<char, _>(Standard)
.take(10000)
.take(1024 * 1024)
.collect();

conn.execute("DROP TABLE PBIGBLOBTEXT", ()).ok();
Expand All @@ -284,7 +284,7 @@

conn.execute(
"insert into pdates (ref, a) values ('a', ?)",
(NaiveDate::from_ymd(2009, 8, 7),),

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / embedded (linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / embedded (dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 287 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead
)?;
let val_exists: Option<(i16,)> = conn.query_first(
"select 1 from pdates where ref = 'a' and a = '2009-08-07'",
Expand All @@ -294,7 +294,7 @@

conn.execute(
"insert into pdates (ref, b) values ('b', ?)",
(NaiveDate::from_ymd(2009, 8, 7).and_hms(11, 32, 25),),

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / embedded (linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / embedded (dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, linking)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, dynamic_loading)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, linking)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, dynamic_loading)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, linking)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, dynamic_loading)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, linking)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 297 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, dynamic_loading)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead
)?;
let val_exists: Option<(i16,)> = conn.query_first(
"select 1 from pdates where ref = 'b' and b = '2009-08-07 11:32:25'",
Expand All @@ -304,7 +304,7 @@

conn.execute(
"insert into pdates (ref, c) values ('c', ?)",
(NaiveTime::from_hms(11, 22, 33),),

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, linking)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, dynamic_loading)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, linking)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, dynamic_loading)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, linking)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, dynamic_loading)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, linking)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead

Check warning on line 307 in src/tests/params.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, dynamic_loading)

use of deprecated associated function `chrono::NaiveTime::from_hms`: use `from_hms_opt()` instead
)?;
let val_exists: Option<(i16,)> = conn.query_first(
"select 1 from pdates where ref = 'c' and c = '11:22:33'",
Expand Down
4 changes: 2 additions & 2 deletions src/tests/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

let rvec: Vec<u8> = rand::thread_rng()
.sample_iter(Standard)
.take(10000)
.take(1024 * 1024)
.collect();

conn.execute("DROP TABLE RBIGBLOBBIN", ()).ok();
Expand All @@ -187,7 +187,7 @@

let rstr: String = rand::thread_rng()
.sample_iter::<char, _>(Standard)
.take(10000)
.take(1024 * 1024)
.collect();

conn.execute("DROP TABLE RBIGBLOBTEXT", ()).ok();
Expand Down Expand Up @@ -224,7 +224,7 @@
(),
)?
.unwrap();
assert_eq!(NaiveDate::from_ymd(2010, 10, 10), a);

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v3, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v2, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (ubuntu-20.04, v4, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, linking)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead

Check warning on line 227 in src/tests/row.rs

View workflow job for this annotation

GitHub Actions / testing (windows-latest, v5, dynamic_loading)

use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead
assert_eq!(NaiveDate::from_ymd(2010, 10, 10).and_hms(10, 10, 10), b);
assert_eq!(NaiveTime::from_hms(10, 10, 10), c);

Expand Down
Loading