Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

SQL syntax for record locks ?????: msg#00222

db.maxdb

Subject: SQL syntax for record locks ?????

Hello everybody!

My application connects to a maxdb 7.5 database via odbc-driver
isolation level = commited
I have a special table autonum where i handle automatic counters (order
number,invoice number,...)

When inserting a new order record into the orders table the application
does:

Select lastnumber from autonum where searchid = 'order_number'
my_new_ordernumber = lastnumber + 1
update autonum set lastnumber=?my_new_ordernumber where searchid =
'order_number'
Insert into orders (orderno,.......) values(?my_new_orderno,......)

I don't know how to lock the selected record of the autonum tabled
between
selecting and updating

The select statement above from user1 should lock the record, so that
other users
doing the same select have to wait (will get no new order number) until
the update
of user1 is finished ???!!!

I tried:

"Select lastnumber from autonum where searchid = 'order_number' WITH
LOCK EXCLUSIVE" with no success ??

When testing user1 select (and wait, no update)
user2 select
User2 gets the same order_number as user1.

What is the correct syntax of the select commad, that will do the wanted
behavior ??

Best regards
Albert


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/maxdb?unsub=gcdm-maxdb@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo