Aller au contenu

Photo

Please help. Unable to save resource data to the database. Duplicate key?


  • Veuillez vous connecter pour répondre
11 réponses à ce sujet

#1
Charsen

Charsen
  • Members
  • 2 266 messages
I just reinstalled my entire toolset and SQL database. Again. Twice today, now, three times this week. At first it fixed my errors, but now it's back, and no amount of uninstalling/reinstalling is helping. 

Anytime I make any edit on any existing .dlg file (imported or not) by adding a simple line, I get the following error: 

Unable to save resource data to the database.
Resource can not be saved.

Posted Image

after 2nd full uninstall/reinstall, plus resetting string to 0:

Posted Image

Windows 7, 64bit, Toolset 1.0.1008.0

ERROR, "d:\\\\\\\\DASecuROMBuild\\\\\\\\main\\\\\\\\dev\\\\\\\\tools\\\\\\\\sdk\\\\\\\\include\\\\\\\\toolsoledb.h", 226, "Violation of PRIMARY KEY constraint 'PK_t_String'. Cannot insert duplicate key in object 'dbo.t_String'."

ERROR, ".\\\\\\\\dbstring.cpp", 267, "CDBString::Add caught an exception: Bad HRESULT: 80040e2f"

ERROR, ".\\\\\\\\toolsoledb.cpp", 971, "Tools::DBTransaction::~Tools::DBTransaction: Abort failed."

ERROR, ".\\\\\\\\dbbase.cpp", 918, "CDBBase::Write caught an exception: Could Not add new String to DB.Text: TestDescription: "

ERROR, ".\\\\\\\\ResourceIOBase.cpp", 756, "ResourceIOBase::WriteResourceInternal caught an exception: Unable to save to the database the resource ""party_events"" in campaign 2."

ERROR, ".\\\\\\\\toolsoledb.cpp", 971, "Tools::DBTransaction::~Tools::DBTransaction: Abort failed."

I have been plagued by this error ever since I started modding dialogue files.

I need to know how to get rid of it permanently. Someone has to know.

