PurePerl MySQL API
Free to Download
Foreword: This page presents the easy to use and easy to install PurePerl MySQL Application Programming Interface, for all operating systems.
By: Chrysanthus Date Published: 29 Jan 2015
The API has the following variables, as you will use in your script.
This will hold any error message developed from a query or some other command. The message is for the last issued command or query.
This will hold an OK message, if present; or any other message, if present. The message is for the last issued command.
This will hold the number of warnings the last issued command (or query) has generated.
This is the number of records changed by a command.
This is the last auto-incremented ID of an Insert command, where applicable.
This is an array of hashes that will hold the result set, for queries of the SELECT nature.
This is an array similar to @Result, but it is an array of arrays, to economize memory.
The will hold the number of columns in a result set.
This will hold the database name for a result set
This will hold column properties like table names and column names for a result set. It is a two-dimensional array, where one row is for one column.
This will hold the number of rows of a result set.
The function syntaxes as you will use in your script, and their meanings, are given below. On success a function returns 1; on failure it returns 0. Any error message or other message is got from the appropriate variable above.
The Mysql::connect("username", "password", "domain_name", port) Function
This function connects the client software to the server software.
The Mysql::select_db("database_name") Function
This function selects a new database for the client.
The Mysql::query("SQL_stmt") Function
This function takes one argument. The argument is a string, which is a MySQL SQL statement without the ending semicolon. Very many different types of SQL statement can be the argument. The result set returned is held in @Mysql::Result.
The Mysql::query_num("SQL_stmt") Function
This function is the same as the query() function, but the result set returned is held in @Mysql::Result_Num and not @Mysql::Result, to economize memory.
The Mysql::stats() Function
This function gets a human readable string of internal statistics, with a list of active threads.
The Mysql::ping() Function
This function reports whether the server is alive and reachable.
The Mysql::shutdown() Function
This function can be used by the client who has the shutdown privilege to shutdown the MySQL server.
The Mysql::close() Function
This function is used to close the connection.
The Mysql::change_user("user", "password", "databaseName") Function
While a connection is on, this function changes the user. If it fails, the connection is closed.
The Mysql::quit() Function
This function tells the server that the client wants to close the connection (end session); response: either a connection close or an acceptance to close the connection.
The Mysql::refresh(arg) Function
A low-level version of several FLUSH ... and RESET ... statements. The argument can be any of the following: REFRESH_GRANT, REFRESH_LOG, REFRESH_TABLES, REFRESH_HOSTS, REFRESH_STATUS, REFRESH_THREADS, REFRESH_SLAVE, REFRESH_MASTER, REFRESH_ALL
The debug() Function
Dump internal debug info of mysql sever to stdout.
The reset_connection() Function
This function resets the connection.
To prepare a statement; e.g.
my $ins = "INSERT INTO pet (name, owner, species, sex, birth, death) VALUES (?,?,'cat','f','2009-03-30',NULL)";
Can be used to reset the prepared statement.
To execute a statement; e.g.
Mysql::send_long_value("the long value", placeHolderIndex)
Use this function, before execute().
This closes the prepared statement and frees resources at the server.
Maximum Packet Size: unlimited
Stored Procedure and Multiple Statement
Stored Procedure or Multiple statements separated by semicolons, in a query - Mysql::query("multi_stmts") -, is supported.
PurePerl MySQL API supports transactions. - Mysql::query("transaction_stmts")
Compressed Data Values with PurePerl MySQL API
Compressed SQL Statements with PurePerl MySQL API
SSL and TLS with PurePerl MySQL API
Asynchronous Replication with PurePerl MySQL
The API is easy to use. You can learn how to use it freely at:
Using the API
The discussion group for this software is at:
Coding by Hand
You may have to register, free, first.
You can learn how to use the API for web development, free of charge, from the following link:
Web Development Course with Pure Perl and MySQL
The downloaded library is in a zipped directory. You download it and you unzip it. You will then see the file, Mysql.pm and the directory, Mysql.
Installation is easy: copy the file, Mysql.pm and the directory, Mysql to the directory, C:/Perl/lib or similar of your computer. That is all! You can begin to use the API (functions and variables). Note: if you are not using the Windows Operating System, then go to the file Mysql.pm of your computer, in the installed directory, and at the top of the file, type something like, #!/usr/bin/perl pushing down the rest of the content, by one line. You should know what that statement means. Do the same for all the other files in the C:/Perl/lib/Mysql directory of your computer. Begin work!
The library is free of charge. After reading the agreement, download it at the following link:
PurePerl MySQL API
More Related Links
PurePerl MySQL API
Perl Course - Professional and Advanced
Major in Website Design
Web Development Course
Producing a Pure Perl Library