www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Database of practicality will be an important factor for development

reply FrankLike <1150015857 qq.com> writes:
    A good language, powerful performance is on the one hand, but, 
first of all is practical.
No language does not involve the database, because the database 
is the most widely used. Why C #, Java are better than D in 
practical? Because the basic work is good and practical!

   There was a language is born for the database, it's called 
PowerBuilder, because it did not keep up with the development of 
the Internet era (B / S architecture), and their own development 
is not good, and later replaced by Java. But now, D even C / S 
architecture is not doing a good job.
   When I'm ready to use D, but found the poor practicality! C #, 
Java can do, but D can not do!
  For example, I want to do the  execution of stored procedure for 
MSSql、MySQL database. I found in Mysql-d, Mysql-Native, arsd, 
DDBC, etc. there is no result. Therefore, the project had to give 
up, turn to C #.

the practicality of database in D , is the basis for the 
development of D, will determine the future of D!

Frank
Feb 01
next sibling parent reply aberba <karabutaworld gmail.com> writes:
On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote:
    A good language, powerful performance is on the one hand, 
 but, first of all is practical.
 No language does not involve the database, because the database 
 is the most widely used. Why C #, Java are better than D in 
 practical? Because the basic work is good and practical!

   There was a language is born for the database, it's called 
 PowerBuilder, because it did not keep up with the development 
 of the Internet era (B / S architecture), and their own 
 development is not good, and later replaced by Java. But now, D 
 even C / S architecture is not doing a good job.
   When I'm ready to use D, but found the poor practicality! C 
 #, Java can do, but D can not do!
  For example, I want to do the  execution of stored procedure 
 for MSSql、MySQL database. I found in Mysql-d, Mysql-Native, 
 arsd, DDBC, etc. there is no result. Therefore, the project had 
 to give up, turn to C #.

 the practicality of database in D , is the basis for the 
 development of D, will determine the future of D!

 Frank
I use mysql with for vibe.d project and either mysql-lited or mysql-native works well for me. There seem to be no mssql package though (because few people will pay to use unless it fetch them enough money for what it is worth). I agree there are still more packages needed but they increase week by week as I've been observing. I personally REALLY need an Amazon S3 api but vibe-s3 maintainer hasn't gotten enough time to work on it and there almost no contributions (even for S3 which is popular/the defacto in the cloud storage world). I know it sucks when you can't do it for yourself. But we can only hope more people get motivated to contribute packages to dub. I'm quite impressed by the few companies in Github contributing/submitting their production packages to dub registry. It is only getting better day in day out. I don't know if there is anything the D Foundation can and will do about that :)
Feb 02
parent FrankLike <1150015857 qq.com> writes:
On Thursday, 2 February 2017 at 12:41:06 UTC, aberba wrote:
 On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote:
 I use mysql with for vibe.d project and either mysql-lited or 
 mysql-native works well for me. There seem to be no mssql 
 package though (because few people will pay to use unless it 
 fetch them enough money for what it is worth).

 [...]
I love D,thank for your answer.
Feb 06
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote:
  For example, I want to do the  execution of stored procedure 
 for MSSql、MySQL database. I found in Mysql-d, Mysql-Native, 
 arsd, DDBC, etc. there is no result.
db.query("CALL my_procedure(args...)"); Should work with any libraries. Stored procedure calls are just another sql string.
Feb 02
next sibling parent reply Shachar Shemesh <shachar weka.io> writes:
On 02/02/17 14:50, Adam D. Ruppe wrote:
 On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote:
  For example, I want to do the  execution of stored procedure for
 MSSql、MySQL database. I found in Mysql-d, Mysql-Native, arsd, DDBC,
 etc. there is no result.
db.query("CALL my_procedure(args...)");
Generally speaking, you really don't want to do that. Ever. This code is how SQL injection vulnerabilities are born. Arguments should ALWAYS be passed out of line of the actual call command, so that the server has no chance of confusing arguments and commands. Sadly, that typically requires a DB library specific to the DB in use. Shachar
Feb 02
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 2 February 2017 at 13:28:48 UTC, Shachar Shemesh 
wrote:
 Arguments should ALWAYS be passed out of line of the actual 
 call command, so that the server has no chance of confusing 
 arguments and commands.
I know. That's exactly what my library does, and I assume all the others listed; `args...` there is a placeholder for binded arguments (the actual call might look something like `db.query("CALL proc(?, ?)", arg, arg2);` or similar). But CALL works the same way as UPDATE, SELECT, INSERT, etc., you can do it in sql without needing a special api function to use it.
 Sadly, that typically requires a DB library specific to the DB 
 in use.
