Commit graph

49 commits

Author SHA1 Message Date
dfd800e263
fix: set WHERE for DELET statement only if conditions are provided 2025-07-29 09:40:15 +02:00
ddcd8a2961 fix: $offset not set when passing integer to $limit in limit() (#50)
This PR just sets the `OFFSET` value to `0` if no offset is provided for all calls to `limit()`. This fixes a bug where no `OFFSET` was set if the `$limit` parameter was given an integer.. which was the only allowed type except null anyways.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/50
2025-07-17 11:09:02 +02:00
e062930c41 fix: add missing return statement from deprecated 'for()' method (#49)
Follow-up PR from #46. Forgot to return from the deprecated method.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/49
2025-06-12 12:44:26 +02:00
vlw
814070a52e doc(fix): missed reference of "for()" to "from()" in README (#48)
Of course I missed to change one reference of `for()` to `from()`.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/48
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2025-06-12 12:44:10 +02:00
03868ae784 fix: MySQL->for() deprecation notice since version 3.5.7 (#47)
Wrong version referenced in the deprecation notice added in #46.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/47
2025-06-08 12:32:38 +02:00
00cb7b3297
refactor: rename for() to from() for consistency with MySQL syntax (#46) 2025-06-08 12:01:21 +02:00
vlw
86f8f2ee76 doc: add short list of notable features as well as some style changes (#45)
Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/45
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2025-06-08 11:50:38 +02:00
c64eb96049 fix: add proper Order Enum handling for MySQL->order() (#43)
I made a rushed merge with #41 and it doesn't work properly.. it throws an exception when passing an `Order` enum to the method, because we're only accepting strings. #42

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/43
2025-01-30 09:33:10 +00:00
e65c74797b feat: add ORDER BY statement Enum (#41)
Importable with:
```php
use vlw\MySQL\Order
```
To be used with the `MySQL->order()` method, for example:
```php
$db->for("table")->order(["column" => Order::ASC])->select("*");
```

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/41
2025-01-30 08:16:27 +00:00
64c7bae3cf feat: add protected array property for where statement columns (#40)
This PR adds a compliment for the `MySQL->filter_values` property but for filter columns which can be accessed from a protected scope with `MySQL->filter_columns`

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/40
2025-01-16 13:53:30 +00:00
d5f1efb9b9 feat: expose SQL class properties to protected scope (#39)
Makes sense to make these accessible when extending the MySQL class.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/39
2024-12-20 10:59:02 +00:00
vlw
619f43b3bf fix(doc): remove reference to removed method flatten() from README (#38)
Closes #14

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/38
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2024-09-25 13:28:15 +00:00
vlw
1727247fa7 fix: remove where() method for database models (#37)
This PR removes the `where()` method which I don't think is particularly useful and also very untested since I don't use it personally at all. It's also probably better to do in-model checking for table columns **before** sending it off to this library when required anyways.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/37
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2024-09-25 13:27:55 +00:00
vlw
a536a3bec4 chore: rename of this package to "php-mysql" (#36)
The name I gave this years ago "libmysqldriver" never sat right with me.. okay it might be considered a library for mysql but it's *definitely* not a driver.

Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/36
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2024-09-25 13:27:20 +00:00
adc2fda90a
feat: store last select columns in property (#40) 2024-04-29 08:17:12 +00:00
a19ed09a34
feat(cleanup): remove flatten() class method (#39) 2024-04-29 08:14:45 +00:00
a26db46aae
feat: define custom MySQL WHERE operators (#38)
* feat: add MySQL operators enum

* feat(doc): add custom operators to README
2024-04-16 14:31:38 +00:00
51d62e1763
fix: add quotes around table names (#37) 2024-04-12 16:30:37 +00:00
73b5d858ff
feat: reset definers when a new query starts with for() (#35)
* feat: reset definers on new query start

* feat(doc): add FOR reference to README
2024-02-26 12:51:52 +00:00
98ed26a375
feat: add executor method for DELETE statements (#34)
* feat: add executor for DELETE statements

* feat(doc): add DELETE executor ref to README
2024-02-14 11:01:03 +00:00
df00b63f35
feat: INSERT specified columns by passing assoc array to method (#33)
* feat: named columns for INSERT statements

* feat(doc): add assoc array ref to README
2024-02-14 09:15:24 +00:00
17fa248edb
feat: second int argument instead of assoc array for LIMIT and OFFSET (#32)
* feat: pass null to reset statements

* feat: limit offset as second argument

* fix(doc): change limit method in README
2024-01-12 13:24:04 +01:00
5fefc5d19f
feat: pass null to reset statements (#31) 2024-01-12 13:22:06 +01:00
111bd5c822
fix(doc): example nitpicks in README (#30) 2024-01-11 04:14:22 +01:00
4779b8b824
fix: return types for executor methods (#29)
* fix: fix return types for executor methods

* fix(doc): fix return types for executor methods in README
2024-01-08 14:30:51 +01:00
03235df47b
fix: convert boolean to tinyint (#28) 2024-01-08 14:30:21 +01:00
4ffa2ee24f
feat: return mysqli_result from executor methods (#27)
* feat: return mysqli_result from executor methods

* feat(doc): add mysqli_results ref. to README
2024-01-08 13:14:28 +01:00
3f97e7b1f0
fix: filter column value null in where method (#26) 2023-12-31 17:33:59 +01:00
c1c67d0267
fix: type coercion to list array for params in driver (#25) 2023-12-26 12:42:23 +01:00
0235610bfa
fix: array type coercion for params in driver (#24) 2023-12-26 12:33:38 +01:00
38fe8e5b82
feat(refactor): implement mysqli->execute_query() (#22) 2023-12-24 19:48:36 +01:00
9fe15eb00f
feat(doc): add compat notice (#23) 2023-12-24 19:48:20 +01:00
d9f450112e
fix: passing empty array to where() throws (#21) 2023-11-03 13:40:54 +01:00
f9ec906414
fix: depr. warning when passing null to select() (#18) 2023-11-02 11:54:05 +01:00
eed7a470ed
feat: remove table model by passing null to with() (#19)
* feat: remove table model by passing null to with()

* feat(doc): add with() in README
2023-11-02 11:53:54 +01:00
13720e772e
feat: accept CSV string as columns for select() (#16)
* feat: accept CSV string as columns for select()

* feat(doc): add string doc for select to README
2023-11-02 11:24:20 +01:00
5abcb48010
fix: remove stale class const. argument (#15) 2023-11-02 10:38:21 +01:00
5b78cc2ba2
feat: add flatten() method (#13)
* feat: add flatten() method

* feat(doc): add flatten() to README
2023-11-02 10:36:01 +01:00
8ff61b7275
fix: select() with no table model defined throws error (#12) 2023-10-31 15:38:33 +01:00
84efec8938
feat(refactor): add method chaining instead of multiple method arguments (#10)
* fix: convert indent. to tabs

* feat: add method chaining

* feat(doc): add chaining to README
2023-10-26 15:00:04 +02:00
eb11bca86a
feat: add ORDER BY and LIMIT OFFSET methods (#8)
* feat: add ORDER BY and LIMIT OFFSET methods

* feat(doc): add ORDER BY and LIMIT to README
2023-10-16 13:14:21 +02:00
e501a61712
feat(doc): update for 2.x.x (#7) 2023-09-06 15:41:25 +02:00
32a6cae40a feat(refactor): add get, update, insert abstraction methods 2023-09-06 14:43:15 +02:00
740d61a89b
fix: inherit constructor types from mysqli (#4) 2023-06-11 12:02:12 +02:00
aa73cf987d
feat: add static col and val constructors (#3) 2023-05-30 12:52:20 +02:00
bbfb31707a
fix: root namespace for mysqli classes (#2) 2023-04-24 17:14:46 +02:00
e4feef4226
fix: root namespace for mysqli class (#1)
* fix: use root namespace for mysqli class

* fix(nit): indentation
2023-04-24 17:09:46 +02:00
78316e608d fix: namespace 2023-04-18 21:37:57 +02:00
01f5c3e2f1 initial commit 2023-04-18 21:35:27 +02:00