/**
  * Returns the column names as array
  * @param string $tableName
  * @return array
  */
 public function getColumns($tableName = null, $primary = false)
 {
     $table = new eDB_Table();
     $tableContent = null;
     if ($table != null) {
         if ($table->exists($tableName)) {
             $tableContent = $this->getTableContent($tableName);
         }
     } else {
         if ($table->exists($this->tableName)) {
             $tableContent = $this->getTableContent($this->tableName);
         }
     }
     if ($primary == false) {
         $tableContent[0] = preg_replace('#:key;[0-9]#i', '', $tableContent[0]);
     }
     return explode('|', $tableContent[0]);
 }
 /**
  * Insert a new row into a table
  * 
  * @param string $tableName
  * @param array $content
  * @return bool
  */
 private function insert($tableName, $content)
 {
     $ic = $this->generateIncrement($tableName);
     if (!empty($ic['key']) && !empty($ic['value'])) {
         $content[$ic['key']] = $ic['value'];
     }
     $table = new eDB_Table();
     if ($table->exists($tableName)) {
         $select = new eDB_Select();
         if (count($content) <= $select->getColumnNumbers($tableName)) {
             $tableSource = fopen(str_replace('//', '/', $this->dbPath . '/' . $tableName . '.edb'), 'a+');
             fputs($tableSource, "\r\n" . implode('|', $content));
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 /**
  * Update the given table with the given rows
  * @param array $rows
  * @param string $tableName
  */
 public function updateTable($rows, $tableName)
 {
     $ifTable = new eDB_Table();
     $inFile = null;
     if ($ifTable->exists($tableName)) {
         $table = fopen(str_replace('//', '/', $this->dbPath . "/" . $tableName . '.edb'), 'w');
         $count = 0;
         foreach ($rows as $row) {
             if ($count == 0) {
                 $break = '';
             } else {
                 $break = "\r\n";
             }
             $inFile .= $break . implode('|', $row);
             ++$count;
         }
         fputs($table, $inFile);
     }
 }