0

What's the best place to ask this question?:

I have a database that serves up the content for what will be a public website. In this site, certain users that work for our organization will be able to use a partial CMS I have built to change the contents of many of the pages.

My concern is this:

During the "Save" process, AJAX makes a round-trip to the server, and while there, nullifies the page locations of the appropriate page (so as to reuse the id), then immediately afterwards re-saves the new values to the page. Reading content from a NULL location will not cause errors or anything; it simply won't show up on the page.

I really don't mean to pick this apart too much but I am concerned that I might accidentally be setting myself up for error. My question is: Should I worry about the fraction of a second between nullifying the locations of content and when the new content gets saved?

Again, it is fault tolerant as much as possible, and I wouldn't expect to see any YSODs or anything, but what if they get no content, simply because somebody looked up the page, and it happened to be timed just right to "get in" and get the values from the database just when someone was saving edits to the given page?

Anyway, I feel a little silly as I write this question, as if I am over-complicating the issue or perhaps worrying too much, but considering the cost if I'm wrong in my approach here, I was looking for some professional advice from anyone who has programmed CMS or CMS-like websites in the past.

Things You May Want to Know:

  1. I am in a C#.Net Web-Pages w/ WebMatrix environment (as opposed to Web-Forms or MVC).
  2. The command I am using to "nullify" the page location values looks like this: UPDATE ContentObjects SET location = NULL WHERE location = @0. Then, as soon as I programmatically can, I re-apply the values and repopulate the locations.

I was thinking super user, but then I thought about how much database information was in it, as well as an understanding of asp.net perhaps, so I'm really not sure what the best site to ask this on is.

9
  • Transactions... Oct 28, 2013 at 20:14
  • @allquixotic I'm sorry, but I don't see that one on any of the SE sites. Am I really missing it? I clicked all and even used the browser's Ctrl + F function
    – VoidKing
    Oct 28, 2013 at 20:19
  • I meant "Transactions" as in Database Transactions. Use them. You're right to be cautious about updating a database and creating a potential race condition where a client may be getting wrong data. Transactions are designed to address this. Issue multiple SQL statements in the context of a transaction, and only commit once the state is consistent. This is an okayish question for SuperUser, but you really don't need to ask it -- if you are worried enough to ask "should I be worried about", then the answer is always yes. It's how to deal with it that you need to care about. Oct 28, 2013 at 20:24
  • @allquixotic Okay, I see, well I am only just now hearing about this. I'm not sure what it even is at this point. Do you know of any good sites to introduce me to this?
    – VoidKing
    Oct 28, 2013 at 20:26
  • When in doubt, read Wikipedia. You didn't state which database product you're using, so it's impossible to provide more specific details. It's possible, but very unlikely, that your database implementation doesn't support transactions. Oct 28, 2013 at 20:28
  • @allquixotic Actually, I did, albeit indirectly. Using Web-Pages means I am using SQL server CE
    – VoidKing
    Oct 28, 2013 at 20:30
  • @allquixotic Well, maybe there are other options? Not sure, but anyway, thank you very much for your help. :)
    – VoidKing
    Oct 28, 2013 at 20:31
  • Transactions are supported in SQL Server CE (albeit with some limitations). For your use case I don't think the limitations will be a problem. I googled: "SQL Server CE transactions". This was the first hit. Oct 28, 2013 at 20:35
  • @allquixotic Thank you for pointing me in the right direction. It seems I have my work cut out for me here...
    – VoidKing
    Oct 28, 2013 at 20:38

1 Answer 1

2

I think this is more qualified for Stack Overflow, since it is to deal with how to program such a thing. They will have support for any language you are choosing to program with.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .