Preprod mutu dc0edebeb0 tnt
2017-09-12 10:48:51 +02:00

34 lines
938 B
PHP

<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
class TNTOfficiel_DbUtils
{
/**
* Gets all the columns name for the given table
* @param string $tableName
* @return array
* @throws PrestaShopDatabaseException
*/
public static function getColumnsFromTable($tableName)
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$sql = 'DESC '._DB_PREFIX_.pSQL($tableName);
$results = Db::getInstance()->executeS($sql);
$fields = array();
foreach ($results as $field) {
$fields[] = $field['Field'];
}
return $fields;
}
}