cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] mssql extension

Open fishjerky opened this issue 13 years ago • 19 comments

no one use sqlserver? i am ready to fly with phalcon... but... my db is sqlserver.... i plan to start a phalcon project in a week....

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

fishjerky avatar Sep 01 '13 08:09 fishjerky

Can be considered, the use of ODBC. I try it.

dreamsxin avatar Sep 03 '13 09:09 dreamsxin

i use freetds to connect with sql server.

fishjerky avatar Sep 03 '13 12:09 fishjerky

To complete the expansion, there are several SQL needs to be done: 1.describing a table (column_name, data_type, character_maximum_length, numeric_precision, numeric_scale, is_nullable, constraint_type, column_default, column_id) 2.List all tables on database (table_name, owner) 3.list all views of a schema (view_name) 4.query indexes on a table (table_name, index_name, index_type, column_name) 5.query foreign keys on a table (table_name, column_name, constraint_name, owner, table_name, column_name) I am not familiar with SQLServer, but not installed SQLServer so I can not accomplish this, you can help accomplish them?

dreamsxin avatar Sep 04 '13 08:09 dreamsxin

i do really want to help, but i'm not familiar with C... I will try to implement in Phalcon\Db\Adapter way first.

fishjerky avatar Sep 04 '13 14:09 fishjerky

i had implemeted it in PHP. https://github.com/fishjerky/phalcon-mssql it works well in most cases, but still has some issues. i'll fix it later.

fishjerky avatar Oct 06 '13 16:10 fishjerky

@fishjerky Good.

dreamsxin avatar Oct 08 '13 00:10 dreamsxin

hi, @dreamsxin i have problems passing PaginationTest.php but i can pass ArrayPaginator and ModelPaginator, but not QueryBuilder https://github.com/phalcon/cphalcon/blob/master/unit-tests/PaginatorTest.php#L348 it seems i can' get the items greater than page 2 (page 100 in this case) Do you have any idea? The following is my expansion https://github.com/fishjerky/phalcon-mssql

fishjerky avatar Oct 08 '13 14:10 fishjerky

You can print the sql check:

$builder = $this->modelsManager->createBuilder()
    ->columns('cedula, nombres')
    ->from('Personnes')
    ->orderBy('cedula')
    ->limit(500, 0);

var_dump($builder->getPhql());

SELECT cedula, nombres FROM [Personnes] ORDER BY cedula LIMIT 500 OFFSET 0

Sqlserver does not support the limit

dreamsxin avatar Oct 09 '13 00:10 dreamsxin

as you mentioned, it is SELECT cedula, nombres FROM [Personnes] ORDER BY cedula LIMIT 500 OFFSET 0 i already fix this in my expansion, but ... QueryBuilder doesn't call any function inside adapter or dialect. what can i do?

fishjerky avatar Oct 09 '13 09:10 fishjerky

@fishjerky you can override the method "select" in the dialect to generate the proper SQL that simulate an offset in SQLServer

ghost avatar Oct 09 '13 21:10 ghost

hi, @phalcon . I already did in my expansion https://github.com/fishjerky/phalcon-mssql/blob/master/unit-tests/db/dialect/Mssql.php#L17 i try to echo the final sql statement in "select" method, and got nothing. i think querybuilder didn't call "select".

fishjerky avatar Oct 10 '13 00:10 fishjerky

how you try a join statement?

slackinside avatar Dec 16 '14 10:12 slackinside

+1

ruudboon avatar Oct 24 '15 07:10 ruudboon

+1

brunomdev avatar Aug 01 '16 12:08 brunomdev

@fishjerky as far as i know you don't need to know C know, i know you posted here 3 years ago so you probably not even using phalcon but you can write this mysql dapter in more common language.

Im guessing that dev team like anders or klay are not using mssql anywhere, so to implement this there definitely must be someone who is using it and working on it and know all things about mssql stuff.

Jurigag avatar Aug 01 '16 12:08 Jurigag

Microsoft SQL server support is in the same realm as Oracle. We do have some interest but it is very small. As a result, the Oracle adapter has been moved to the Incubator repository, and the same should happen to MSSQL.

Frankly none of us has the means to accurately test these adapters and automated testing will not work since Travis does not support these.

If you or anyone from the community wants to take the lead and work on the adapter by all means. The documentation has examples on how to work with dialects and how to implement the adapter.

niden avatar Aug 01 '16 12:08 niden

playing deaf... by the way, @Jurigag! i'm still using phalcon .... 1.3....

fishjerky avatar Aug 03 '16 15:08 fishjerky

So maybe it's time to update it ? :D It will be never added to 1.3 since it's dropped like few years ago, you know this right ? Then you can write adapter in zephir. What you mean deaf ? We just don't know mssql, every sql engine has their "things" which can be diffrent from other. Probably no one in dev team know mssql, so why we should start making mssql adapter ? Better someone who already know mssql. And as i wrote - you don't need to know C now to implement it.

Jurigag avatar Aug 03 '16 17:08 Jurigag

With the new mssql docker container available I would like to add this to the voting list @niden

ruudboon avatar Dec 10 '19 06:12 ruudboon