|
14 | 14 |
|
15 | 15 | Add the following in the require section of your **composer.json**: |
16 | 16 |
|
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 |
24 | 18 | ```json |
25 | | -"uepg/laravel-sybase": "~2.0" |
| 19 | +"uepg/laravel-sybase": "~4.0" |
26 | 20 | ``` |
27 | 21 |
|
28 | 22 | Update the package dependencies executing: |
@@ -53,18 +47,23 @@ Update your **config/database.php's** default driver with the settings for the * |
53 | 47 | return [ |
54 | 48 | ... |
55 | 49 |
|
| 50 | + |
56 | 51 | 'connections' => [ |
57 | 52 | ... |
58 | 53 |
|
59 | 54 | 'sybase' => [ |
60 | | - 'driver' => 'sqlsrv', |
| 55 | + 'driver' => 'sybasease', |
61 | 56 | 'host' => env('DB_HOST', 'sybase.myserver.com'), |
62 | 57 | 'port' => env('DB_PORT', '5000'), |
63 | 58 | 'database' => env('DB_DATABASE', 'mydatabase'), |
64 | 59 | 'username' => env('DB_USERNAME', 'user'), |
65 | 60 | 'password' => env('DB_PASSWORD', 'password'), |
66 | 61 | 'charset' => 'utf8', |
67 | 62 | 'prefix' => '', |
| 63 | + 'cache_tables' => true, |
| 64 | + 'cache_time' => 3600, |
| 65 | + 'application_encoding' => false, |
| 66 | + 'application_charset' => '', |
68 | 67 | ], |
69 | 68 |
|
70 | 69 | ... |
@@ -101,6 +100,29 @@ The file is usualy found in **/etc/freetds/freetds.conf**. Set the configuration |
101 | 100 | tds version = 5.0 |
102 | 101 | ``` |
103 | 102 |
|
| 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 | + |
104 | 126 | ## Setting to use numeric data type |
105 | 127 |
|
106 | 128 | In the migration file you must replace `use Illuminate\Database\Schema\Blueprint;` with `use Uepg\LaravelSybase\Database\Schema\Blueprint;`. See the following example: |
|
0 commit comments