1 /** 2 * A native D driver for the MySQL database system. Source file mysql.d. 3 * 4 * This module attempts to provide composite objects and methods that will 5 * allow a wide range of common database operations, but be relatively easy to 6 * use. The design is a first attempt to illustrate the structure of a set of 7 * modules to cover popular database systems and ODBC. 8 * 9 * It has no dependecies on GPL header files or libraries, instead communicating 10 * directly with the server via the published client/server protocol. 11 * 12 * $(LINK http://dev.mysql.com/doc/internals/en/client-server-protocol.html)$(BR) 13 * 14 * This version is not by any means comprehensive, and there is still a good 15 * deal of work to do. As a general design position it avoids providing 16 * wrappers for operations that can be accomplished by simple SQL sommands, 17 * unless the command produces a result set. There are some instances of the 18 * latter category to provide simple meta-data for the database, 19 * 20 * Its primary objects are: 21 * $(UL 22 * $(LI Connection: $(UL $(LI Connection to the server, and querying and setting of server parameters.))) 23 * $(LI Command: Handling of SQL requests/queries/commands, with principal methods: 24 * $(UL $(LI execSQL() - plain old SQL query.) 25 * $(LI execSQLTuple() - get a set of values from a select or similar query into a matching tuple of D variables.) 26 * $(LI execPrepared() - execute a prepared statement.) 27 * $(LI execSQLResult() - execute a raw SQL statement and get a complete result set.) 28 * $(LI execSQLSequence() - execute a raw SQL statement and handle the rows one at a time.) 29 * $(LI execPreparedResult() - execute a prepared statement and get a complete result set.) 30 * $(LI execPreparedSequence() - execute a prepared statement and handle the rows one at a time.) 31 * $(LI execFunction() - execute a stored function with D variables as input and output.) 32 * $(LI execProcedure() - execute a stored procedure with D variables as input.) 33 * ) 34 * ) 35 * $(LI ResultSet: $(UL $(LI A random access range of rows, where a Row is basically an array of variant.))) 36 * $(LI ResultSequence: $(UL $(LIAn input range of similar rows.))) 37 * ) 38 * 39 * There are numerous examples of usage in the unittest sections. 40 * 41 * The file mysqld.sql, included with the module source code, can be used to 42 * generate the tables required by the unit tests. 43 * 44 * This module supports both Phobos sockets and $(LINK http://vibed.org/, Vibe.d) 45 * sockets. Vibe.d support is disabled by default, to avoid unnecessary 46 * depencency on Vibe.d. To enable Vibe.d support, use: 47 * -version=Have_vibe_d 48 * 49 * If you compile using $(LINK https://github.com/rejectedsoftware/dub, DUB), 50 * and your project uses Vibe.d, then the -version flag above will be included 51 * automatically. 52 * 53 * This requires DMD v2.061 or later, and a MySQL server v4.1.1 or later. Older 54 * versions of MySQL server are obsolete, use known-insecure authentication, 55 * and are not supported by this module. 56 * 57 * There is an outstanding issue with Connections. Normally MySQL clients 58 * connect to a server on the same machine via a Unix socket on *nix systems, 59 * and through a named pipe on Windows. Neither of these conventions is 60 * currently supported. TCP must be used for all connections. 61 * 62 * Developers - How to run the test suite: 63 * 64 * This package contains various unittests and integration tests. To run them, 65 * first compile mysql-native's connection.d with the following flags: 66 * -g -unittest -debug=MYSQL_INTEGRATION_TESTS -ofmysqln_tests 67 * 68 * Then, running 'mysqln_tests' once will automatically create a file 69 * 'testConnectionStr.txt' in the same directory as 'mysqln_tests' and then 70 * exit. This file is deliberately not contained in the source repository 71 * because it's specific to your system. 72 * 73 * Open the 'testConnectionStr.txt' file and verify the connection settings 74 * inside, modifying them as needed, and if necessary, creating a test user and 75 * blank test schema in your MySQL database. 76 * 77 * The tests will completely clobber anything inside the db schema provided, 78 * but they will ONLY modify that one db schema. No other schema will be 79 * modified in any way. 80 * 81 * After you've configured the connection string, run 'mysqln_tests' again 82 * and their tests will be run. 83 * 84 * Copyright: Copyright 2011 85 * License: $(LINK www.boost.org/LICENSE_1_0.txt, Boost License 1.0). 86 * Authors: Steve Teale, James W. Oliphant, simendsjo, Sönke Ludwig, sshamov, Nick Sabalausky 87 */ 88 module mysql; 89 90 public import mysql.common; 91 public import mysql.connection; 92 public import mysql.db; 93 public import mysql.result; 94 public import mysql.protocol.commands; 95 public import mysql.protocol.constants; 96 public import mysql.protocol.extra_types; 97 public import mysql.protocol.packet_helpers; 98 public import mysql.protocol.packets; 99 100 debug(MYSQL_INTEGRATION_TESTS) 101 { 102 public import mysql.test.common; 103 public import mysql.test.integration; 104 public import mysql.test.regression; 105 }