Mysql dump outside the command line?

If you're using PHP and don't mind using a GPL license, then phpMyAdmin contains some code for MySQL dump (as well as to other formats like CSV, etc) Check out the file: libraries/export/sql.php.

If you're using PHP and don't mind using a GPL license, then phpMyAdmin contains some code for MySQL dump (as well as to other formats like CSV, etc). Check out the file: libraries/export/sql.php.

I can't see in the code that phpMyAdmin calls mysqldump at all. It seems to mimic the output of mysqldump, but doens't use it directly, and has trouble with large databases, and some complex data types or charsets that mysqldump breezes through. – Jarret Hardie Mar 19 '09 at 1:44 Yep, the point is that it doesn't call the mysqldump tool at all; it implements its own code for a MySQL dump.

What data types or chatsets does it have problems with and are they reported as bugs to the phpmyadmin project? – thomasrutter Mar 19 '09 at 5:08.

There are APIs available (database drivers) for . NET, Delphi, and generic ODBC/DAO, as well as libraries for C/C++ and other languages. It's never going to be written directly into a mainstream language itself; that would restrict the language from being as general purpose and therefore make it less useful.

Delphi, for instance, has a database framework called DBExpress; there's a DBExpress driver included out of the box for MS SQL Server, Oracle, MySQL, DB2, and others; what drivers are available depend on the version (Professional, Enterprise, or Architect) you decide to buy. MySQL is available in all versions. Using the DBExpress framework makes Delphi usable with any database engine that someone decides to provide a DBExpress driver for, and the drivers can be written in Delphi itself.

That keeps Delphi more general purpose; it's not hard-coded to work with only a single RDBMS. EDIT: As others have said (I think Jarret), the source to mysqldump is available. Using the wrappers available for your language of choice, you should be able to implement the same functionality based on that source.

I'm not sure his question is about database bindings generally, but more specifically about mysqldump. – Jarret Hardie Mar 19 '09 at 1:44 Yeah, from other answers it appears that way. However, my answer still applies.

See my edit. – Ken White Mar 19 '09 at 1:59.

Your instinct is right... it would be pretty tough for a programming language library to provide API access to mysqldump. The source to mysqldump is written in C, with its own main() function; it's designed to operate pretty much as its own program. It gets built as an executable, and much of the error reporting and output are handled using direct print statements to stdout, and not using return values that could be wrapped into a language-specific value.

When most bindings for a specific programming language are compiled (PHP, python, Delphi, . NET, etc), they link against libmysql, and libmysql contains no reference to the mysqldump program. I can't say for sure that no one has written a wrapper, but it would be a very bizarre wrapper indeed.In other words, your best bet is to use a sub-process from your programming language of choice to call the mysqldump tool, and absorb the results either from stdin or from a temp file.

Your question is rather vague. Please describe what you want to accomplish, and what you have tried already. That being said, if you want to produce a DB dump of a MySQL database in the way that mysqldump does, I know of no API that makes it possible directly.

But there are numerous other ways of dumping / backing up a DB, and the mysqldump format has its share of problems (not well defined for one thing, hence not easy to parse). So you might consider an alternative approach.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions