Skip to content

Releases: catfan/Medoo

Medoo v2.1.2

27 Jul 11:05
Compare
Choose a tag to compare
  • Bug fix for MySQL rand().

Medoo v2.1.1

09 Jul 05:29
Compare
Choose a tag to compare
  • Fix and improve Regex for matching column and table names.

Medoo v2.1.0

07 Jun 02:13
Compare
Choose a tag to compare

Raw for BETWEEN

$this->database->select("account", "user_name", [
	"birthday[<>]" => [
		Medoo::raw("to_date(:from, 'YYYY-MM-DD')", [":from" => '2015/05/15']),
		Medoo::raw("to_date(:to, 'YYYY-MM-DD')", [":to" => '2025/05/15'])
	]
]);
SELECT "user_name"
FROM "account"
WHERE
("birthday" BETWEEN to_date('2015/05/15', 'YYYY-MM-DD') AND to_date('2025/05/15', 'YYYY-MM-DD'))

LOBs for Oracle

Better support for inserting and updating LOBs for the Oracle database.

$fp = fopen('foo.dat', 'r');

$database->insert("ACCOUNT", [
	"NAME" => "foo",
	"DATA" => $fp
], "ID");

$database->update("ACCOUNT", [
	"DATA" => $fp
], [
	"ID" => 1
]);
  • The regex for matching table name and column name is [\p{L}_][\p{L}\p{N}@$#\-_]+.
  • The performance is slightly improved.

Medoo v2.0.1

12 May 18:01
Compare
Choose a tag to compare

Quick bug fixed for v2.0.

  • pdo connection undefined warning #962
  • Duplicated table prefix for create() #963
  • Connection warning while using socket #964

To see what's news about the next gen v2.0:
https://medoo.in/api/whatsnew

The Next-Gen v2.0

28 Apr 08:38
Compare
Choose a tag to compare

What is New v2.0

The milestone version of Medoo. We have updated the whole project with more standard and reliable code, including some new features and significant improvements. We also updated and redesigned the official documentation website.

Error initialization option

The new error option to indicate how to handle error information.

$database = new Medoo([
	// Can be set as PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION
	// Default is PDO::ERRMODE_SILENT
	'error' => PDO::ERRMODE_SILENT
]);

Simplified connection options

Those option names are simplified (you can still use the old one of course).

  • database_type -> type
  • database_name -> database
  • server -> host
// New
$database = new Medoo([
	'type' => 'mysql',
	'host' => 'localhost',
	'database' => 'name',
	'username' => 'your_username',
	'password' => 'your_password',
]);

// Old
$database = new Medoo([
	'database_type' => 'mysql',
	'database_name' => 'name',
	'server' => 'localhost',
	'username' => 'your_username',
	'password' => 'your_password',
]);

New callback closure for select()

The high-performance way to output data immediately without loading it into memory.

$database->select("account", ["name"], function ($data) {
	echo $data["name"];
});

New way to getting result from action()

To get the result from action(), you can provide the reference variable with the use keyword for the closure and then get it back from outside.

$result = "";

$database->action(function($database) use (&$result) {

	$database->insert("account", [
		"user_name" => "foo"
	]);

	$newId = $database->id();

	$result = "The account is created, id is {$newId}.";
});

echo $result;

New way to get the error information

The function $database->error() is removed. Just read the $database->error or $database->errorInfo to get the error information last performed.

$database->insert("account", [
	"user_name" => "foo"
]);

var_dump($database->error);
var_dump($database->errorInfo);

Last inserted id on Oracle

If want to the last inserted id on Oracle, provide the primary key as third parameter for insert() and get it from id().

$database->insert("ACCOUNT", ["NAME" => "foo"], "ID");

var_dump($database->id());

Debug Logging

To debug the whole or the part of your project without putting debug() to every call, you can use beginDebug() to start debug logging, and then call debugLog() to stop it and get all debug logs as an array.

// Begin debug logging
$database->beginDebug();

// All those functions will not be executed but will save it as a debug log.
$database->select()......
$database->update().....

// Call debugLog() to stop debug logging and return all debug logs as an array.
var_dump($database->debugLog());

// Will output:
// array(2) {
//  [0]=> string(10) "SELECT ... FROM"
//  [1]=> string(10) "UPDATE ... SET ... WHERE ..."
// }

Join with Raw Object and Additional Condition

$database->select("post", [
	"[>]comment" => [
		"author_id" => "user_id",
		"AND" => [
			"rate[>]" => 50
		]
	],
	"[>]account" => Medoo::raw("ON <post.author_id> = <account.user_id>")
], [
	"post.content",
	"comment.content",
	"account.name"
]);
  • PSR-2 standard.
  • Test cases included.
  • PHPDoc comments included.
  • Drop support for PHP 5.4, the minimal requirement is PHP 7.3+.
  • Better support for MSSQL and Oracle.
  • Supports using Unicode character as table/column name.
  • The official documentation website https://medoo.in is redesigned.

Enjoy it! :)

Medoo v1.7.10

11 Feb 08:22
Compare
Choose a tag to compare
  • Emergency bug fix

Medoo v1.7.9

06 Feb 06:04
Compare
Choose a tag to compare
  • Fixed some bugs about the raw query syntax

Medoo v1.7.8

19 Dec 05:11
Compare
Choose a tag to compare
  • Fixed incorrect statement object for executing query
  • Added more wildcard characters supported for like syntax

Medoo v1.7.7

09 Dec 16:51
Compare
Choose a tag to compare
  • Fixed incorrect statement that calling debug after previous query #882
  • Check table name for tableQuote()

Medoo v1.7.6

26 Oct 06:32
Compare
Choose a tag to compare
  • Fixed error information for statement
  • Fixed data type conversion for select() with single column