aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Knight <q@1bpm.net>2022-08-25 18:14:53 +0100
committerRichard Knight <q@1bpm.net>2022-08-25 18:14:53 +0100
commit9ac4dfb0f0ba5be3f21bd3904c99ba67543b1833 (patch)
treeeda9aabe89979289d61f8ef40f605f18a3223438 /include
parentdb5bc3227bf89c0eaf2f2498cf0f1a80cf5eead0 (diff)
downloadcsound-sqldb-9ac4dfb0f0ba5be3f21bd3904c99ba67543b1833.tar.gz
csound-sqldb-9ac4dfb0f0ba5be3f21bd3904c99ba67543b1833.tar.bz2
csound-sqldb-9ac4dfb0f0ba5be3f21bd3904c99ba67543b1833.zip
fixed string and array memory leaks
Diffstat (limited to 'include')
-rw-r--r--include/connection.h6
-rw-r--r--include/logindata.h4
-rw-r--r--include/mysql.h6
-rw-r--r--include/postgresql.h6
-rw-r--r--include/sqlite.h6
-rw-r--r--include/tools.h30
6 files changed, 44 insertions, 14 deletions
diff --git a/include/connection.h b/include/connection.h
index e67ea27..cf3fb2e 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -19,8 +19,8 @@
*/
-#ifndef CONNECTION_H
-#define CONNECTION_H
+#ifndef CSSQLDB_CONNECTION_H
+#define CSSQLDB_CONNECTION_H
#include <plugin.h>
#include "logindata.h"
@@ -68,7 +68,7 @@ struct ConnectionData {
void Close(csnd::Csound* csound);
void Exec(char* sql);
MYFLT Scalar(char* sql, int row, int col);
- char* ScalarString(char* sql, int row=0, int col=0);
+ char* ScalarString(char* sql, csnd::Csound* csound, int row=0, int col=0);
void ArrayQuery(char* sql, csnd::Csound* csound, ARRAYDAT* array);
void ArrayQueryString(char* sql, csnd::Csound* csound, ARRAYDAT* array);
};
diff --git a/include/logindata.h b/include/logindata.h
index 8a62e6b..be8e79a 100644
--- a/include/logindata.h
+++ b/include/logindata.h
@@ -19,8 +19,8 @@
*/
-#ifndef LOGINDATA_H
-#define LOGINDATA_H
+#ifndef CSSQLDB_LOGINDATA_H
+#define CSSQLDB_LOGINDATA_H
struct LoginData {
int dbType;
diff --git a/include/mysql.h b/include/mysql.h
index 1abc6e3..950e9d3 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -19,8 +19,8 @@
*/
-#ifndef MYSQL_H
-#define MYSQL_H
+#ifndef CSSQLDB_MYSQL_H
+#define CSSQLDB_MYSQL_H
#include <plugin.h>
#include <cppconn/driver.h>
@@ -37,7 +37,7 @@ struct MySQLConnection {
void Exec(char* sql);
mysql::ResultSet* Query(char *sql);
MYFLT Scalar(char* sql, int row, int col);
- char* ScalarString(char* sql, int row, int col);
+ char* ScalarString(char* sql, csnd::Csound* csound, int row, int col);
void ToArray(mysql::ResultSet* result, csnd::Csound* csound, ARRAYDAT* array, bool asString);
void ArrayQuery(char* sql, csnd::Csound* csound, ARRAYDAT* array);
void ArrayQueryString(char* sql, csnd::Csound* csound, ARRAYDAT* array);
diff --git a/include/postgresql.h b/include/postgresql.h
index 5209057..eaf01c8 100644
--- a/include/postgresql.h
+++ b/include/postgresql.h
@@ -19,8 +19,8 @@
*/
-#ifndef POSTGRESQL_H
-#define POSTGRESQL_H
+#ifndef CSSQLDB_POSTGRESQL_H
+#define CSSQLDB_POSTGRESQL_H
#include <plugin.h>
#include "libpq-fe.h"
@@ -33,7 +33,7 @@ struct PostgresConnection {
void Exec(char* sql);
PGresult* Query(char *sql);
MYFLT Scalar(char* sql, int row, int col);
- char* ScalarString(char* sql, int row, int col);
+ char* ScalarString(char* sql, csnd::Csound* csound, int row, int col);
void ToArray(PGresult* result, csnd::Csound* csound, ARRAYDAT* array, bool asString);
void ArrayQuery(char* sql, csnd::Csound* csound, ARRAYDAT* array);
void ArrayQueryString(char* sql, csnd::Csound* csound, ARRAYDAT* array);
diff --git a/include/sqlite.h b/include/sqlite.h
index 4e2b0c3..c42eb57 100644
--- a/include/sqlite.h
+++ b/include/sqlite.h
@@ -19,8 +19,8 @@
*/
-#ifndef XSQLITE3_H
-#define XSQLITE3_H
+#ifndef CSSQLDB_SQLITE3_H
+#define CSSQLDB_SQLITE3_H
#include <plugin.h>
#include <sqlite3.h>
@@ -33,7 +33,7 @@ struct SqliteConnection {
void Exec(char* sql);
sqlite3_stmt* Query(char *sql);
MYFLT Scalar(char* sql, int row, int col);
- char* ScalarString(char* sql, int row, int col);
+ char* ScalarString(char* sql, csnd::Csound* csound, int row, int col);
int RowCount(sqlite3_stmt* stmt);
void ToArray(sqlite3_stmt* result, csnd::Csound* csound, ARRAYDAT* array, bool asString);
void ArrayQuery(char* sql, csnd::Csound* csound, ARRAYDAT* array);
diff --git a/include/tools.h b/include/tools.h
new file mode 100644
index 0000000..54a0363
--- /dev/null
+++ b/include/tools.h
@@ -0,0 +1,30 @@
+/*
+ tools.h
+ Copyright (C) 2022 Richard Knight
+
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+#ifndef CSSQLDB_TOOLS_H
+#define CSSQLDB_TOOLS_H
+
+#include <plugin.h>
+
+STRINGDAT* arrayInit(csnd::Csound* csound, ARRAYDAT* array, int rows, int cols);
+void insertArrayStringItem(csnd::Csound* csound, STRINGDAT* strings, int index, char* item);
+
+#endif /* TOOLS_H */