Every generic DB library I have ever seen abstracts placeholder arguments and most do prepared statements, which also abstract such things gnerically. I didn't mention it in my example because EVERYONE (except like universally recognized garbage like php4 lol, but I'll even exclude it because its api isn't generic) does it and I assumed that'd be common knowledge.
Feb 02
prev sibling parent Jack Applegame <japplegame gmail.com> writes:
On Thursday, 2 February 2017 at 13:28:48 UTC, Shachar Shemesh 
wrote:
 On 02/02/17 14:50, Adam D. Ruppe wrote:
 On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote:
  For example, I want to do the  execution of stored procedure 
 for
 MSSql、MySQL database. I found in Mysql-d, Mysql-Native, arsd, 
 DDBC,
 etc. there is no result.
db.query("CALL my_procedure(args...)");
Generally speaking, you really don't want to do that. Ever. This code is how SQL injection vulnerabilities are born. Arguments should ALWAYS be passed out of line of the actual call command, so that the server has no chance of confusing arguments and commands. Sadly, that typically requires a DB library specific to the DB in use. Shachar
Do you really think that Adam does not know what is SQL-injection?
Feb 06
prev sibling parent reply FrankLike <1150015857 qq.com> writes:
On Thursday, 2 February 2017 at 12:50:02 UTC, Adam D. Ruppe wrote:
 On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote:
  For example, I want to do the  execution of stored procedure 
 for MSSql、MySQL database. I found in Mysql-d, Mysql-Native, 
 arsd, DDBC, etc. there is no result.
db.query("CALL my_procedure(args...)"); Should work with any libraries. Stored procedure calls are just another sql string.
The first,thank your arsd,it's good for mssql. But mysqlnative.d is not good. Please look at this: Failed: mysql.protocol.packets.MySQLReceivedException mysql\protocol\commands.d(721): MySQL error: PROCEDURE mydb.myProcedure can't return a result set in the given context Thanks. Frank
Feb 06
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 6 February 2017 at 12:30:11 UTC, FrankLike wrote:
 But mysqlnative.d is not good.
idk, I have never used that one.
Feb 06
parent reply FrankLike <1150015857 qq.com> writes:
On Monday, 6 February 2017 at 14:04:37 UTC, Adam D. Ruppe wrote:
 On Monday, 6 February 2017 at 12:30:11 UTC, FrankLike wrote:
Please help me,thank you. 1. arsd.database.ResultSet MSa = MSSqlCon.query(someCmd1); arsd.database.ResultSet MSb = MSSqlCon.query(someCmd2); int icolNumA = MSa.fieldNames.length; int icolNumB = MSb.fieldNames.length; arsd.database.DatabaseException ..\arsd\mssql.d(63): [Microsoft][ODBC SQL Server Driver]The connection is busy resulting in another hstmt 2.When I run the exe file on another computer(run "ping" is ok),get the err: std.socket.SocketOSException std\socket.d(2755): Unable to connect socket: Can not connect because the target computer actively refused. Thank you. Frank
Feb 06
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 6 February 2017 at 14:17:39 UTC, FrankLike wrote:
 [Microsoft][ODBC SQL Server Driver]The connection is busy 
 resulting in another hstmt
Process one result before trying to do another query. If you need the data stored, you can do foreach and save the parts you want to an array (it returns strings for all data types so you can append it to a string[])
  std.socket.SocketOSException std\socket.d(2755): Unable to 
 connect socket: Can not connect because the target computer 
 actively refused.
Check the firewall or connection accept settings on the computer running the database server, it is probably blocking you.
Feb 06
parent FrankLike <1150015857 qq.com> writes:
On Monday, 6 February 2017 at 14:27:24 UTC, Adam D. Ruppe wrote:
 On Monday, 6 February 2017 at 14:17:39 UTC, FrankLike wrote:
 [Microsoft][ODBC SQL Server Driver]The connection is busy 
 resulting in another hstmt
Process one result before trying to do another query. If you need the data stored, you can do foreach and save the parts you want to an array (it returns strings for all data types so you can append it to a string[])
Thank you. Yes,I do it now,but I find the mysql-Native can do like this.
  std.socket.SocketOSException std\socket.d(2755): Unable to 
 connect socket: Can not connect because the target computer 
 actively refused.
Check the firewall or connection accept settings on the computer running the database server, it is probably blocking you.
Thank you.I test it tomorrow.
Feb 06