FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MSSQL/Sybase support now in SVN

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Tue Jan 09, 2007 8:59 pm    Post subject: MSSQL/Sybase support now in SVN Reply with quote

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

example
---------

Code:

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
---------
Code:

Preliminary FreeTDS support (MSSQL, Sybase)
 * Only a few types have been tested
   * varchar, nvarchar
   * int
   * float
   * datetime, smalldatetime
   * money, smallmoney
 * As with all existing dbi's, this one only returns strings
   * so dates come at you like yyyy-mm-dd hh:nn:ss
   * 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.
   * !MssqlError.d needs to be coded
   * 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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group