X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fpool-functions.php;h=6ef7033701f8a8d02ef759c0524fecb075c4a2ad;hp=81a303eea527037197153eebb00cb08ec5ab1cde;hb=4373e155854012d687fdfcae4c69d1a940883fab;hpb=c0c6d5d58bdecd22bdcf7dfe5b24bec69e1810c7 diff --git a/inc/pool-functions.php b/inc/pool-functions.php index 81a303eea5..6ef7033701 100644 --- a/inc/pool-functions.php +++ b/inc/pool-functions.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Funktionen zum Umgang mit Status-Funktionen * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -47,7 +42,7 @@ function getPoolDataFromId ($poolId) { $content = array(); // Search for pool data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `id`, `sender`, `subject`, @@ -68,13 +63,13 @@ LIMIT 1', array(bigintval($poolId)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load data - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return found data return $content; @@ -88,7 +83,7 @@ function updatePoolDataById ($poolId, $columnName, $data, $updateMode = NULL, $w assert(!is_array($data)); // Then use this on the column with this mode (mostly counters) - SQL_QUERY_ESC('UPDATE `{?_MYSQL_PREFIX?}_pool` SET `%s`=`%s`%s%s WHERE `id`=%s' . $whereSql . ' LIMIT 1', + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_pool` SET `%s`=`%s`%s%s WHERE `id`=%s' . $whereSql . ' LIMIT 1', array( $columnName, $columnName, @@ -104,17 +99,17 @@ function updatePoolDataById ($poolId, $columnName, $data, $updateMode = NULL, $w $sql = 'UPDATE `{?_MYSQL_PREFIX?}_pool` SET '; foreach ($data as $key => $value) { // Add it - $sql .= sprintf("`%s`='%s',", SQL_ESCAPE($key), SQL_ESCAPE($value)); + $sql .= sprintf("`%s`='%s',", sqlEscapeString($key), sqlEscapeString($value)); } // END - foreach // Finish SQL $sql = substr($sql, 0, -1) . $moreSql . ' WHERE `id`=' . bigintval($id) . $whereSql . ' LIMIT 1'; // And finally run it - SQL_QUERY($sql, __FUNCTION__, __LINE__); + sqlQuery($sql, __FUNCTION__, __LINE__); } else { // Regular update - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `%s`='%s' WHERE `id`=%s" . $whereSql . ' LIMIT 1', + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `%s`='%s' WHERE `id`=%s" . $whereSql . ' LIMIT 1', array( $columnName, $data, @@ -123,7 +118,19 @@ function updatePoolDataById ($poolId, $columnName, $data, $updateMode = NULL, $w } // Return if it has an affected row - return (SQL_AFFECTEDROWS() == 1); + return (sqlAffectedRows() == 1); +} + +// Insert data into pool and return its insert id +function insertDataIntoPool ($data) { + // Construct SQL query + $sql = 'INSERT INTO `{?_MYSQL_PREFIX?}_pool (`' . implode('`,`', array_map('SQL_ESCAPE', array_keys($data))) . "`) VALUES ('" . implode("','", array_values($data)) . "')"; + + // Run the query + sqlQuery($sql, __FUNCTION__, __LINE__); + + // Return insert id + return getSqlInsertId(); } // [EOF]