I need some help here, or I really have to give up and move on to some other game that has a toolset that works for me. Please.. I'd rather like to finish my mod, this error has been preventing me from finishing it for weeks. You have no idea how much time I've wasted on this POS error.
:(

edit:
Here are my previous threads on pretty much the same issue showing i've been unable to solve this for over a month.
1+ month ago, no replies

1 month ago, no solution (my "solution" doesn't work for me now)

Just yesterday, no solution

other threads with similar issues:
looks promising, though not sure if the solution will apply

Increasing strings? I set my beginning to 0, to no avail. Not sure what range they are talking about.

Modifié par Charsen, 10 mai 2010 - 06:26 .


#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
The t_String table has a primary key set on the ID column, which is the string ID.

So, if you try to write a string with a string ID already present in the table, you will get this error. This will typically happen when you set your string ID ranges to overlap that of another module (in this case Single Player).

You should be able to work with whatever string ID range your module defaults to and edit the party_events dialogue and add lines. There should be no need to change String ID ranges.
Just to make sure, I just edited that conversation from a new module and saved it fine. The newly added line has a string ID that is associated with my module while the other string IDs in the conversation are owned by the Single Player campaign. I even changed one of the plot actions in that conversation and again, it saved fine.

When you say you reinstalled the toolset and SQL Server, did you restore the database too? If not, it might already have some corrupted/unwanted entries preventing you from saving.

Modifié par TimelordDC, 10 mai 2010 - 06:41 .


#3
Charsen

Charsen
  • Members
  • 2 266 messages
Yes, sadly the problem is that I am not doing anything with strings. Something is seriously wrong here. Let me explain from the beginning.

uninstalled the toolset & SQL so it should have uninstalled the database too.  

I selected remove/remove in the uninstall. 

Every time the SQL Server (BWDATOOLSET) was still running despite all toolset/game/mod managers being closed, so i went into Services to stop it manually

I checked to make sure the DAODB folder was gone from my system, which it was.

When installing the toolset a second time, I selected both: * Install the MS SQL Express 2005 SP3 * Restore the default database* use default settings

Upon opening the toolset, I get the usual error after an uninstall/reinstall:
"The identified module can not be found in the database. Do you wish to open the default module instead?"
[Yes]

Posted Image
Hierarchy set to Single Player

I check out party_events and make a small edit (add a line). This is fine.

However when I import party_events from my recent backup, that is where the problem infects my database.

My import screen
Import was successful


Made a small edit to party_events.dlg and it has the error again.
Now any edit made to any dialogue file has the same error.

Modifié par Charsen, 10 mai 2010 - 10:44 .


#4
tmp7704

tmp7704
  • Members
  • 11 156 messages

Charsen wrote...

Yes, sadly the problem is that I am not doing anything with strings.

Something to keep on mind, each new line which you add to dialogue file means generating another ID and associated string. I don't know how likely it is, but there might be ID conflict of this nature happening i.e. the file backup you're importing has a line with conflicting ID?

Just to check, does the problem persist if you try to create an entirely new project, check out untouched piece of dialogue, just change some existing line and try to save/export that?

Modifié par tmp7704, 10 mai 2010 - 11:28 .


#5
TimelordDC

TimelordDC
  • Members
  • 923 messages
Since the problem seems to happen only when you import from your backup, here's a few options you can try:

1. Right-click the imported party_events and see what are the Owner Module and Module fields. They should both be Single Player.

2. Import the party_events dlg, check it in, check it out and then, try editing

3. Import the party_events dlg with Create New Strings selected instead of Use Theirs and see if the problem still happens.



As for the error with any dialog, here is what I think happens (pure conjecture):

When you import with Use Theirs and make an edit, somehow the string reference inside is screwed up -> instead of using the (StringID Last Used + 1) from your module, it is attempting to use the (StringID Last Used in the convo + 1) and throws that error. Further, that reference is retained and any subsequent edit you do is using that same incorrect StringID reference.

#6
Charsen

Charsen
  • Members
  • 2 266 messages
tmp: here seems to be the problem.

I did a full uninstall/reinstall. I opened the default party_events.dlg and made one edit (added a line) and saved, closed.

Did a full B2B create.

Loaded my B2B with Create New.

It failed to create my new Party_events_1.dlg file entirely! It's a Root with no child branches.



timelord:

1. Both are set to Single Player

2. (did a full uninstall/reinstall before doign this one) = Same problem

3. Interestingly, if I try to import party_events and Create New, it fails the import entirely. Everything else creates fine but I cannot create a new party_events_1 successfully. However I can now edit the party_events.dlg (original game file, not mine)...



I agree Timelord, it seems like it's using the stringID in the conversation, but how does this constantly happen? I just want to avoid it. XD It seems like this randomly happens and ruins my work constantly ... even my backups are ruined like this.



So this leads me to think it's yet again an SQL permissions issue perhaps? What else could it be?

#7
tmp7704

tmp7704
  • Members
  • 11 156 messages
It would appear the issue is somehow related to either import or export through Builder functions (or both) Seeing how it generally fails to restore data from builder package, either because it didn't properly create it in the first place or it has issues restoring the content from it?

#8
Charsen

Charsen
  • Members
  • 2 266 messages
I suppose so.. i am still leaning towards SQL permissions to insert an entry in the database, considering my previous troubles with SQL.

#9
Charsen

Charsen
  • Members
  • 2 266 messages
Another possibility is this:



When i attached the speaklines to the cutscenes, I selected the party_events dialogue and then selected the first blank line. Then associated the cutscene to the dialogue line.



Perhaps the first blank line i selected was a bad line ID in some way?



I was able to do a B2B of the dialogue file if the cutscenes were not associated.



*still trying to figure this out....* =/

#10
tmp7704

tmp7704
  • Members
  • 11 156 messages
If i remember right there's a mention somewhere (the Wiki?) that for technical reasons a cutscene can be associated with dialogue only once. As in, one cutscene shouldn't be attached to multiple dialogue lines. That's probably a reason why some basic cutscenes come as multiple instances, often differing just by the id number added to their name.

I guess rather than "Associate" it may be safer to use "Convert line to cutscene" instead to generate a new cutscene for your line and then copy&paste content of existing cutscene into it.

Modifié par tmp7704, 12 mai 2010 - 02:11 .


#11
Charsen

Charsen
  • Members
  • 2 266 messages
Yes -- each of my cutscenes only have 1 speakline which references the topmost empty ID... but many of my cutscenes might use the same line referenced line.

I might do a convert if using unique speakline references doesn't work... Converting is just such a ridiculous hassle though considering everything that would need to be copied individually, from scene properties to actors to individual tracks... bleh. last resort really. Maybe i'll do it for my new scenes, but converting old ones would just be a nightmare.

And ... I'm not even sure the speakline thing is the fault here, but what else could it be? SQL something er other, I suppose. Seems unlikely.

However, a friend of mine is working on a B2B string id tool that sounds like it could help out.. fingers crossed!

If i ever figure out anything with this error, i'll post here again with any info. Hopefully this will be of use to someone, sometime, i guess.

And hey, maybe it will be addressed later in some future awesome toolset update... =P

Anyway, thanks for your help, tmp and timelord. :D

Modifié par Charsen, 12 mai 2010 - 02:50 .


#12
tmp7704

tmp7704
  • Members
  • 11 156 messages

Charsen wrote...

Yes -- each of my cutscenes only have 1 speakline which references the topmost empty ID... but many of my cutscenes might use the same line referenced line.

Having more than one cutscene use the same line of dialogue seems to work ok, even the default game has that (multiple kiss scenes all saying the same thing, e.g.) but i guess there can be some 'gotcha' in the way the association is initially created.

I might do a convert if using unique speakline references doesn't work... Converting is just such a ridiculous hassle though considering everything that would need to be copied individually, from scene properties to actors to individual tracks... bleh. last resort really. Maybe i'll do it for my new scenes, but converting old ones would just be a nightmare.

Nah it can be pretty fast. Use left click then shift-left click to select all items from your scene but the Master object and the audio items, in the item list. You can also use ctrl+left click to select individual items. Right-click "Copy" that selection. Go to your new scene, right-click the item list and "Clone Clipboard Actor". That's bulk of your scene clone in single step. You'll then need to copy/paste the additional tracks of the Master object and fix the Active Camera track by hand (and add the sound effect tracks by hand) but it's not much work unless the scene is very complicated. Posted Image