summaryrefslogtreecommitdiff
path: root/muggle-plugin/mg_mysql.h
diff options
context:
space:
mode:
authorLarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b>2005-03-22 06:47:53 +0000
committerLarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b>2005-03-22 06:47:53 +0000
commite2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f (patch)
tree616f2f0a482597e3968e281ccf8adcfd04f45bbc /muggle-plugin/mg_mysql.h
parent101360901576c7e91196de60e2e6ebd6a4b145dd (diff)
downloadvdr-plugin-muggle-0.1.6-BETA.tar.gz
vdr-plugin-muggle-0.1.6-BETA.tar.bz2
Added 0.1.6 beta tag0.1.6-BETA
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/tags/0.1.6-BETA@586 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'muggle-plugin/mg_mysql.h')
-rw-r--r--muggle-plugin/mg_mysql.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/muggle-plugin/mg_mysql.h b/muggle-plugin/mg_mysql.h
new file mode 100644
index 0000000..3c3fde1
--- /dev/null
+++ b/muggle-plugin/mg_mysql.h
@@ -0,0 +1,76 @@
+/*!
+ * \file mg_mysql.h
+ * \brief A capsule around MySql database access
+ *
+ * \version $Revision: 1.2 $
+ * \date $Date: 2005-02-10 17:42:54 +0100 (Thu, 10 Feb 2005) $
+ * \author Ralf Klueber, Lars von Wedel, Andreas Kellner, Wolfgang Rohdewald
+ * \author Responsible author: $Author: LarsAC $
+ */
+
+#ifndef __MG_MYSQL_H
+#define __MG_MYSQL_H
+
+#include <string>
+#include <mysql/mysql.h>
+
+using namespace std;
+
+void database_end(); // must be done explicitly
+void set_datadir(char *datadir);
+
+/*!
+ * \brief an abstract database class
+ *
+ */
+class mgmySql
+{
+ public:
+
+ /*! \brief default constructor
+ */
+ mgmySql( );
+
+ ~mgmySql();
+
+ /*!
+ * \brief helper function to execute queries
+ *
+ */
+ MYSQL_RES* exec_sql( const string query);
+
+ /*!
+ * \brief escape arguments to be contained in a query
+ */
+ string sql_string( string s );
+
+ char* sql_Cstring( const string s,char *buf=0);
+ char* sql_Cstring( const char *s,char *buf=0);
+
+ string get_col0( const string query);
+
+/*! \brief executes a query and returns the integer value from
+ * the first column in the first row. The query shold be a COUNT query
+ * returning only one row.
+ * \param query the SQL query to be executed
+ */
+ unsigned long exec_count (string query);
+
+ long thread_id() { return mysql_thread_id(m_db);}
+ long affected_rows() { return mysql_affected_rows(m_db);}
+ bool ServerConnected() const;
+ bool Connected() const;
+ bool HasFolderFields() const { return m_hasfolderfields;}
+ void Connect();
+ //! \brief create database and tables
+ void Create();
+ void FillTables();
+ void CreateFolderFields();
+ private:
+ MYSQL *m_db;
+ bool m_database_found;
+ bool m_hasfolderfields;
+ bool sql_query(const char *query);
+};
+
+#endif