www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - DDBI gets MSSQL/Sybase support

reply Brad Anderson <brad dsource.org> writes:
http://www.dsource.org/projects/ddbi/wiki/FreeTDSSubproject
http://www.dsource.org/projects/ddbi/changeset/44

example
---------

# import dbi.mssql.MssqlDatabase;
# import dbi.Row;
# import std.stdio;
#
# void main() {
#
#   MssqlDatabase db = new MssqlDatabase();
#   db.connect("server 1433","username","password");
#
#   Row[] rows = db.queryFetchAll("USE dbname; SELECT * FROM test;");
#
#   foreach (Row row; rows) {
#     writefln("%-10s %3s %-20s %7s %11s %11s ",
#              row["testStr"],
#              row["testInt"],
#              row["anotherStr"],
#              row["flt"],
#              row["smmoney"],
#              row["smdate"]);
#   }
#   db.close();
#
# }

changelog
---------
# Preliminary FreeTDS support (MSSQL, Sybase)
#
#     * Only a few types have been tested
#           o varchar, nvarchar
#           o int
#           o float
#           o datetime, smalldatetime
#           o money, smallmoney
#     * As with all existing dbi's, this one only returns strings
#           o so dates come at you like yyyy-mm-dd hh:nn:ss
#           o there's a rounding error in money,smallmoney - can only get 2
#             decimal places, should be able to get 4
#     * No error messages are being presented to the user yet.
#           o MssqlError.d needs to be coded
#           o CS_SERVERMSG and src/ctlib/unittests/common.c look promising
#             here
#     * Bindings (thanks to bcd.gen) were for FreeTDS 0.64RC2, but should work
#       across a wide range of versions
#     * Within FreeTDS, the ctlib was used
#
# only tested on Linux - not Windows yet - give it a whirl and report back

Cheers,
BA
Jan 09 2007
next sibling parent "ideage" <lsina 126.com> writes:
Thanks for hard work.

I will test on windows.

ideage from china. 
Jan 09 2007
prev sibling parent reply kris <fu bar.org> writes:
Brad Anderson wrote:
 http://www.dsource.org/projects/ddbi/wiki/FreeTDSSubproject
 http://www.dsource.org/projects/ddbi/changeset/44
 
 example
 ---------
 
 # import dbi.mssql.MssqlDatabase;
 # import dbi.Row;
 # import std.stdio;
 #
 # void main() {
 #
 #   MssqlDatabase db = new MssqlDatabase();
 #   db.connect("server 1433","username","password");
 #
 #   Row[] rows = db.queryFetchAll("USE dbname; SELECT * FROM test;");
 #
 #   foreach (Row row; rows) {
 #     writefln("%-10s %3s %-20s %7s %11s %11s ",
 #              row["testStr"],
 #              row["testInt"],
 #              row["anotherStr"],
 #              row["flt"],
 #              row["smmoney"],
 #              row["smdate"]);
 #   }
 #   db.close();
 #
 # }
 
 changelog
 ---------
 # Preliminary FreeTDS support (MSSQL, Sybase)
 #
 #     * Only a few types have been tested
 #           o varchar, nvarchar
 #           o int
 #           o float
 #           o datetime, smalldatetime
 #           o money, smallmoney
 #     * As with all existing dbi's, this one only returns strings
 #           o so dates come at you like yyyy-mm-dd hh:nn:ss
 #           o there's a rounding error in money,smallmoney - can only get 2
 #             decimal places, should be able to get 4
 #     * No error messages are being presented to the user yet.
 #           o MssqlError.d needs to be coded
 #           o CS_SERVERMSG and src/ctlib/unittests/common.c look promising
 #             here
 #     * Bindings (thanks to bcd.gen) were for FreeTDS 0.64RC2, but should work
 #       across a wide range of versions
 #     * Within FreeTDS, the ctlib was used
 #
 # only tested on Linux - not Windows yet - give it a whirl and report back
 
 Cheers,
 BA

