Re: Re[2]: transaction support
Quoting DeBug [EMAIL PROTECTED]: [MySQL] 1: START TRANSACTION 2: WITHDRAW $50 from account 32146. 3: DEPOSIT $50 into account 12345. 4: LOG transfer (date/time/teller/etc...) for auditing. 5: COMMIT TRANSACTION DK It depends why step 3 failed. DK If you want to rollback the transaction to the beginning on any error, DK you simply use an 'on error' statement in VB to trap the error, and send DK a rollback command when the error is detected. And what if the server lost connection with client computer ? there must be automatic rollback after certain 'time-out' period Data integrity logic should be ensured by client application (when to call 'start transaction' and when to call 'commit'), the server task is to ensure that logic - i.e. that at any given moment users see the database in integrity state and not at some point within transaction processing. If user has not commited transaction the database integrity state is still at the point before start transaction was called. My $0.02 I have to disagree - especially when money is involved. To have the client define, check data integrity, and manipulate data in the database is just asking for trouble. Call me paranoid, but to trust a client in a non-secure environment to directly access and manipulate the database is just asking for a reverse-engineered attack against the database where the data will be compromised. At the very least, you are sending out database connectivity information out with the client that can be stolen and used to access the database. Given the means and the business necessity, I feel that having some sort of middleware on a secured server to validate data and communicate with the database is a much more secure methodology. This is a trivial piece of middleware to write, but can add a much needed layer of security to transactions. Let the secure server hosted middleware host the database connections and let the client talk to the middleware. Not user but server is responsible for rolling back not commited transactions, user can only help relief the server from major part of this problem by trying to rollback as many failed transactions as he can. however user cannot be responsible for rolling back all the transactions -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Bet the Business
As I understand stored procedures: Stored procedures offer a level of performance that you normally can not replicate in code. The stored procedure actually has the query stored in the query parser ready to rumble. You do not have to invoke network or socket overhead in calling a long query and you do not have to invoke the query parser at each invocation of the procedure. Hopefully, the procedure takes advantages of the caches found in most database servers. Theoretically, the performance gains are tremendous if you can knock out network access and the CPU cycles of parsing the query. That being said, I am a fan of MySQL and would use it over MSSQL any day. Not having sub-selects, stored procedures, and until recently transaction support I have found programmatic methods to get around these issues. My experience has been this - let the application that is closest to the data do the manipulation. This is true if the primary purpose is to store, retrieve, and manipulate data. So, when MySQL supports stored procedures you will see, again, a jump in usability and performance. HTH Quoting [EMAIL PROTECTED]: Quoting robert_rowe [EMAIL PROTECTED]: I'm lead developer for a company that writes custom software for the mining industry. We support MSSQL and MySQL. I've found that from a programming aspect (VB + ADO) there is relatively little difference between MSSQL and MySQL. There is some sight syntax differences and MySQL versions 5.0 do not support stored procedures. We use the InnoDB table type for MySQL as it provides row level locking and transactions. Our largest client has about 1 gig of data and averages 125 users. I've found that MySQL usua lly out performs MSSQL if you tune it properly and use good programming techniques. It is less integrated with Microsoft products though so if your clients will be accessing the data via MS Office applications then MSSQL will seem easier. We offer both platforms mainly because a lot of IT managers are convinced that Microsoft solutions are the best even when benchmarks say different. I admit to dome degree I am one of the IT Managers - the it 'sounds to good to be true' syndrome I suppose. But I'm coming around. The decision will be for MSSQL Server due to us using other MS products and the supporting of one product, but I'm interested for future reference when it does become an option (probably other jobs). As an aside, stored procedures seem to be a big thing with some people, namely the MS people I encounter (the ASP.NET mantra of using stored procedures for all databases access and even processing tasks), yet people seem to get along with them fine, until recently, in MySQL. This makes me thing they may not be the holy grail people say they are...in MySQL, until recently, all SQL must have been done at the code level rather than at the database server level - is that a major issue? Does it even provide some advantages? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: FW: When inserting data it insert 2 records one correct and one blank!
Emilio- I ran into this problem just yesterday using some PHP code. The problem was in control logic. I executed the insert within an if statement, but failed to see that there was another mysql_query statement outside the if block. This caused the same insert to happen again. Basically, in psuedo code if (found){ query = INSERT mysql_query (query) } else { query = UPDATE mysql_query (query) } mysql_query(query) Stupid logic on my part. This doesn't adress the date being blank, but I would suggest reviewing your logic to see if there is a mysql_query that is being executed 2 times. My 2 cents... Quoting Dan Greene [EMAIL PROTECTED]: sending on to list while I think... ;) -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:34 AM To: Dan Greene Subject: RE: When inserting data it insert 2 records one correct and one blank! Ok, here it is the full statement: $sql = INSERT INTO llamadas (destinatario,fecha,hora,apellido,nombre,telefono,mail,receptor,mensaje) VALUES ('$destinatario','$fecha','$hora','$apellido','$nombre','$telefono','$mail','$re ceptor','$mensaje'); $result = mysql_query($sql); And, yes it happens to all users, and i ve tested pressing only once the submit button but i allways got 2 records add the first one is a blank one and the second the correct one. From: Dan Greene [EMAIL PROTECTED] To: Emilio Ruben Estevez [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: When inserting data it insert 2 records one correct and one blank! Date: Thu, 9 Oct 2003 10:09:00 -0400 Emilio, Can you supply the full insert statement? Also, is this happening for all users, or one in particular? I ask, as I've seen issues with web app users double-clicking the submit button causing similar issues -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:02 AM To: [EMAIL PROTECTED] Subject: When inserting data it insert 2 records one correct and one blank! Hi, I have a page on a intranet where workers can insert data into a database, the thing is that when they type the info an press submit the page use the INSERT INTO db then when i check the data in the database i can see the record that the user entered and a second record that is all in blank, exept for the date and time field that the value is -00-00 and 00:00:00. What´s wrong? maybe something of the date and time format?? Any Clue. Thanks. Emilio. _ Add MSN 8 Internet Software to your existing Internet access and enjoy patented spam protection and more. Sign up now! http://join.msn.com/?page=dept/byoa -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] _ High-speed Internet access as low as $29.95/month (depending on the local service providers in your area). Click here. https://broadband.msn.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Crash on mysql_real_connect on FreeBSD 4.7
Thank you for your direction. I posted on both lists under the hope that I could find someone out there with experience using the API - whether the C api or the C++ - and who may have encountered a similar problem. I have been googling for days and found mostly stuff related to PHP and MySQL, but very few items regarding the API. So, under good practice of researching the problem first and then turning to the lists for help I am doing that now. Hope someone out there has some insight and may be able to help me. Thanks in advance. --Original Message- -From: Sinisa Milivojevic [mailto:[EMAIL PROTECTED] -Sent: Saturday, July 19, 2003 6:19 AM -To: Matt Davies -Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] -Subject: Re: Crash on mysql_real_connect on FreeBSD 4.7 - - -On Fri, 18 Jul 2003 14:22:13 -0600 -Matt Davies [EMAIL PROTECTED] wrote: - - - Hey all, - - Have a very peculiar problem. First off - - - OS: FreeBSD 4.7 - MySQL version: Ver 12.20 Distrib 4.0.13, for unknown-freebsd4.7 (i386) - (I have also compiled 3.23.53) - - The problem: - I have written a class that connects to and disconnects from the - database. Everything works fine when I instantiate this class in another - class to do some work, but when that class instantiates yet another - class then it seems as though mysql_real_connect bombs, and I have a - core file. - - -This list is dedicated to MySQL++ API and you do not seem to be -using that one. - -Etiher write to [EMAIL PROTECTED] or use debugger to see what is -wrong with your program. - --- - -Regards, - --- -For technical support contracts, go to https://order.mysql.com/?ref=msmi - __ ___ ___ __ - / |/ /_ __/ __/ __ \/ /Mr. Sinisa Milivojevic [EMAIL PROTECTED] - / /|_/ / // /\ \/ /_/ / /__ MySQL AB -/_/ /_/\_, /___/\___\_\___/ Fulltime Developer and Support Coordinator - ___/ www.mysql.com Larnaca, Cyprus - --- -MySQL++ Mailing List -For list archives: http://lists.mysql.com/plusplus -To unsubscribe: -http://lists.mysql.com/[EMAIL PROTECTED] - -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Crash on mysql_real_connect on FreeBSD 4.7
Hey all, Have a very peculiar problem. First off - OS: FreeBSD 4.7 MySQL version: Ver 12.20 Distrib 4.0.13, for unknown-freebsd4.7 (i386) (I have also compiled 3.23.53) The problem: I have written a class that connects to and disconnects from the database. Everything works fine when I instantiate this class in another class to do some work, but when that class instantiates yet another class then it seems as though mysql_real_connect bombs, and I have a core file. In other works Works: class1 { function foo() { MYSQL mysql db.connect (mysql) } }; Does not work: Class1 { function foo() { Class2 cl2; cl2.fod() } } Class2 { function fod() { db.connect() } } I have done all sorts of debugging and inspection, but I am unable to figure out what is causing this. Please send any ideas. DB function is here. (mysql_ptr points to a valid MYSQL object elsewhere) MYSQL *DB::db_connect (MYSQL* mysql_ptr) { /* * connect to the database */ char msg_buffer[2000]; Log log; /* * initialize the MYSQL pointer */ mysql_ptr = mysql_init(mysql_ptr); if (mysql_ptr == NULL) { printf (ERROR: ptr is null!\n); } if (!(mysql_real_connect (mysql_ptr, borg.db_host, borg.db_username,\ borg.db_passwd, borg.db_name, atoi(borg.db_port), NULL, 0))) { memset (msg_buffer, 0, sizeof(msg_buffer)); sprintf (msg_buffer, ERROR: Failed to connect to database: Error: %s., mysql_error(mysql_ptr)); log.log_entry (0, msg_buffer); return NULL; } return mysql_ptr; }; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]