Skip to content

Commit

Permalink
Merge pull request #40 from znframework/5.7
Browse files Browse the repository at this point in the history
5.7.4: Updated version.
  • Loading branch information
ozanuykun committed May 25, 2018
2 parents 7006db0 + 44fabf5 commit 51c44d5
Show file tree
Hide file tree
Showing 51 changed files with 2,296 additions and 482 deletions.
1 change: 1 addition & 0 deletions Internal/composer/autoload_psr4.php
Expand Up @@ -17,6 +17,7 @@
'ZN\\Remote\\' => array($vendorDir . '/package-remote'),
'ZN\\Protection\\' => array($vendorDir . '/package-protection'),
'ZN\\Prompt\\' => array($vendorDir . '/package-prompt'),
'ZN\\Payment\\' => array($vendorDir . '/package-payment'),
'ZN\\Pagination\\' => array($vendorDir . '/package-pagination'),
'ZN\\Language\\' => array($vendorDir . '/package-language'),
'ZN\\Image\\' => array($vendorDir . '/package-image'),
Expand Down
5 changes: 5 additions & 0 deletions Internal/composer/autoload_static.php
Expand Up @@ -22,6 +22,7 @@ class ComposerStaticInit18a22f10e44b8b77ed023b6677d08bad
'ZN\\Remote\\' => 10,
'ZN\\Protection\\' => 14,
'ZN\\Prompt\\' => 10,
'ZN\\Payment\\' => 11,
'ZN\\Pagination\\' => 14,
'ZN\\Language\\' => 12,
'ZN\\Image\\' => 9,
Expand Down Expand Up @@ -93,6 +94,10 @@ class ComposerStaticInit18a22f10e44b8b77ed023b6677d08bad
array (
0 => __DIR__ . '/..' . '/package-prompt',
),
'ZN\\Payment\\' =>
array (
0 => __DIR__ . '/..' . '/package-payment',
),
'ZN\\Pagination\\' =>
array (
0 => __DIR__ . '/..' . '/package-pagination',
Expand Down
33 changes: 33 additions & 0 deletions Internal/package-database/DB.php
Expand Up @@ -226,6 +226,24 @@ public function whereNotJson($column, String $value = '', String $logical = NULL
return $this;
}

/**
* Full Text
*
* 5.7.4[added]
*
* @param string $column
* @param string $value
* @param string $type = NULL
*
* @return string
*/
public function whereFullText($column, String $value = '', String $type = NULL, String $logical = NULL) : DB
{
$this->where('exp:' . $this->db->fullText($column, $this->_escapeStringAddNail($value), $type), '', $logical);

return $this;
}

/**
* Defines SQL WHERE BETWEEN value1 and value2
*
Expand Down Expand Up @@ -904,6 +922,21 @@ public function references(String $table, String $column) : String
return $this->db->references($table, $column);
}

/**
* Foreign Key
*
* 5.7.4[added]
*
* @param string $column
* @param string $references
*
* @return string
*/
public function foreignKey($column = NULL, $references = NULL) : String
{
return $this->db->foreignKey($column, $references);
}

/**
* Defines SQL CHARACTER SET
*
Expand Down
199 changes: 199 additions & 0 deletions Internal/package-database/DBForge.php
Expand Up @@ -11,6 +11,7 @@

use ZN\Support;
use ZN\Datatype;
use ZN\Singleton;

class DBForge extends Connection
{
Expand Down Expand Up @@ -198,6 +199,204 @@ public function addColumn(String $table = NULL, Array $columns = NULL)
return $this->_runExecQuery($query);
}

/**
* Start Auto Increment
*
* 5.7.4[added]
*
* @param string $table
* @param int $start = 0
*
* @return bool
*/
public function startAutoIncrement(String $table, Int $start = 0)
{
$query = $this->forge->startAutoIncrement($this->_p($table), $start);

return $this->_runExecQuery($query);
}

/**
* Start Auto Increment
*
* 5.7.4[added]
*
* @param string $table
* @param int $start = 0
*
* @return bool
*/
public function addAutoIncrement(String $table, String $column = 'id', Int $start = NULL)
{
if( $start !== NULL )
{
$this->startAutoIncrement($table, $start);
}

return $this->modifyColumn($table, [$column => [($db = Singleton::class('ZN\Database\DB'))->int(), $db->autoIncrement()]]);
}

/**
* Add Primary Key
*
* 5.7.4[added]
*
* @param string $table
* @param string $columns
* @param string $constraint = NULL
*
* @return bool
*/
public function addPrimaryKey(String $table = NULL, String $columns, String $constraint = NULL)
{
$query = $this->forge->addPrimaryKey($this->_p($table), $columns, $constraint);

return $this->_runExecQuery($query);
}

/**
* Add Foreign Key
*
* 5.7.4[added]
*
* @param string $table
* @param string $columns
* @param string $reftable
* @param string $refcolumn
* @param string $constraint = NULL
*
* @return bool
*/
public function addForeignKey(String $table = NULL, String $columns, String $reftable, String $refcolumn, String $constraint = NULL)
{
$query = $this->forge->addForeignKey($this->_p($table), $columns, $reftable, $refcolumn, $constraint);

return $this->_runExecQuery($query);
}

/**
* Drop Primary Key
*
* 5.7.4[added]
*
* @param string $table
* @param string $constraint = NULL
*
* @return bool
*/
public function dropPrimaryKey(String $table = NULL, String $constraint = NULL)
{
$query = $this->forge->dropPrimaryKey($this->_p($table), $constraint);

return $this->_runExecQuery($query);
}

/**
* Drop Foreign Key
*
* 5.7.4[added]
*
* @param string $table
* @param string $constraint = NULL
*
* @return bool
*/
public function dropForeignKey(String $table = NULL, String $constraint = NULL)
{
$query = $this->forge->dropForeignKey($this->_p($table), $constraint);

return $this->_runExecQuery($query);
}

/**
* Create index
*
* 5.7.4[added]
*
* @param string $indexName
* @param string $table
* @param string $columns
*
* @return bool
*/
public function createIndex(String $indexName, String $table, String $columns)
{
$query = $this->forge->createIndex($indexName, $this->_p($table), $columns);

return $this->_runExecQuery($query);
}

/**
* Create Unique index
*
* 5.7.4[added]
*
* @param string $indexName
* @param string $table
* @param string $columns
*
* @return bool
*/
public function createUniqueIndex(String $indexName, String $table, String $columns)
{
$query = $this->forge->createUniqueIndex($indexName, $this->_p($table), $columns);

return $this->_runExecQuery($query);
}

/**
* Create Fulltext index
*
* 5.7.4[added]
*
* @param string $indexName
* @param string $table
* @param string $columns
*
* @return bool
*/
public function createFulltextIndex(String $indexName, String $table, String $columns)
{
$query = $this->forge->createFulltextIndex($indexName, $this->_p($table), $columns);

return $this->_runExecQuery($query);
}

/**
* Create Spatial index
*
* 5.7.4[added]
*
* @param string $indexName
* @param string $table
* @param string $columns
*
* @return bool
*/
public function createSpatialIndex(String $indexName, String $table, String $columns)
{
$query = $this->forge->createSpatialIndex($indexName, $this->_p($table), $columns);

return $this->_runExecQuery($query);
}

/**
* Drop index
*
* 5.7.4[added]
*
* @param string $indexName
* @param string $table
*
* @return string
*/
public function dropIndex(String $indexName, String $table = NULL)
{
$query = $this->forge->dropIndex($indexName, $this->_p($table));

return $this->_runExecQuery($query);
}

/**
* Drop Column
*
Expand Down

0 comments on commit 51c44d5

Please sign in to comment.