čaute protřebuju script na zapisování do record store mám tenhle script
public int setDB(String nameDB, String value){
RecordStore rs = null;
byte[] name = null;
boolean existingOrNot = false;
boolean OK = true;
existingOrNot = existing(nameDB);
if (existingOrNot) {
try {
rs = RecordStore.openRecordStore(nameDB, false);
} catch (Exception e) {
OK = false;
} finally {
if (OK) {
//aTextBox.setString("Ok");
} else {
//aTextBox.setString("Failed");
}
}
} else {
try {
rs = RecordStore.openRecordStore(nameDB, true);
} catch (Exception e) {
OK = false;
} finally {
if (OK) {
//aTextBox.setString("Ok");
} else {
//aTextBox.setString("Failed");
}
}
}
if (OK) {
try {
//for (int i = 1; i <= 3; i++) {
name = value.getBytes();
rs.addRecord(name, 0, name.length);
//}
} catch (Exception e) {
//aTextBox.setString("Add Falied");
}
try {
rs.deleteRecord(2);
//aTextBox.setString("recordID Delete");
} catch (InvalidRecordIDException e) {
// try {
// //aTextBox.setString(rs.getNumRecords() + "recordID");
// } catch (RecordStoreNotOpenException rse) {
// }
} catch (RecordStoreException e) {
} finally {
try {
rs.closeRecordStore();
} catch (Exception e) {
}
}
}
return 1;//rs.getNumRecords();
}
public boolean existing(String recordStoreName) {
boolean existingOrNot = false;
RecordStore rs = null;
if (recordStoreName.length() > 32)
return false;
try {
rs = RecordStore.openRecordStore(recordStoreName, false);
} catch (RecordStoreNotFoundException e) {
existingOrNot = false;
} catch (Exception e) {
} finally {
try {
rs.closeRecordStore();
} catch (Exception e) {
}
}
return existingOrNot;
}
ale nevím no nějak nefunguje nevíte zda to je dobře a nebo to je blbě ? dík