List:Commits« Previous MessageNext Message »
From:andrey.hristov Date:November 4 2008 10:36am
Subject:bzr commit into connector-cpp-bzr branch (andrey.hristov:201)
View as plain text  
#At bzr+ssh://ahristov@stripped/bzrroot/public/connector-cpp-bzr/trunk/

  201 andrey.hristov@stripped	2008-11-04
      Add missing file
added:
  driver/mysql_util.h

=== added file 'driver/mysql_util.h'
--- a/driver/mysql_util.h	1970-01-01 00:00:00 +0000
+++ b/driver/mysql_util.h	2008-11-04 09:36:50 +0000
@@ -0,0 +1,67 @@
+/* Copyright (C) 2007 - 2008 MySQL AB, 2008 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   There are special exceptions to the terms and conditions of the GPL 
+   as it is applied to this software. View the full text of the 
+   exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this 
+   software distribution.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef _MYSQL_UTIL_H_
+#define _MYSQL_UTIL_H_
+
+namespace sql {
+namespace mysql {
+namespace util {
+
+template<typename T>
+class my_shared_ptr
+{
+public:
+
+	my_shared_ptr(): _ptr(NULL), ref_count(0) { }
+
+	my_shared_ptr(T * __p): _ptr(__p), ref_count(1) { }
+
+	void reset() { delete * _ptr; _ptr = NULL; }
+	void reset(T * new_p) { delete * _ptr; _ptr = new_p; }
+
+	T * get() const throw() { return _ptr; }
+
+	my_shared_ptr< T > * getReference() throw() { ++ref_count; return this; }
+	void freeReference() {  }
+
+	~my_shared_ptr() { if (ref_count && !--ref_count) { delete this;} }
+
+protected:
+	T * _ptr;
+	unsigned int ref_count;
+
+};
+
+}; /* namespace util */
+}; /* namespace mysql */
+}; /* namespace sql */
+
+#endif /* _MYSQL_UTIL_H_ */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */

Thread
bzr commit into connector-cpp-bzr branch (andrey.hristov:201) andrey.hristov4 Nov