finish prototype version
This commit is contained in:
parent
fe9661d611
commit
ee033466f2
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 Designraketen
|
Copyright (c) 2025 Designraketen and Loosen-IT
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
38
build.php
38
build.php
@ -21,22 +21,26 @@ function genericDeepCopy(mixed $data): mixed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Require all enums
|
// Require all enums
|
||||||
require './enums/Propagation.php';
|
require 'enums/Propagation.php';
|
||||||
require './enums/Operator.php';
|
require 'enums/Aggregation.php';
|
||||||
require './enums/Order.php';
|
require 'enums/Operator.php';
|
||||||
require './enums/Charset.php';
|
require 'enums/Order.php';
|
||||||
require './enums/Collation.php';
|
require 'enums/Charset.php';
|
||||||
require './enums/Type.php';
|
require 'enums/Collation.php';
|
||||||
require './enums/Engine.php';
|
require 'enums/Type.php';
|
||||||
require './enums/Join.php';
|
require 'enums/Engine.php';
|
||||||
|
require 'enums/Join.php';
|
||||||
|
|
||||||
// Require all classes
|
// Require all classes
|
||||||
require './Database.php';
|
require 'Database.php';
|
||||||
require './Conditionable.php';
|
require 'Conditionable.php';
|
||||||
require './Deletion.php';
|
require 'Deletion.php';
|
||||||
require './Insertion.php';
|
require 'Insertion.php';
|
||||||
require './Migration.php';
|
require 'Migration.php';
|
||||||
require './Query.php';
|
require 'Query.php';
|
||||||
require './Schema.php';
|
require 'Schema.php';
|
||||||
require './Table.php';
|
require 'Table.php';
|
||||||
require './Update.php';
|
require 'Update.php';
|
||||||
|
|
||||||
|
// Include testing framework
|
||||||
|
require 'tests/TestManager.php';
|
||||||
|
53
index.php
53
index.php
@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Plugin Name: Database Helper
|
|
||||||
* Version: 1.0
|
|
||||||
* Author: Jan-Niclas Loosen (Loosen-IT and Designraketen GmbH)
|
|
||||||
* Author URI: https://example.com
|
|
||||||
* License: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
use DatabaseHelper\Database;
|
|
||||||
use DatabaseHelper\enums\Order;
|
|
||||||
use DatabaseHelper\enums\Type;
|
|
||||||
|
|
||||||
try {
|
|
||||||
require 'build.php';
|
|
||||||
|
|
||||||
$table = Database::makeTable('testing-table')
|
|
||||||
->primary('col-primary', Type::INT, autoInc: true)
|
|
||||||
->column('col-one', Type::BOOL)
|
|
||||||
->column('col-two', Type::STRING)
|
|
||||||
->create();
|
|
||||||
|
|
||||||
$batches = [
|
|
||||||
[
|
|
||||||
['col-one', true],
|
|
||||||
['col-two', 'EXPLODING!!!']
|
|
||||||
],
|
|
||||||
[
|
|
||||||
['col-one', false],
|
|
||||||
['col-two', 'EXPLODING!!!']
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$batchInsert = Database::makeInsertion($table);
|
|
||||||
foreach($batches as $batch) {
|
|
||||||
$batchInsert->batchData($batch)->stack();
|
|
||||||
}
|
|
||||||
$batchInsert->insert();
|
|
||||||
|
|
||||||
Database::makeUpdate($table)
|
|
||||||
->where('col-primary', '=', 1)
|
|
||||||
->set('col-one', false)
|
|
||||||
->update();
|
|
||||||
|
|
||||||
$results = Database::makeQuery($table)
|
|
||||||
->select('col-primary', 'col-one')
|
|
||||||
->where('col-one', '=', true)
|
|
||||||
->orderBy('col-one', Order::DESC)
|
|
||||||
->query();
|
|
||||||
}
|
|
||||||
catch ( Exception $e ) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user