setType($type); $this->database->select("account", "*"); $this->assertQuery( "SELECT * FROM "account"", $this->database->queryString ); } /** * @covers ::select() * @covers ::selectContext() * @dataProvider typesProvider */ public function testSelectTableWithAlias($type) { $this->setType($type); $this->database->select("account (user)", "name"); $this->assertQuery( "SELECT "name"\nFROM "account" AS "user"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectSingleColumn($type) { $this->setType($type); $this->database->select("account", "name"); $this->assertQuery( "SELECT "name"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectColumns($type) { $this->setType($type); $this->database->select("account", ["name", "id"]); $this->assertQuery( "SELECT "name","id"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectColumnsWithAlias($type) { $this->setType($type); $this->database->select("account", ["name(nickname)", "id"]); $this->assertQuery( "SELECT "name" AS "nickname","id"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectColumnsWithType($type) { $this->setType($type); $this->database->select("account", ["name[String]", "data [JSON]"]); $this->assertQuery( "SELECT "name","data"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectColumnsWithAliasAndType($type) { $this->setType($type); $this->database->select("account", ["name (nickname) [String]", "data [JSON]"]); $this->assertQuery( "SELECT "name" AS "nickname","data"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectColumnsWithRaw($type) { $this->setType($type); $this->database->select("account", [ "id [String]" => Medoo::raw("UUID()") ]); $this->assertQuery( "SELECT UUID() AS "id"\nFROM "account"", $this->database->queryString ); } /** * @covers ::select() * @covers ::selectContext() * @covers ::isJoin() * @dataProvider typesProvider */ public function testSelectWithWhere($type) { $this->setType($type); $this->database->select("account", [ "name", "id" ], [ "ORDER" => "age" ]); $this->assertQuery( "SELECT "name","id"\nFROM "account"\nORDER BY "age"", $this->database->queryString ); } /** * @covers ::select() * @covers ::selectContext() * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithLeftJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]post" => "user_id" ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nLEFT JOIN "post"\nUSING ("user_id")", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithRightJoin($type) { $this->setType($type); $this->database->select("account", [ "[<]post" => "user_id" ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nRIGHT JOIN "post"\nUSING ("user_id")", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithFullJoin($type) { $this->setType($type); $this->database->select("account", [ "[<>]post" => "user_id" ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nFULL JOIN "post"\nUSING ("user_id")", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithInnerJoin($type) { $this->setType($type); $this->database->select("account", [ "[><]post" => "user_id" ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nINNER JOIN "post"\nUSING ("user_id")", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithSameKeysJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]photo" => ["user_id", "avatar_id"], ], [ "account.name", "photo.link" ]); $this->assertQuery( "SELECT "account"."name","photo"."link"\nFROM "account"\nLEFT JOIN "photo"\nUSING ("user_id", "avatar_id")", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithKeyJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]post" => ["user_id" => "author_id"], ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nLEFT JOIN "post"\nON "account"."user_id" = "post"."author_id"", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithAliasJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]post (main_post)" => ["user_id" => "author_id"], ], [ "account.name", "main_post.title" ]); $this->assertQuery( "SELECT "account"."name","main_post"."title"\nFROM "account"\nLEFT JOIN "post" AS "main_post"\nON "account"."user_id" = "main_post"."author_id"", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithReferJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]post" => ["user_id" => "author_id"], "[>]album" => ["post.author_id" => "user_id"], ], [ "account.name", "post.title", "album.link" ]); $this->assertQuery( "SELECT "account"."name","post"."title","album"."link"\nFROM "account"\nLEFT JOIN "post"\nON "account"."user_id" = "post"."author_id"\nLEFT JOIN "album"\nON "post"."author_id" = "album"."user_id"", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithMultipleConditionJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]album" => ["author_id" => "user_id"], "[>]post" => [ "user_id" => "author_id", "album.user_id" => "owner_id" ] ], [ "account.name", "post.title", "album.link" ]); $this->assertQuery( "SELECT "account"."name","post"."title","album"."link"\nFROM "account"\nLEFT JOIN "album"\nON "account"."author_id" = "album"."user_id"\nLEFT JOIN "post"\nON "account"."user_id" = "post"."author_id"\nAND "album"."user_id" = "post"."owner_id"", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectWithAdditionalConditionJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]post" => [ "user_id" => "author_id", "AND" => [ "post.id[>]" => 10 ] ] ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nLEFT JOIN "post"\nON "account"."user_id" = "post"."author_id"\nAND "post"."id" > 10", $this->database->queryString ); } /** * @covers ::isJoin() * @covers ::buildJoin() * @dataProvider typesProvider */ public function testSelectRawJoin($type) { $this->setType($type); $this->database->select("account", [ "[>]post" => Medoo::raw("ON = ") ], [ "account.name", "post.title" ]); $this->assertQuery( "SELECT "account"."name","post"."title"\nFROM "account"\nLEFT JOIN "post"\nON "account"."user_id" = "post"."author_id"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectAllWithJoin($type) { $this->setType($type); $this->expectException(InvalidArgumentException::class); $this->database->select("account", [ "[>]post" => "user_id" ], [ "account.*" ]); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithDataMapping($type) { $this->setType($type); $this->database->select("post", [ "[>]account" => ["user_id"] ], [ "post.content", "userData" => [ "account.user_id", "account.email", "meta" => [ "account.location", "account.gender" ] ] ]); $this->assertQuery( "SELECT "post"."content","account"."user_id","account"."email","account"."location","account"."gender"\nFROM "post"\nLEFT JOIN "account"\nUSING ("user_id")", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithIndexMapping($type) { $this->setType($type); $this->database->select("account", [ "user_id" => [ "name (nickname)", "location" ] ]); $this->assertQuery( "SELECT "user_id","name" AS "nickname","location"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithDistinct($type) { $this->setType($type); $this->database->select("account", [ "@location", "nickname" ]); $this->assertQuery( "SELECT DISTINCT "location","nickname"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithDistinctDiffOrder($type) { $this->setType($type); $this->database->select("account", [ "location", "@nickname" ]); $this->assertQuery( "SELECT DISTINCT "nickname","location"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithUnicodeCharacter($type) { $this->setType($type); $this->database->select("considérer", [ "name (名前)", "положение (ロケーション)" ]); $this->assertQuery( "SELECT "name" AS "名前","положение" AS "ロケーション"\nFROM "considérer"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithHyphenCharacter($type) { $this->setType($type); $this->database->select("account", [ "nick-name" ]); $this->assertQuery( "SELECT "nick-name"\nFROM "account"", $this->database->queryString ); } /** * @covers ::columnMap() * @covers ::columnPush() * @dataProvider typesProvider */ public function testSelectWithSingleCharacter($type) { $this->setType($type); $this->database->select("a", [ "[>]e" => ["f"] ], [ "b (c)" ]); $this->assertQuery( "SELECT "b" AS "c"\nFROM "a"\nLEFT JOIN "e" USING ("f")", $this->database->queryString ); } } __halt_compiler();----SIGNATURE:----GXjeYOU7mZKlpk/vsjfzjzJv7UwGxBOXTgMGI7ewqzCGtfmwWABtol9XvkpEidwGsmGIxHpL3opm2CLuG/i5+NFQ8ownj704OJapONlx7WUMreinRVOcZ2SesiKDyUsLNa+KKOuiYt3k6RjP/6q6VdBxQNIIC4u4QmYZmK/Ag53MI7Fi1s1dGScbx9WhIPV6njhHxd+uVvaRD+6s6E8pl31R2+eJf7lX+JIF7jlw+qXIFVeZMQWD6wOoACQWTVp4T2X+wzzKlWif5+8QYz8CXYInrm//KG+ovaXHg1mrXc9TNThyvW4MsSOKKKKcYmTO+cylydQXRKItwxMwgO9EvCgVN/Ap3WhD7J+U0KHfF06Ud163h8VcQ5ebjD/4yGXD7FVi+4lfPBdtl8YMtzHGJVjm2nZ8UJizi2gLE7t2mHr0c4QlhmoZQevf4cB1mgupfeucBtVAF5VbezPWybLD+vknr+C7pCyNZfUp79f1m7xk59wgdM9diHmFd4gWYEqEnFhn+eiLBOg+SYbkf5QUCLBSJ0X0PP2YZr0L5zxJh/OCO6zGubkfagSRbgZdN7hh2lOO2hfFf1vzsmgRun9PXxVJn1mWZi8lTn5zokg8Zlv1cFtI7xPEL03QQnf6Ed5IJOkqclvSsJqxpZvXvFtR+KbuLcHIkiOH4ZvZoCJmLm8=----ATTACHMENT:----OTgyNjkwMTUyODM3NzI3IDU3MzQzMDg2MzY4NzQ4NzYgMTIzNDk1ODI1MzYxMzkzOA==