Skip to content

Commit 0bcf725

Browse files
authored
Merge pull request #111 from uepg/v4
sync v2
2 parents a4947b1 + f89f9e4 commit 0bcf725

File tree

15 files changed

+747
-666
lines changed

15 files changed

+747
-666
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
/vendor
22
composer.lock
3+
4+
.idea
5+
6+
phpunit.xml
7+
.env.testing
8+
/.phpunit.cache/test-results
9+
/.phpunit.result.cache

README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@
1414

1515
Add the following in the require section of your **composer.json**:
1616

17-
### Laravel 5.1, 5.2, 5.3
18-
19-
```json
20-
"uepg/laravel-sybase": "~1.0"
21-
```
22-
### Laravel 5.4, 5.5, 5.6, 5.7, 5.8, 6.x, 7.x, 8.x, 9.x
23-
17+
### Laravel >=7.x
2418
```json
25-
"uepg/laravel-sybase": "~2.0"
19+
"uepg/laravel-sybase": "~4.0"
2620
```
2721

2822
Update the package dependencies executing:
@@ -53,18 +47,23 @@ Update your **config/database.php's** default driver with the settings for the *
5347
return [
5448
...
5549

50+
5651
'connections' => [
5752
...
5853

5954
'sybase' => [
60-
'driver' => 'sqlsrv',
55+
'driver' => 'sybasease',
6156
'host' => env('DB_HOST', 'sybase.myserver.com'),
6257
'port' => env('DB_PORT', '5000'),
6358
'database' => env('DB_DATABASE', 'mydatabase'),
6459
'username' => env('DB_USERNAME', 'user'),
6560
'password' => env('DB_PASSWORD', 'password'),
6661
'charset' => 'utf8',
6762
'prefix' => '',
63+
'cache_tables' => true,
64+
'cache_time' => 3600,
65+
'application_encoding' => false,
66+
'application_charset' => '',
6867
],
6968

7069
...
@@ -101,6 +100,29 @@ The file is usualy found in **/etc/freetds/freetds.conf**. Set the configuration
101100
tds version = 5.0
102101
```
103102

103+
## Configuring the charset conversion
104+
This package offers to method to charset conversion, it can be converted in application layer or in database layer, we offered both methods because it can be useful for debugging, to config the application layer conversion you need to set up the following entries on the `database.php` file. You can view an example of the application encoding setup below:
105+
106+
```
107+
To use the database layer conversion add the property charset to connection configuration on the sybase configuration array
108+
109+
```charset
110+
'charset' => 'utf8',
111+
'application_encoding' => false,
112+
'application_charset' => '',
113+
```
114+
115+
116+
117+
## Configuring the cache
118+
As the library consults table information whenever it receives a request, caching can be used to avoid excessive queries
119+
120+
To use the cache, add the property `cache_tables` to the database.php connection configuration, you can customize the time of the cache with the property `cache_time` in the same configuration
121+
```dotenv
122+
'cache_tables' => true,
123+
'cache_time' => 3600
124+
```
125+
104126
## Setting to use numeric data type
105127

106128
In the migration file you must replace `use Illuminate\Database\Schema\Blueprint;` with `use Uepg\LaravelSybase\Database\Schema\Blueprint;`. See the following example:

composer.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uepg/laravel-sybase",
3-
"description": "Sybase based Eloquent module extension for Laravel 5.x.",
3+
"description": "Sybase based Eloquent module extension for Laravel 10.x",
44
"keywords": [
55
"sybase"
66
],
@@ -13,17 +13,26 @@
1313
{
1414
"name": "Ademir Mazer Junior",
1515
"email": "[email protected]"
16+
},
17+
{
18+
"name": "Matheus Bueno Bartkevicius",
19+
"email": "[email protected]"
1620
}
1721
],
1822
"support": {
1923
"issues": "https://github.com/uepg/laravel-sybase/issues",
2024
"wiki": "https://github.com/uepg/laravel-sybase/wiki"
2125
},
2226
"require": {
23-
"php": "^5.6.4 || ^7.0 || ^8.0",
24-
"doctrine/dbal": "^2.5",
25-
"illuminate/database": "5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*|9.*",
26-
"illuminate/support": "5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*|9.*"
27+
"php": ">=8.1",
28+
"doctrine/dbal": "^3.5.1",
29+
"illuminate/database": ">=8.0",
30+
"illuminate/support": ">=8.0",
31+
"ext-pdo": "*"
32+
},
33+
"require-dev": {
34+
"orchestra/testbench": "^8.5",
35+
"nunomaduro/collision": "^7.4"
2736
},
2837
"extra": {
2938
"laravel": {
@@ -37,7 +46,13 @@
3746
},
3847
"autoload": {
3948
"psr-4": {
40-
"Uepg\\LaravelSybase\\": "src/"
49+
"Uepg\\LaravelSybase\\": "src/",
50+
"Tests\\": "tests/"
4151
}
52+
},
53+
"scripts": {
54+
"post-autoload-dump": [
55+
"@php vendor/bin/testbench package:discover --ansi"
56+
]
4257
}
4358
}

phpunit.xml.dist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
beStrictAboutTestsThatDoNotTestAnything="false"
4+
colors="true"
5+
processIsolation="false"
6+
stopOnError="false"
7+
stopOnFailure="false"
8+
cacheDirectory=".phpunit.cache"
9+
backupStaticProperties="false">
10+
<testsuites>
11+
<testsuite name="Laravel Sybase Test Suite">
12+
<directory suffix="Test.php">./tests</directory>
13+
</testsuite>
14+
</testsuites>
15+
<php>
16+
<ini name="date.timezone" value="UTC-3" />
17+
<ini name="intl.default_locale" value="C.UTF-8" />
18+
<ini name="memory_limit" value="2048M" />
19+
<env name="DB_CONNECTION" value="testing" />
20+
</php>
21+
</phpunit>

0 commit comments

Comments
 (0)