1
0

SqliteInventory.pl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/perl
  2. # -- CREATE TABLE inventoryitems(UUID varchar(255) primary key,
  3. # -- assetID varchar(255),
  4. # -- assetType integer,
  5. # -- invType integer,
  6. # -- parentFolderID varchar(255),
  7. # -- avatarID varchar(255),
  8. # -- creatorsID varchar(255),
  9. # -- inventoryName varchar(255),
  10. # -- inventoryDescription varchar(255),
  11. # -- inventoryNextPermissions integer,
  12. # -- inventoryCurrentPermissions integer,
  13. # -- inventoryBasePermissions integer,
  14. # -- inventoryEveryOnePermissions integer);
  15. # -- CREATE TABLE inventoryfolders(UUID varchar(255) primary key,
  16. # -- name varchar(255),
  17. # -- agentID varchar(255),
  18. # -- parentID varchar(255),
  19. # -- type integer,
  20. # -- version integer);
  21. my $items = "INSERT INTO InventoryItems(ID, AssetID, AssetType, InvType, Folder, Owner, Creator, Name, Description, NextPermissions, CurrentPermissions, BasePermissions, EveryOnePermissions) ";
  22. my $folders = "INSERT INTO InventoryFolders(ID, Name, Owner, ParentID, Type, Version) ";
  23. open(SQLITE, "sqlite3 inventoryStore.db .dump |") or die "can't open the database for migration";
  24. open(WRITE,"| sqlite3 Inventory.db");
  25. while(my $line = <SQLITE>) {
  26. $line =~ s/([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})/$1-$2-$3-$4-$5/g;
  27. if($line =~ s/(INSERT INTO "inventoryitems")/$items/) {
  28. print $line;
  29. print WRITE $line;
  30. }
  31. if($line =~ s/(INSERT INTO "inventoryfolders")/$folders/) {
  32. print $line;
  33. print WRITE $line;
  34. }
  35. }
  36. close(WRITE);
  37. close(SQLITE);