use Friendica\App;
use Friendica\Database\DBA;
+use Friendica\Database\DBStructure;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Strings;
*/
private static function checkCols($table, &$arr)
{
- $query = sprintf("SHOW COLUMNS IN `%s`", DBA::escape($table));
- Logger::log("uimport: $query", Logger::DEBUG);
- $r = q($query);
+ $r = DBStructure::getColumns($table);
+
$tcols = [];
// get a plain array of column names
foreach ($r as $tcol) {
}
self::checkCols($table, $arr);
- $cols = implode("`,`", array_map(['Friendica\Database\DBA', 'escape'], array_keys($arr)));
- $vals = implode("','", array_map(['Friendica\Database\DBA', 'escape'], array_values($arr)));
- $query = "INSERT INTO `$table` (`$cols`) VALUES ('$vals')";
- Logger::log("uimport: $query", Logger::TRACE);
if (self::IMPORT_DEBUG) {
return true;
}
- return q($query);
+ return DBA::insert($table, $arr);
}
/**