Nice work, Brad ... Any possibility of getting more data-types than char[] exposed?
Jan 11 2007
parent reply Brad Anderson <brad dsource.org> writes:
kris wrote:
 Brad Anderson wrote:
 http://www.dsource.org/projects/ddbi/wiki/FreeTDSSubproject
 http://www.dsource.org/projects/ddbi/changeset/44

 example
 ---------

 # import dbi.mssql.MssqlDatabase;
 # import dbi.Row;
 # import std.stdio;
 #
 # void main() {
 #
 #   MssqlDatabase db = new MssqlDatabase();
 #   db.connect("server 1433","username","password");
 #
 #   Row[] rows = db.queryFetchAll("USE dbname; SELECT * FROM test;");
 #
 #   foreach (Row row; rows) {
 #     writefln("%-10s %3s %-20s %7s %11s %11s ",
 #              row["testStr"],
 #              row["testInt"],
 #              row["anotherStr"],
 #              row["flt"],
 #              row["smmoney"],
 #              row["smdate"]);
 #   }
 #   db.close();
 #
 # }

 changelog
 ---------
 # Preliminary FreeTDS support (MSSQL, Sybase)
 #
 #     * Only a few types have been tested
 #           o varchar, nvarchar
 #           o int
 #           o float
 #           o datetime, smalldatetime
 #           o money, smallmoney
 #     * As with all existing dbi's, this one only returns strings
 #           o so dates come at you like yyyy-mm-dd hh:nn:ss
 #           o there's a rounding error in money,smallmoney - can only
 get 2
 #             decimal places, should be able to get 4
 #     * No error messages are being presented to the user yet.
 #           o MssqlError.d needs to be coded
 #           o CS_SERVERMSG and src/ctlib/unittests/common.c look
 promising
 #             here
 #     * Bindings (thanks to bcd.gen) were for FreeTDS 0.64RC2, but
 should work
 #       across a wide range of versions
 #     * Within FreeTDS, the ctlib was used
 #
 # only tested on Linux - not Windows yet - give it a whirl and report
 back

 Cheers,
 BA

Nice work, Brad ... Any possibility of getting more data-types than char[] exposed?

Yes, it's being set up for the new Row object - I'm working with h3r3tic and void[]s to enable this. BA
Jan 11 2007
parent kris <fu bar.org> writes:
Brad Anderson wrote:
 kris wrote:
 
Brad Anderson wrote:

http://www.dsource.org/projects/ddbi/wiki/FreeTDSSubproject
http://www.dsource.org/projects/ddbi/changeset/44

example
---------

# import dbi.mssql.MssqlDatabase;
# import dbi.Row;
# import std.stdio;
#
# void main() {
#
#   MssqlDatabase db = new MssqlDatabase();
#   db.connect("server 1433","username","password");
#
#   Row[] rows = db.queryFetchAll("USE dbname; SELECT * FROM test;");
#
#   foreach (Row row; rows) {
#     writefln("%-10s %3s %-20s %7s %11s %11s ",
#              row["testStr"],
#              row["testInt"],
#              row["anotherStr"],
#              row["flt"],
#              row["smmoney"],
#              row["smdate"]);
#   }
#   db.close();
#
# }

changelog
---------
# Preliminary FreeTDS support (MSSQL, Sybase)
#
#     * Only a few types have been tested
#           o varchar, nvarchar
#           o int
#           o float
#           o datetime, smalldatetime
#           o money, smallmoney
#     * As with all existing dbi's, this one only returns strings
#           o so dates come at you like yyyy-mm-dd hh:nn:ss
#           o there's a rounding error in money,smallmoney - can only
get 2
#             decimal places, should be able to get 4
#     * No error messages are being presented to the user yet.
#           o MssqlError.d needs to be coded
#           o CS_SERVERMSG and src/ctlib/unittests/common.c look
promising
#             here
#     * Bindings (thanks to bcd.gen) were for FreeTDS 0.64RC2, but
should work
#       across a wide range of versions
#     * Within FreeTDS, the ctlib was used
#
# only tested on Linux - not Windows yet - give it a whirl and report
back

Cheers,
BA

Nice work, Brad ... Any possibility of getting more data-types than char[] exposed?

Yes, it's being set up for the new Row object - I'm working with h3r3tic and void[]s to enable this. BA

freakin awesome :p
Jan 13 2007