jacquestvanzuydam / laravel-firebird

Firebird Illuminate package for Laravel 5
63 stars 93 forks source link

Name of tables and fields #14

Closed osmarsouza closed 8 years ago

osmarsouza commented 8 years ago

The tables created by artisan migrate in IBOConsole always appears with quotation marks, for use in IBOconsole: select * from "users". To use the pre-existing tables, created in IBOConsole, in laravel whenever I have to do it always with their names and fields in capital letters. I hope I have succeeded in explaining!

Laravel 5.1, Win7, Firebird 2.5

jacquestvanzuydam commented 8 years ago

Yes, I understand that IBOConsole, (which I have never used by the way) would require the table names in capitals. This is typical behaviour of the Firebird database. The quotation marks are something I have no control over as they are generated by the PHP PDO, and in my experience do not change the behaviour of the queries executed server side.

Could you upload the DDL for the table you are testing with?

Having said that, can you also tell me if the migrations table was created successfully in your database?

I must also comment and say that I haven't done any testing in a Windows environment, though the behaviour of the scripts is really down to PHP, so this should make no difference.

osmarsouza commented 8 years ago

I do not know what can be, Using php and pdo, only, all modes working ok. could be something referent to the Dialect!!

<?php try { $str_conn = "firebird:dbname=g:\Sistemas\ControleOS\dados\Roberto\controle.fbr;host=localhost"; $dbh = new PDO($str_conn, "SYSDBA", "masterkey");

$sql1 = 'select first 1 * from pessoa where pessoa.idpessoa = 8318'; $sql2= 'select first 1 * from pessoa where PESSOA.idpessoa = 8318'; $sql3 = 'select first 1 * from PESSOA where PESSOA.IDPESSOA = 8318';

//only $sql3 work in laravel. I have to use all in capital letter. //all work php+pdo without laravel

echo ' Query: '; echo $sql; echo ' result: '; echo ' '; foreach($dbh->query($sql) as $row) { print_r($row); } $dbh = null; } catch (PDOException $e) { print "Erro !: " . $e->getMessage() . "
"; die(); } ?>

image

jacquestvanzuydam commented 8 years ago

Have you used isql to connect to the database and run the queries?

What you're saying doesn't look out of the ordinary, as the tables and columns are case sensitive when the quotation marks are being used.

osmarsouza commented 8 years ago

Yes, isql normally accesses the tables created from the artisan migrate if you use the quotes , exemple: "users" . The laravel App accesses the legacy tableas typically using uppercase letters. How am testing a database already exists will use the uppercase letters , no problem. Thank You.

jacquestvanzuydam commented 8 years ago

Unfortunately, as we can't predict the naming conventions used by other developers this will often be the problem. I personally only use uppercase letters with my database table naming. To keep the flexibility of Laravel and the PHP PDO, I cannot force this onto other developers. Thank you for taking the time to log your questions.