Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. pragma solidity ^0.4.0;
  2. contract ABC{
  3. uint i;
  4. uint rowCount = 0;
  5. User userObj;
  6.  
  7. function ABC() {}
  8. struct User{
  9. uint rowCount;
  10. string id;
  11. string ABCData;
  12. string DEFData;
  13. ......
  14. ......
  15. ......
  16. around 20 variables.
  17. }
  18.  
  19. mapping(uint => User) ABClist;
  20. function setABCData(string uid,string ABCData,string DEFData,........) {
  21.  
  22. rowCount = rowCount + 1;
  23. ABClist[rowCount].rowCount = rowCount;
  24. ABClist[rowCount].id = uid;
  25. ABClist[rowCount].ABCData = ABCData;
  26. ABClist[rowCount].DEFData = DEFData;
  27. ...........
  28. ...........
  29. ...........
  30. ...........
  31.  
  32. }
  33.  
  34.  
  35.  
  36. function getABCData(string uid) constant returns ( string _id, string _ABCData, string _DEFData, ........)
  37. {
  38. uint rowNumber;
  39. for(i = 0; i <=rowCount; i++){
  40. if(stringsEqual(ABClist[i].id, uid) || stringsEqual(ABClist[i].ABCData, uid) || stringsEqual(ABClist[i].DEFData, uid)){
  41. userObj.id = ABClist[i].id;
  42. userObj.ABCData = ABClist[i].ABCData;
  43. userObj.DEFData = ABClist[i].DEFData;
  44. rowNumber = i;
  45. }
  46. }
  47. return (userObj.id, userObj.ABCData, userObj.DEFData, rowNumber);
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement