GithubHelp home page GithubHelp logo

laravel-dbmaker's Introduction

DBMaker integration for Laravel Framework

laravel-dbmaker is a DBMaker service provider for Laravel. It provides DBMaker Connection by extending the Illuminate Database component of the laravel framework.

How to install

composer require dbmaker/laravel-odbc To add source in your project

install php_odbc for dbmaker

We suggest using the libary we build

  1. Download URL https://github.com/dbmaker-go/php_ext/releases/download/1.0.0/php_dbmaker-5.4-7.3-Linux2_x86_64.tgz and unzip
  2. According to your DBMaker version to choice bundle or standard
  3. rename pdo_odbc.ini to 20-pdo_odbc.ini and move to /etc/php.d/
  4. copy pdo_odbc.so to /usr/lib64/php/modules/
  5. php -m Check if the installation was successful

you can follow this step

# wget https://github.com/dbmaker-go/php_ext/releases/download/1.0.0/php_dbmaker-5.4-7.3-Linux2_x86_64.tgz
# tar zxvf php_dbmaker-5.4-7.3-Linux2_x86_64.tgz
# mv php_dbmaker/bundle/pdo_odbc.ini /etc/php.d/20-pdo-odbc.ini
# mv php_dbmaker/bundle/pdo_odbc.so /usr/lib64/php/modules/pdo-odbc.so
# php -m

Note: If your default installation directory of DBMaker standard is not /home/dbmaker/5.4 or bundle is not /opt/dbmaker, please add installation directory to LD_LIBRARY_PATH environment variable.

Usage Instructions

It's very simple to configure:

1) Add database to database.php file

'dbmaker' => [
    'driver' => 'odbc',
    'dsn' => 'odbc:DSN=DBNAME',
    'database' => 'DBNAME',
    'host' => 'localhost',
    'username' => 'username',
    'password' => 'password',
    'options' => [
            'idcap' => 1   //please set the value same as your server db_idcap
    ]
]

2) set default database to dbmaker

'default' =>  'dbmaker',

3) testing

# php artisan make:command MyCommand
# vi app/Console/Commands/MyCommand.php

find

protected $signature = 'command:name';

change to

protected $signature = 'my:command';

and add test code

public function handle()
{
    $data= \DB::table('TA1')->get('C1');
	print_R($data);
}
# vi app/Console/Kernel.php
protected $commands = [
    // ...
    Commands\MyCommand::class,  //add this
];

run

# php artisan my:command

Laravel DB Usage

Consult the Laravel framework documentation

laravel-dbmaker's People

Contributors

erycson avatar helloj avatar jessicastcotripal avatar

Watchers

 avatar  avatar

laravel-dbmaker's Issues

Does this project works with PHP 8.1?

I'm having the following error after execute "php artisan server" with PHP 8.1.2. Before, with PHP 7.4.2 everything worked fine:

PHP Fatal error: Declaration of DBMaker\ODBC\DBMakerODBCPdoStatement::fetchAll($how = null, $class_name = null, $ctor_args = null) must be compatible with PDOStatement::fetchAll(int $mode = PDO::FETCH_DEFAULT, mixed ...$args): array in /home/user/Documents/project/api/vendor/dbmaker/laravel-odbc/src/DBMakerODBCPdoStatement.php on line 79

Lavel and DBMAKER at unit testing

Hi!
It isn't an issue, but more a doubt about testing with Laravel in a DBMAKER database.
I have 3 different connections to some databases (one is just to read) and I have the users database witch worked fine with creation and deletion.
When running the tests at Pedidos table (witch is at the 2nd database) it got lost, seams as it is trying to connect to the default database witch is the users one;

Some one has already made tests with Laravel and DBMAKER and could give me some directions?

Migration table keeps been 'trying' to be created after first migration

The issue happens when after been created tables as a first migration, and I trying to add new migrations;

When I run: php artisan migrate
I'm getting the following message:
image

I had before a solution with this repository https://github.com/meta-awesome/metawesome-laravel-odbc/tree/2c43feb5c572336ea570169576dc9bb5af33d7a4
but seems like it stopped to look at DBMakerODBCPdoStatement->execute function...
/** * * @param array $ignore * @return void */ public function execute($ignore = null) { dd(MIGRATION_FLAG); if (!preg_match('/create table "migrations"/i', $this->query) || MIGRATION_FLAG == 0){ odbc_execute($this->statement,$this->params); $this->params = []; } }

The dd message is never shown

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.