0

i'm working on my first TYPO3-Project (TYPO3 6.1). I developed a CSV-import which works well, but now i want to backup the table before the import new Data. Thus, i want to copy the Table with the Data.

My question, how can i do this in the right way? I mentioned to write a Method in the Repository-Class (Which Extends the extbase/perstistance/repository).

Is this good? How can access a DB-Object there to call a custom SQL-Query?

Thanks for your help!

4

1 回答 1

1

您可以使用原始查询,例如

$query = $this->createQuery();
$query->getQuerySettings()->setReturnRawQueryResult(TRUE);
$query->statement(
    'SELECT order_id,product_name,qty
    FROM orders
    INTO OUTFILE '/tmp/orders.csv'
    FIELDS TERMINATED BY ','
    ENCLOSED BY '"'
    LINES TERMINATED BY '\n''
);
return $query->execute();
于 2013-07-18T15:52:05.213 回答