Markus Glaser wrote:
> Hello everybody,
> 
> for the Selenium Framework I have a very specific database related issue 
> which is hard for me to decide. This is the problem:
> 
> In order to have a fresh state for every test, we agreed to have a test 
> database (and image folder, but this is a sidetrack now) for every test suite 
> run. The fresh database is created from a SQL file which can be attached to a 
> test as a resource. Now, to make the creation of such SQL files as easy as 
> possible, I wanted to be able to simply use SQL dumps created with mysqldump. 
> The import of the data is done via the existing databse abstraction layer. I 
> use the method DatabaseBase::sourceFile which in turn calls 
> DatabaseBase::sourceStream. The problem is now, that some of the SQL INSERT 
> statements seem to be too long for this method.
> 
> Platonides pointed me to the source of the problem (thanks!). It lies 
> currently in line 2506 (Database.php) : $line = trim( fgets( $fp, 1024 ) ); 
> So the lines read are limited to 1024 characters. If I remove this 
> limitation, everything works fine. PHP manual tells me that the length 
> parameter is optional as of PHP version 4.2.0. Since I don't know enough 
> about how fgets works and what its security issues are, I wonder, is there a 
> reason not to remove the parameter?
> 
> Cheers,
> Markus (mglaser)

I think it can be removed safely.
Although in this case I would just run mysqldump with
--skip-extended-insert so that it doesn't create such long lines.


_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to