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

Cannot read a table with a byte field #218

Closed
ellis2323 opened this issue May 19, 2022 · 10 comments · Fixed by #222
Closed

Cannot read a table with a byte field #218

ellis2323 opened this issue May 19, 2022 · 10 comments · Fixed by #222
Assignees
Labels
bug Something isn't working

Comments

@ellis2323
Copy link

ellis2323 commented May 19, 2022

I'm trying to read the table tRelais in this mdb:
https://u.pcloud.link/publink/show?code=XZu5EHVZVqot9BBBU7FMwQHIVSJ4zHIwB9i7

If I read this table with "sysinfotool MDB file viewer 20.0", I read a full table with no empty data. But, if I read with this library, I found many empty object:

{NoEngageRelais: 1487, NoEngagement: 44242, NoSerieTour: 8096, NoAthlete: 13310, NoOrdreRelais: null}
{NoEngageRelais: 1488, NoEngagement: 44242, NoSerieTour: 8096, NoAthlete: null, NoOrdreRelais: null} ...

The field NoOrdreRelais has the type octet in french language... It is a small int with 8bits.

My script:

function loadRelais (reader) {
  let cmtrelays = new Map()
  const table = reader.getTable('tRelais')
  let rows = table.getData()
  for (let row of rows) {
    console.log(row)
    let uid = row.NoEngageRelais
    let noEngagement = row.NoEngagement
    let serieTour = row.NoSerieTour
    let athUID = row.NoAthlete
    let ord = row.NoOrdreRelais
    cmtrelays.set(uid, { uid, noEngagement, serieTour, athUID, ord })
  }
  return cmtrelays
}
@ellis2323 ellis2323 changed the title Cannot read a table Cannot read a table with a byte field May 19, 2022
@andipaetzold andipaetzold added the bug Something isn't working label May 19, 2022
@andipaetzold andipaetzold self-assigned this May 19, 2022
@andipaetzold
Copy link
Owner

👋 Hello again,

I was able to reproduce the issue. The problem seems to be that that row thinks it has more variable columns than total columns.
How was this table created? Was there a lot of altering and moving of the columns? Are you able to reproduce such broken table from scratch?

I'll hope I find time next week to investigate this further. There seems to be a related issue when only a subset of columns is read...

@ellis2323
Copy link
Author

Hello,

This table is created by an access application developed by a french company 20 years ago and maintained until now. When you say "only a subset of columns is read", which alternative is available ?

@andipaetzold
Copy link
Owner

20 years ago and maintained until now.

Yeah, I noticed that. Can't even open the file in a current Microsoft Access :(

When you say "only a subset of columns is read", which alternative is available ?

This is probably unrelated to your problem. It might lead to the same result (null values), but when calling getData() with a columns option. I need to do more investigation around this.

I don't see any workaround at the moment.

@ellis2323
Copy link
Author

ellis2323 commented May 20, 2022

I've a computer with XP and Access97. This table is the one with this short int of one byte. Are you sure this type of data is well read ?

@andipaetzold
Copy link
Owner

Yes, the column definitions are read correctly. If not, you would get null everywhere.

The issue is that fixedColumnCount becomes a negative number (

const fixedColumnCount = totalVariableCount - variableColumnCount;
) because variableColumnCount is greater than totalVariableCount. If that happens, we end up in the else branch (

mdb-reader/src/Table.ts

Lines 350 to 352 in a9847d6

start = 0;
value = null;
size = 0;
) when reading the row and the value becomes null.

@ellis2323
Copy link
Author

Hello,

When i read this table, I miss 1 column (NoOrdreRelais) for the first row, then I miss two columns (NoAthlete, NoOrdreRelais), then 3 columns (NoSerieTour, NoAthlete, NoOrdreRelais), then 4 columns and then it loop again with one column missing, then two.... The written values are correct.

relais {
NoEngageRelais: 228,
NoEngagement: 1222,
NoSerieTour: 444,
NoAthlete: 666,
NoOrdreRelais: null
}
relais {
NoEngageRelais: 229,
NoEngagement: 1222,
NoSerieTour: 444,
NoAthlete: null,
NoOrdreRelais: null
}
relais {
NoEngageRelais: 230,
NoEngagement: 1222,
NoSerieTour: null,
NoAthlete: null,
NoOrdreRelais: null
}
relais {
NoEngageRelais: 231,
NoEngagement: null,
NoSerieTour: null,
NoAthlete: null,
NoOrdreRelais: null
}

@ellis2323
Copy link
Author

The table in Access97 have 5 fields:

  • NoEngageRelais: AutoNumber
  • NoEngagement: Numeric
  • NoSerieTour: Numeric
  • NoAthlete: Numeric
  • NoOrdreRelais: Numeric

All columns are defined and set.

@ellis2323
Copy link
Author

I have installed mdb-tools in a VM and I can read the data:

mdb-export /mnt/c/Users/laure/Downloads/nxtcrsu.nxt tRelais
NoEngageRelais,NoEngagement,NoSerieTour,NoAthlete,NoOrdreRelais
228,1222,444,666,1
229,1222,444,791,2
230,1222,444,639,3
231,1222,444,612,4
232,1223,445,782,1
233,1223,445,780,2
234,1223,445,752,3
235,1223,445,795,4
236,1226,444,624,1
237,1226,444,609,2
238,1226,444,634,3
239,1226,444,626,4
240,1226,476,624,1
241,1226,476,609,2
242,1226,476,634,3
243,1226,476,626,4
244,1222,476,666,1
245,1222,476,791,2
246,1222,476,639,3
247,1222,476,612,4
248,1223,477,782,1
249,1223,477,780,2
250,1223,477,752,3
251,1223,477,795,4

@andipaetzold
Copy link
Owner

I think I found the issue. Seems like this was just a small mistake in the Jet3 format configuration.
The new version should release any minute. Please let me know if you still run into issues with the latest update.

@ellis2323
Copy link
Author

Hello,

I tried this morning and everything is ok. Good job.

Thanks for your great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants