Releases: catfan/Medoo
Releases · catfan/Medoo
Medoo v1.7.6
- Fixed error information for statement
- Fixed data type conversion for select() with single column
Medoo v1.7.5
- Emergency fix column name coverage for
columnQuote()
Medoo v1.7.4
- Fixed incorrect
id()
result after executing query with error - Fixed columnQuote for security issue reported by Snyk
Medoo v1.7.3
- Bug fix for index mapping
Medoo v1.7.2
- Emergency bug fix for selecting single column
Medoo v1.7.1
- Emergency bug fix for
buildJoin()
Medoo v1.7
New Create() And Drop() API
Medoo provided two API for creating table and dropping table for better table management on the project.
$database->create("account", [
"id" => [
"INT",
"NOT NULL",
"AUTO_INCREMENT",
"PRIMARY KEY"
],
"first_name" => [
"VARCHAR(30)",
"NOT NULL"
]
]);
$database->drop("account");
Index Mapping For Select Output
It's now able to set column name as the index key for the result.
$data = $database->select("post", [
"user_id" => [
"nickname",
"location",
"email"
]
]);
// Output data
[
10: {
nickname: "foo",
location: "New York",
email: "foo@example.com"
},
12: {
nickname: "bar",
location: "New York",
email: "bar@medoo.in"
}
]
Improvements
- Throw error if used table.* for all columns while joining table
- Improve code quality
Bug Fixed
- Incorrect implode usage
Medoo v1.6.1
Fixed some MSSQL compatibility bugs
Medoo v1.6
Improved initialization
Medoo 1.6 is now supported more connection options, and allowed passing PDO object for initialization. Check out more detail from https://medoo.in/api/new
$database = new Medoo([
// required
'database_type' => 'mysql',
'database_name' => 'name',
'server' => 'localhost',
'username' => 'your_username',
'password' => 'your_password',
// [optional]
'collation' => 'utf8mb4_general_ci',
// [optional] The application name for MSSQL
'appname' => 'test',
// [optional] MSSQL connection options
'application_intent' => 'ReadOnly',
'attach_db_file_name' => './database.sql',
....
]);
$pdo = new PDO('mysql:dbname=test;host=127.0.0.1', 'user', 'password');
$database = new Medoo([
// Initialized and connected PDO object
'pdo' => $pdo,
// [optional] Medoo will have different handle method according to different database type
'database_type' => 'mysql'
]);
try {
$database = new Medoo([
'database_type' => 'mysql',
'database_name' => 'name',
'server' => 'localhost',
'username' => 'your_username',
'password' => 'your_password',
]);
}
catch (Exception $e) {
echo $e->getMessage();
}
// Will output: Incorrect connection options
New rand() API
Medoo provided a new way for getting randomized data. It's also compatible with other database.
$data = $database->rand("account", [
"user_name",
"email"
], [
"user_id[>]" => 100
]);
Output DSN String for info()
info()
will output the DSN string now. You can check out this for debug database connection.
print_r($database->info());
/*
Array
(
[server] => Uptime: 5000 Threads: 1 Questions: 15 Slow queries: 0 Opens: 67 Flush tables: 1
Open tables: 60 Queries per second avg: 0.002
[client] => mysqlnd 5.0.10 - 20111026 - $Id: a707c415db32080b3752b232487a435ee0372157 $
[driver] => mysql
[version] => 5.6.10
[connection] => localhost via TCP/IP
[dsn] => mysql:dbname=test;host=127.0.0.1
)
*/'
Improvements
- Call aggregate methods without magic call
get()
returns NULL instead of False if find nothing- Handle MariaDB as same as MySQL
- Code simplified and improved performance
Bug Fixed
- Match keyword is only supported for MySQL
- Execute special command for customized DSN connection
Medoo v1.5.7
This version included some tiny bug fixes.