Search the web
Sign In
New User? Sign Up
DatabaseTemplateLibrary · The Database Template Library
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 2449 - 2479 of 2479   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries   (Group by Topic) Sort by Date ^  
#2449 From: MENG Xin <zinces@...>
Date: Tue May 12, 2009 1:30 am
Subject: Re: [DTL] Re: Error Message: Statement is not allocated!
zinces@...
Send Email Send Email
 
Corwin,

Limited by my current IT environment, I have to connect SQL Server Express from Ubuntu, because there is no MySQL deployed.

I missed some detail in my error report: I use FreeTDS as SQL Server ODBC driver when using DTL. I use SQL Server Express 2008. It seems FreeTDS is not well compatible with it. Later I tested DTL with "Easysoft SQL Server ODBC driver + SQL Server Express 2008", and "MyODBC + MySQL", both works fine. So I guess the problem is in FreeTDS.

Thanks for your reply!


MENG Xin



On Tue, May 12, 2009 at 02:42, Corwin Joy <corwinjoy@...> wrote:


Well, it's hard to say what is going wrong without more information here. It is a bit strange to be calling SQL Server Express from Ubuntu. It could be something where the MyODBC driver for SQL Server express behaves a bit differently than the usual Microsoft ODBC driver for SQL server which is what we have tested in the past.

Corwin

--- In DatabaseTemplateLibrary@yahoogroups.com, MENG Xin <zinces@...> wrote:
>
> Hi, authors of DTL,
>
> I'm new to DTL and just built it on my Ubuntu 6.06 dapper, with GCC 4.0.3.
>
> I created a DSN to connect to SQL Server Express 2008, and use 'example'
> executable to test. I can pass "TableStructExample()", but failed on
> "CStringExample()" with following message:
>
> !!!!!!!!!!!!!!!!!!!!! Begin Example CStringExample() !!!!!!!!!!!!!!!!!!!!
> Exception thrown
> Exception type: DBException
> Method: DBStmt::GetHSTMT()
> Error Message: Statement is not allocated!
>
> I could you help me on this issues, please?
>
>
>
> Thanks a lot!
>
> MENG Xin
>



#2450 From: "Corwin Joy" <corwinjoy@...>
Date: Sun May 31, 2009 6:09 am
Subject: Re: bulk insert of variant_rows . is it possible?
corwinjoy
Offline Offline
Send Email Send Email
 
Hello hurcan,
Sorry it took me a while to get back to you, been a busy last couple weeks.  It
has been a long time since I did this and I don't remember if I ended up
extending bulk copy to support variant_rows or not.  I think I did not, because
it got too complicated trying to get the dynamically allocated row size, but I
may be wrong about that.  One thing you could try is to remove the overload that
rejects using variant_row and just test what happens.  Otherwise, if you are
really dealing with a totally general table with totally general rows that you
don't know ahead of time then it may be that you have to do a slow / regular
copy since we don't have code in there to do a bulk copy.

Corwin

--- In DatabaseTemplateLibrary@yahoogroups.com, "hurcan solter"
<hurcansolter@...> wrote:
>
> Hello there,
>
> First of all , thank you very much for this very useful library.  being able
to use stl mindset is a boon in a field i am not very competent,so excuse me if
i am asking some stupid questions.
>
>  I am using the library like the following snippet;
>
>  dtl::DynamicDBView<> mDBView("sometable","*")
>
>  dtl::variant_row mRow = mDBView.GetDataObj();
>  for (int i = 0; i < mRow.size(); i++)
>  {
>        mRow[i] = dtl::NullField();
>  }  // only needs to be done once per table.
>
>  dtl::DynamicDBView<>::insert_iterator write_it = mDBView;
>
>  for(int i=0 ; i < someVerytBigNumber; ++i)
> {
>  mRow["Field1"] = somedata[i];
>  mRow["Field2"] = someotherdata[i];
>  *write_it = mRow
> }
>
>   Thing is, this is taking so long ,profiling the code gave me
>
> Routine Name Time Time with Children Shared Time Hit Count
> dtl::DBStmt::Destroy 2.85 2.86 99.96 6320
> dtl::DBStmt::Execute 3.73 3.74 99.93 3159
>
>
> This is for 3159 insertions, I am going to need a thousand times more
insertions than that, so i've thought of bulk_copying a collection of
> mrows would help me,seeing bulk_copy has a signature for variant rows
> on  code completion,only to discover that it was specifically put for
preventing this :) . I am stumped right now.
>
>   Is it possible to ue variant_rows this way? if not what do you advise for
approaching the problem
>
>   Thank in advance;
>
>   hurcan....
>

#2451 From: "Corwin Joy" <corwinjoy@...>
Date: Sun May 31, 2009 6:23 am
Subject: Re: How to do SQL IN query with parameters
corwinjoy
Offline Offline
Send Email Send Email
 
Probably you want to do this via a sql_iterator.
I believe your syntax could work under ODBC but remember that the (?) has to
hold a single parameter.  So here I think that parameter would be a string with
a comma separated list of values.  If it is really variable, it might be easier
to just create the query as a string and run it if performance is not critical. 
As an example here is code (from the Example project) to run a generic sql
statement and grab the results:

// Execute an arbitrary query and prompt for any parameters
void ExecQuery(string sql)
{
	 DynamicDBView<> view(sql, "");
	 DynamicDBView<>::sql_iterator sql_it(view);

	 // Show query
	 cout << sql << "\n\n";

	 // Prompt user for any parameters
	 for (size_t i = 0; i < sql_it.GetBoundParamCount(); i++)
	 {
		 cout << "Please enter the value for parameter number " << i << "\n";
		 string param;
		 cin >> param;

		 sql_it.Params()[i] = param;

	 }

	 // Force an execute in case there is no result set, e.g. INSERT, DELETE
	 *sql_it = view.GetDataObj();

	 // Print results
	 while (sql_it != view.end())
	 {
		 cout << (variant_row)(*sql_it) << "\n";
		 ++sql_it;
	 }
}

void ExecQueryExample() {
	 ExecQuery("SELECT * from DB_EXAMPLE WHERE INT_VALUE = (?)");
}

--- In DatabaseTemplateLibrary@yahoogroups.com, "Robert Bielik"
<robert.bielik@...> wrote:
>
> Hi,
>
> Tried to find out how to do the following:
>
> SELECT * FROM table WHERE entry IN (?)
>
> Is it as simple as having a std::vector< _type_ > as parameter type?
>
> TIA
> /Rob
>

#2452 From: "Corwin Joy" <corwinjoy@...>
Date: Mon Jun 1, 2009 1:07 am
Subject: Re: bulk insert of variant_rows . is it possible?
corwinjoy
Offline Offline
Send Email Send Email
 
Here is what Mike had to say:


From:
"Michael.Gradman"
I do not know if we support bulk inserts for variant_rows. I would think only
with the user providing full hints to the variant_row on all column types would
it even have a chance to work right. One way to maybe mimick getting proper
dynamic column info is to use a dummy select iterator w a variant_row DataObj
and get its column info and use that as a template for bulk insert.

Mike

I remember we even had trouble for awhile with bulk fetch for variant_rows until
you released some fixes.

--- In DatabaseTemplateLibrary@yahoogroups.com, "Corwin Joy" <corwinjoy@...>
wrote:
>
> Hello hurcan,
> Sorry it took me a while to get back to you, been a busy last couple weeks. 
It has been a long time since I did this and I don't remember if I ended up
extending bulk copy to support variant_rows or not.  I think I did not, because
it got too complicated trying to get the dynamically allocated row size, but I
may be wrong about that.  One thing you could try is to remove the overload that
rejects using variant_row and just test what happens.  Otherwise, if you are
really dealing with a totally general table with totally general rows that you
don't know ahead of time then it may be that you have to do a slow / regular
copy since we don't have code in there to do a bulk copy.
>
> Corwin
>
> --- In DatabaseTemplateLibrary@yahoogroups.com, "hurcan solter"
<hurcansolter@> wrote:
> >
> > Hello there,
> >
> > First of all , thank you very much for this very useful library.  being able
to use stl mindset is a boon in a field i am not very competent,so excuse me if
i am asking some stupid questions.
> >
> >  I am using the library like the following snippet;
> >
> >  dtl::DynamicDBView<> mDBView("sometable","*")
> >
> >  dtl::variant_row mRow = mDBView.GetDataObj();
> >  for (int i = 0; i < mRow.size(); i++)
> >  {
> >        mRow[i] = dtl::NullField();
> >  }  // only needs to be done once per table.
> >
> >  dtl::DynamicDBView<>::insert_iterator write_it = mDBView;
> >
> >  for(int i=0 ; i < someVerytBigNumber; ++i)
> > {
> >  mRow["Field1"] = somedata[i];
> >  mRow["Field2"] = someotherdata[i];
> >  *write_it = mRow
> > }
> >
> >   Thing is, this is taking so long ,profiling the code gave me
> >
> > Routine Name Time Time with Children Shared Time Hit Count
> > dtl::DBStmt::Destroy 2.85 2.86 99.96 6320
> > dtl::DBStmt::Execute 3.73 3.74 99.93 3159
> >
> >
> > This is for 3159 insertions, I am going to need a thousand times more
insertions than that, so i've thought of bulk_copying a collection of
> > mrows would help me,seeing bulk_copy has a signature for variant rows
> > on  code completion,only to discover that it was specifically put for
preventing this :) . I am stumped right now.
> >
> >   Is it possible to ue variant_rows this way? if not what do you advise for
approaching the problem
> >
> >   Thank in advance;
> >
> >   hurcan....
> >
>

#2453 From: <michael.gradman@...>
Date: Mon Jun 1, 2009 1:25 am
Subject: Re: [DTL] Re: bulk insert of variant_rows . is it possible?
cppguru777
Offline Offline
Send Email Send Email
 
Corwin,

I have even now gotten a Z-machine called ZaxMidlet to work on my Blackberry!

This means I now can play text adventure games anywhere I go!

Mike

#2454 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 4, 2009 9:25 am
Subject: Having problem with "REPLACE INTO"
robert_bielik
Offline Offline
Send Email Send Email
 
I'm trying MySQL "REPLACE INTO" with sql_iterator, but I get an exception:
"Fetch without a SELECT"

The query looks like:
"REPLACE INTO table VALUES ((?),(?),(?))"

Ideas? I need to INSERT or REPLACE into the table. Any other way?
TIA
/Rob

#2455 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 4, 2009 9:27 am
Subject: [DTL] Re: BPA problem
robert_bielik
Offline Offline
Send Email Send Email
 
--- In DatabaseTemplateLibrary@yahoogroups.com, "Robert Bielik"
<robert.bielik@...> wrote:
>
> --- In DatabaseTemplateLibrary@yahoogroups.com, "Robert Bielik"
> <robert.bielik@> wrote:
>
> > But the bulk fetch works perfectly if I don't use parameters. Problem
> > may be a combination of using parameters with bulk fetch ? I'll try
> > single row fetch with parameters, see if that works.
>
> Nope. Same problem. Works without parameters, but not with :(
>
> /R
>

Should anyone be curious of how this was resolved, it was a problem with the
MySQL ODBC driver (in the Ubuntu 8.04 distro). By using a newer one, it works
fine now.

#2456 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 4, 2009 11:10 am
Subject: Re: Having problem with "REPLACE INTO"
robert_bielik
Offline Offline
Send Email Send Email
 
--- In DatabaseTemplateLibrary@yahoogroups.com, "Robert Bielik"
<robert.bielik@...> wrote:
>
> I'm trying MySQL "REPLACE INTO" with sql_iterator, but I get an exception:
> "Fetch without a SELECT"
>
> The query looks like:
> "REPLACE INTO table VALUES ((?),(?),(?))"
>
> Ideas? I need to INSERT or REPLACE into the table. Any other way?
> TIA
> /Rob
>

Ok, solved it. I erroneusly supplied columns in the BCA to query for. With an
"empty" BCA it works fine.

/Rob

#2457 From: <michael.gradman@...>
Date: Thu Jun 4, 2009 11:15 am
Subject: Re: [DTL] Re: Having problem with "REPLACE INTO"
cppguru777
Offline Offline
Send Email Send Email
 

If REPLACE construct involves replacing records that match particular conditions (like using a WHERE clause) you can use a select_update_iterator to achieve the same results I would think which also allows you to set the matching rows to different new values by marching the iterator and assigning to *iiter followed by ++iter.

Mike


From: DatabaseTemplateLibrary@yahoogroups.com
To: DatabaseTemplateLibrary@yahoogroups.com
Sent: Thu Jun 04 07:10:25 2009
Subject: [DTL] Re: Having problem with "REPLACE INTO"

--- In DatabaseTemplateLibrary@yahoogroups.com, "Robert Bielik" <robert.bielik@...> wrote:
>
> I'm trying MySQL "REPLACE INTO" with sql_iterator, but I get an exception:
> "Fetch without a SELECT"
>
> The query looks like:
> "REPLACE INTO table VALUES ((?),(?),(?))"
>
> Ideas? I need to INSERT or REPLACE into the table. Any other way?
> TIA
> /Rob
>

Ok, solved it. I erroneusly supplied columns in the BCA to query for. With an "empty" BCA it works fine.

/Rob


#2458 From: "Robert Bielik" <robert.bielik@...>
Date: Fri Jun 5, 2009 7:00 am
Subject: [DTL] Re: Having problem with "REPLACE INTO"
robert_bielik
Offline Offline
Send Email Send Email
 
--- In DatabaseTemplateLibrary@yahoogroups.com, <michael.gradman@...> wrote:
>
> If REPLACE construct involves replacing records that match particular
conditions (like using a WHERE clause) you can use a select_update_iterator to
achieve the same results I would think which also allows you to set the matching
rows to different new values by marching the iterator and assigning to *iiter
followed by ++iter.
>

REPLACE INTO is equal to an INSERT or UPDATE (INSERT if row doesn't exist,
UPDATE otherwise), so I don't thing select_update_iterator will suffice.

/Rob

#2459 From: <michael.gradman@...>
Date: Fri Jun 5, 2009 2:58 pm
Subject: RE: [DTL] Re: Having problem with "REPLACE INTO"
cppguru777
Offline Offline
Send Email Send Email
 

What you could do is do something like this:

 

Write code using an IndexedDBView() that provides the kind of behavior you are talking about … of course your IndexedDBView would want to have an underlying DBView that whose BCA binds to all fields and then your IndexedDBView must use a key_mode of USE_PK_FIELDS_ONLY (of course passing your correct primary key fields to the IndexedDBView constructor) and bound mode of BOUND…

 

// template function that emulates a REPLACE INTO call through the use of a IndexedDBView

template <class IdxDBView> void replace_into(IdxDBView &idx_view, const typename IdxDBView::value_type &value)

{

      // see if record with given PK exists

      typename IdxDBView::iterator find_it = idx_view.find(value);

     

      if (find_it != idx_view.end())

      {

          // record found, so UPDATE it

          Idx_view.replace(find_it, value);

      }

      else

      {

          // record not found, so INSERT it

          Idx_view.insert(value);

      }

}

 

// example of use

 

class DataObjClass

{

public:

      int pk_field1;

      int pk_field2;

      string other_field1;

      double other_field2;

 

      DataObjClass() : pk_field1(0), pk_field2(0), other_Field1(), other_field2() { }

 

      DataObjClass(int pk1, int pk2, string of1, double of2) : pk_field1(pk1), pk_field2(pk2), other_field1(of1), other_field2(of2)

      { }

};

 

void foo()

{

     typedef DBView<DataObjClass> DBV;

     typedef IndexedDBView<DBV> IdxView;

 

     // create underlying DBView that has a BCA referring to all fields

     DataObjClass dmy;

     DBV view(“some_tbl”, BCA(dmy, COLS[“pk1”] == dmy.pk_field1 && COLS[“pk2”] == dmy.pk_field2 &&

                                                      COLS[“of1”] == dmy.other_field1 && COLS[“of2”] == dmy.other_field2));

    

     // create IndexedDBView with the correct PK definition

     IdxView idx_view(IdxView::Args().view(view).indexes(“Unique PrimaryKey; pk1, pk2”).key_mode(USE_PK_FIELDS_ONLY).bound(BOUND));

 

     // create some DataObjClass objects and put in idx_view

     // ….

 

     // replace into example call

     replace_into(idx_view, DataObjClass(1, 9, “foo, 0.0));

}

 

Please let us know if this is pretty much suffices for what you are trying to do …

_________________________________________________________________________________________________________________________________________________

Michael Gradman Ÿ Technical Lead, Analytics Ÿ SunGard Ÿ Energy Solutions Ÿ 1331 Lamar Street, Suite 950, Houston, TX 77010

Tel 713-210-8172 Ÿ Mobile 713-670-4226 Ÿ Fax 713-210-8008 Ÿ michael.gradman@...

www.sungard.com/energy

P Think before you print


From: DatabaseTemplateLibrary@yahoogroups.com [mailto:DatabaseTemplateLibrary@yahoogroups.com] On Behalf Of Robert Bielik
Sent: Friday, June 05, 2009 2:01 AM
To: DatabaseTemplateLibrary@yahoogroups.com
Subject: [DTL] Re: Having problem with "REPLACE INTO"

 




--- In DatabaseTemplateLibrary@yahoogroups.com, <michael.gradman@...> wrote:
>
> If REPLACE construct involves replacing records that match particular conditions (like using a WHERE clause) you can use a select_update_iterator to achieve the same results I would think which also allows you to set the matching rows to different new values by marching the iterator and assigning to *iiter followed by ++iter.
>

REPLACE INTO is equal to an INSERT or UPDATE (INSERT if row doesn't exist, UPDATE otherwise), so I don't thing select_update_iterator will suffice.

/Rob


#2460 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 11, 2009 8:09 am
Subject: Performance problem
robert_bielik
Offline Offline
Send Email Send Email
 
I have an SQL query which I run on a remote MySQL db. With SQLyog the total time
(db+transfer) takes ~500 ms (78000 rows) whereas using DTL (release build) takes
~800 ms (78000 rows). I'm using bulk_fetch_helper and have reserved space for
the rows beforehand, is there some other way to increase the performance, or is
this expected?

TIA
/R

#2461 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 25, 2009 6:57 am
Subject: UTF8 strings
robert_bielik
Offline Offline
Send Email Send Email
 
I have an XML which I parse and insert data into a MySQL database, the strings
are in utf8 format, and although I've setup the columns to be utf8 the strings
are stored verbatim, i.e. I see the utf8 escape sequences in the database (using
SQLyog). Before using DTL we just had php put stuff in the database, and that
works fine, showing the correct characters.

Ideas?
/Rob

#2462 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 25, 2009 8:20 am
Subject: Re: [DTL] example_unicode project. - Unicode Wide Character Support in DTL
robert_bielik
Offline Offline
Send Email Send Email
 
--- In DatabaseTemplateLibrary@yahoogroups.com, "Corwin Joy" <cjoy@...> wrote:
>
> Take a look at the tests directory.  All of the tests in here use UNICODE
strings in their build.
> To enable Unicode you will need to set two pre-processor defines called
"UNICODE" and "_UNICODE" as descibed in
http://dtemplatelib.sourceforge.net/Unicode.htm .  These flags are set in the
Visual C++ compile setting for the test project.
>

Hi Corwin, that page states that you can use std::wstring for column data, but I
get compilation failures trying that. I really don't want the fullblown Unicode
version...

/Rob

#2463 From: "Robert Bielik" <robert.bielik@...>
Date: Thu Jun 25, 2009 2:25 pm
Subject: Augmented tcstring for wchar_t
robert_bielik
Offline Offline
Send Email Send Email
 
I solved the wide char issues by changing tcstring<N> to tcstring<N,CharType>,
and fixing some stuff in BoundIO (and elsewhere) so that the wide tcstrings can
be bound natively (not needing a SQLPutData I guess). If you're interested I can
supply a patch. Works for both char and wchar_t. So a member string can be
declared as:

dtl::tcstring<16, wchar_t>  m_member;

and used just as a dtl::tcstring<16>

/Rob

#2464 From: "Jens Weller" <JensWeller@...>
Date: Thu Jun 25, 2009 2:33 pm
Subject: Re: [DTL] UTF8 strings
JensWeller@...
Send Email Send Email
 
Maybe you could let MySQL convert it to utf8:
http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html

But of course its better, if you don't have to convert twice.
There is a library supporting utf8 in C++:
http://utfcpp.sourceforge.net/

Maybe you can try with this library you're luck.
Otherwise there are options for converting charcter-sets widely in
differentlibraries in C++.

Maybe you could also solve the problem, when you run the code under a different
os.

regards,

Jens Weller

-------- Original-Nachricht --------
> Datum: Thu, 25 Jun 2009 06:57:47 -0000
> Von: "Robert Bielik" <robert.bielik@...>
> An: DatabaseTemplateLibrary@yahoogroups.com
> Betreff: [DTL] UTF8 strings

> I have an XML which I parse and insert data into a MySQL database, the
> strings are in utf8 format, and although I've setup the columns to be utf8 the
> strings are stored verbatim, i.e. I see the utf8 escape sequences in the
> database (using SQLyog). Before using DTL we just had php put stuff in the
> database, and that works fine, showing the correct characters.
>
> Ideas?
> /Rob
>
>

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

#2465 From: <michael.gradman@...>
Date: Thu Jun 25, 2009 2:38 pm
Subject: RE: [DTL] Augmented tcstring for wchar_t
cppguru777
Offline Offline
Send Email Send Email
 

Robert,

 

It would probably be well-worth it will you supply this patch.  And maybe you could supply us with some notes about the changes you had to make, because it appears there are other postings on this list dealing with char types that we ought to be able to support …

 

_________________________________________________________________________________________________________________________________________________

Michael Gradman Ÿ Technical Lead, Analytics Ÿ SunGard Ÿ Energy Solutions Ÿ 1331 Lamar Street, Suite 950, Houston, TX 77010

Tel 713-210-8172 Ÿ Mobile 713-670-4226 Ÿ Fax 713-210-8008 Ÿ michael.gradman@...

www.sungard.com/energy

P Think before you print


From: DatabaseTemplateLibrary@yahoogroups.com [mailto:DatabaseTemplateLibrary@yahoogroups.com] On Behalf Of Robert Bielik
Sent: Thursday, June 25, 2009 9:26 AM
To: DatabaseTemplateLibrary@yahoogroups.com
Subject: [DTL] Augmented tcstring for wchar_t

 




I solved the wide char issues by changing tcstring<N> to tcstring<N,CharType>, and fixing some stuff in BoundIO (and elsewhere) so that the wide tcstrings can be bound natively (not needing a SQLPutData I guess). If you're interested I can supply a patch. Works for both char and wchar_t. So a member string can be declared as:

dtl::tcstring<16, wchar_t> m_member;

and used just as a dtl::tcstring<16>

/Rob


#2467 From: "cnygrp" <news4cn@...>
Date: Mon Jun 29, 2009 2:50 am
Subject: MS sql connect with Windows Authentication Possible?
cnygrp
Offline Offline
Send Email Send Email
 
I have an MS sql application that is installed to have local access with Windows
Authentication.  I can CONNECT to this data base from my other utility (php
script) fine with user and password null.  Php appears to automatically use win
authentication when the user/passwd are null.  I have no options to configure my
sql application to be accessed with  SQL authentication.

I have compiled the example with dtl under cygwin fine.  It uses only the sql
authentication.  Is it possible to have Windows Authentication thru DTL ?  If
yes, could some body refer me to an example code for this?  Thanks.  This is my
first post here.

Cordially,

#2468 From: "jarrod.chesney@..." <jarrod.chesney@...>
Date: Sun Jun 28, 2009 9:50 pm
Subject: DTL, mingw, sqlite, windows
jarrod.chesn...
Offline Offline
Send Email Send Email
 
Hi All
	 I have successfully compiled DTL in mingw with msys in windows XP 32 bit
http://www.mingw.org/wiki/msys

To do this, I followed the instructions on how to setup msys.
* Compiled the getopt.c file to a binary from a linux src
util-linux-2.12q.tar.gz
gcc -I../include/ getopt.c -o getopt

* Added #include <windows.h> to the dtl_config.h file. (it would be nice if this
were added in a release). I found this out from another post in this group.
* ran only the build.sh file in the lib directory

If anyone would like more details on this or step by step instructions, Let me
know.

I have also used some of the DTL examples to create a table, insert a record and
then print the record to cout using an ODBC driver for SQLite.
http://www.ch-werner.de/sqliteodbc/
Very exciting.

Pervious to using DTL, I made my own dodgy java ORM (before i knew what an orm
was or that others existed), and used/use python and SQLAlchemy

Thank you for creating this database abstraction, It looks very flexible and
awesome.

#2469 From: "cnygrp" <t4chacko@...>
Date: Sat Jun 27, 2009 9:15 pm
Subject: Connet to a local machine with the Windows Authentication?
cnygrp
Offline Offline
Send Email Send Email
 
I have a specialized ms sql db on WinXP which is configured for Widows
Authentication from the local machine. I can connect to this fine with php
script from the local machine with Win Authentication, and access the db. When I
give the user name and password as null strings, php automatically uses the win
authentication (instead of MS SQL authentication). I have no way of changing my
db's authentication method.

Is there a way from the DTL library to connect to a local machine with the
Windows Authentication?

#2470 From: "Corwin Joy" <corwinjoy@...>
Date: Mon Jul 20, 2009 4:53 pm
Subject: Re: DTL, mingw, sqlite, windows
corwinjoy
Offline Offline
Send Email Send Email
 
You're welcome and I'm glad DTL is useful to you!

#2471 From: "Corwin Joy" <corwinjoy@...>
Date: Mon Jul 20, 2009 4:57 pm
Subject: Re: Connet to a local machine with the Windows Authentication?
corwinjoy
Offline Offline
Send Email Send Email
 
>
> Is there a way from the DTL library to connect to a local machine with the
Windows Authentication?
>

Sure.  DTL just uses an ODBC connection.  So, when you set up the odbc
connection you can simply choose to use Windows Authentication rather than SQL
authentication as described here.

http://www.vmware.com/support/vc13/doc/c3cfgsqlserver6.html

If you are distributing an application, most installers will support creating
ODBC data sources.

#2472 From: "jarrod.chesney@..." <jarrod.chesney@...>
Date: Sat Aug 8, 2009 11:22 am
Subject: DBView KeyMode SQLite
jarrod.chesn...
Offline Offline
Send Email Send Email
 
Hi
I've been using DTL for about a month now.
I'm fairly sure i'm not using it the most optimal way but any way...

I'm having trouble with my select update iterator.

Here is my function for storing

template<class DataObj> bool
TcTblManyBase<DataObj>::Store(const DataObj& prmRecord)
{
    // construct view
    typename dtl::DBView<DataObj>::Args lArgs;
    lArgs.tables(m_DbViewTablesValue);
    lArgs.conn(m_DbConnection);
    lArgs.key_mode(dtl::USE_PK_FIELDS_ONLY);

    dtl::DBView<DataObj> lDbView(lArgs);
    lDbView.SetAutoKey(m_SqlKeyFields);

    typename dtl::DBView<DataObj>::select_update_iterator lItrDbSelectUpdate =
lDbView;
    typename dtl::DBView<DataObj>::insert_iterator lItrDbInsert = lDbView;

    // Search for the record in the database
    lItrDbSelectUpdate = std::find(lDbView.begin(),lDbView.end(), prmRecord);

    // If the record wasn't found, Insert it.
    if (!(prmRecord == *lItrDbSelectUpdate))
    {
       *lItrDbInsert = prmRecord;
       lItrDbInsert++;
    }
    // Else if it was found but isn't completely identical, update it

    else if (!prmRecord.IsEqual(*lItrDbSelectUpdate))
    {

       *lItrDbSelectUpdate = prmRecord;
       lItrDbSelectUpdate++;
    }

    return true;
}

The only problem is, that the SQL gets executed, it uses all fields in the where
clause.
I tried playing with the "key" and "key_mode" but it still does.
I looked at the code in DBView and I was still unable to get it to work the way
i want.
Which is to use only the primary key fields in the where clause for the update.

Anyone know how to make it only use the primary key fields?

#2473 From: "jarrod.chesney@..." <jarrod.chesney@...>
Date: Sun Aug 9, 2009 12:18 pm
Subject: Update Fixed
jarrod.chesn...
Offline Offline
Send Email Send Email
 
Hi, I seemed to have got it going.
I moved the keys assignment to the select_insert_iterator after it has selected
stuff.


template<class DataObj> bool
TcTblManyBase<DataObj>::Store(const DataObj& prmRecord)
{
    // construct view
    typename dtl::DBView<DataObj>::Args lArgs;
    lArgs.tables(m_DbViewTablesValue);
    lArgs.conn(m_DbConnection);

    dtl::DBView<DataObj> lDbView(lArgs);

    typename dtl::DBView<DataObj>::select_update_iterator lItrDbSelectUpdate =
lDbView;
    typename dtl::DBView<DataObj>::insert_iterator lItrDbInsert = lDbView;

    // Search for the record in the database
    lItrDbSelectUpdate = std::find(lDbView.begin(),lDbView.end(), prmRecord);

    // If the record wasn't found, Insert it.
    if (!(prmRecord == *lItrDbSelectUpdate))
    {
       *lItrDbInsert = prmRecord;
       lItrDbInsert++;
    }
    // Else if it was found but isn't completely identical, update it

    else if (!prmRecord.IsEqual(*lItrDbSelectUpdate))
    {
       // Set the key fields for the update
       if (m_SqlKeyFields.size() > 0)
       {
          lItrDbSelectUpdate.SetKey(m_SqlKeyFields);
       }

       *lItrDbSelectUpdate = prmRecord;
       lItrDbSelectUpdate++;
    }

    return true;
}

#2474 From: "jarrod.chesney@..." <jarrod.chesney@...>
Date: Tue Aug 18, 2009 9:14 am
Subject: bulk fetch/insert
jarrod.chesn...
Offline Offline
Send Email Send Email
 
Hi All
I've spent ages looking through the documentation about this.
I am still unsure...

If i have an array of 10 objects and i call bulk_fetch, how do i know if there
were only 5 objects to retrieve?

#2475 From: "corwinjoy" <corwinjoy@...>
Date: Thu Aug 27, 2009 8:03 pm
Subject: Re: bulk fetch/insert
corwinjoy
Offline Offline
Send Email Send Email
 
--- In DatabaseTemplateLibrary@yahoogroups.com, "jarrod.chesney@..."
<jarrod.chesney@...> wrote:
>
> Hi All
> I've spent ages looking through the documentation about this.
> I am still unsure...
>
> If i have an array of 10 objects and i call bulk_fetch, how do i know if there
were only 5 objects to retrieve?
>

If you are using bulk_fetch_helper then you can just apply std::distance on your
output iterator.
E.g.
output_iterator output_beg, output;
bulk_fetch_helper(view.begin(), 128, output);
num_records = std::distance(output_beg, output);

If you are using the raw bulk fetch just take a look at dtl_algo.h: 131 where
bulk_fetch_helper is defined.  To get the number of records you do something
like:

bulk_copy(read_it, buf_begin, buf_end,true, row_size);

numRecordsFetched = read_it.GetLastCount();

#2476 From: "Kvorak" <kvorak@...>
Date: Mon Oct 26, 2009 3:54 pm
Subject: Question regarding library configuration
kvorak
Offline Offline
Send Email Send Email
 
Hey all,

   So I'm trying to use the DTL and I've come across a strange thing.  When I
build the example project in release mode that was shipped with the libarary,
everything works.  The Examples run fine and the library looks like a great
idea.  But for the life of me I can't figure out how to include it in my own
projects.
   The problem I am having is that when I build I get an error message saying,
"error C4430: missing type specifier - int assumed: Note: C++ does not support
default-int".  So I did a search for that error.  There was a message on this
board that suggested commenting out the offending line (line 448 in boundio.h).
   My aversion to this is that the library worked when I built it in the project
that was shipped with it.  I'd rather trust that the library is in good working
order and that it was a project configuration or something before I go and edit
code I didn't write.
   So is there any additional wisdom out there regarding what might be going on
or how to fix it?  Thanks.

Kvorak

#2477 From: "CorwinJ" <corwinjoy@...>
Date: Fri Oct 30, 2009 11:11 pm
Subject: Re: Question regarding library configuration
corwinjoy
Offline Offline
Send Email Send Email
 
Hey Kvorak,
I'm not sure exactly how you are getting this error or how to reproduce it.  I
just did a debug build of the example project using VS 2008 and don't see this
error.  Make sure you are using the same defines in your project that you have
in the .lib you built e.g. for debug:

WIN32;_DEBUG;DTL_UC

So, I don't think you should need to comment anything out, you may just be
missing a define in your project that you set up.  See the readme that comes
with dtl for details.

Thanks,

Corwin

--- In DatabaseTemplateLibrary@yahoogroups.com, "Kvorak" <kvorak@...> wrote:
>
> Hey all,
>
>   So I'm trying to use the DTL and I've come across a strange thing.  When I
build the example project in release mode that was shipped with the libarary,
everything works.  The Examples run fine and the library looks like a great
idea.  But for the life of me I can't figure out how to include it in my own
projects.
>   The problem I am having is that when I build I get an error message saying,
"error C4430: missing type specifier - int assumed: Note: C++ does not support
default-int".  So I did a search for that error.  There was a message on this
board that suggested commenting out the offending line (line 448 in boundio.h).
>   My aversion to this is that the library worked when I built it in the
project that was shipped with it.  I'd rather trust that the library is in good
working order and that it was a project configuration or something before I go
and edit code I didn't write.
>   So is there any additional wisdom out there regarding what might be going on
or how to fix it?  Thanks.
>
> Kvorak
>

#2478 From: "Kvorak" <kvorak@...>
Date: Fri Nov 6, 2009 10:13 pm
Subject: Re: Question regarding library configuration
kvorak
Offline Offline
Send Email Send Email
 
Hey Corwin,

Yeah, looks like that was problem... at least that one.  I am having some real
trouble using this library, though in other ways.  For instance, I have a
project, a Console Application project that I was using to test it out in.  It
seems to work fine.  However, when I try #include "DTL.h" into my MFC project
(where I really need it to work anyway) and try to build, I get 73 compiler
errors... most of them in dbconnection.h.  Why would it compile in one project
format and not another?  I read the readme file (something I rarely do) and
added the #define DTL_USE_MFC line but nothing changed.  I'd really like some
assistance with this if anyone is available.  I could even move the whole
project onto my svn server if it would help.  Thanks for the answer to previous
post... just had to match the #defines... doesn't look like this is the same
problem though....

Kvorak

--- In DatabaseTemplateLibrary@yahoogroups.com, "CorwinJ" <corwinjoy@...> wrote:
>
> Hey Kvorak,
> I'm not sure exactly how you are getting this error or how to reproduce it.  I
just did a debug build of the example project using VS 2008 and don't see this
error.  Make sure you are using the same defines in your project that you have
in the .lib you built e.g. for debug:
>
> WIN32;_DEBUG;DTL_UC
>
> So, I don't think you should need to comment anything out, you may just be
missing a define in your project that you set up.  See the readme that comes
with dtl for details.
>
> Thanks,
>
> Corwin
>
> --- In DatabaseTemplateLibrary@yahoogroups.com, "Kvorak" <kvorak@> wrote:
> >
> > Hey all,
> >
> >   So I'm trying to use the DTL and I've come across a strange thing.  When I
build the example project in release mode that was shipped with the libarary,
everything works.  The Examples run fine and the library looks like a great
idea.  But for the life of me I can't figure out how to include it in my own
projects.
> >   The problem I am having is that when I build I get an error message
saying, "error C4430: missing type specifier - int assumed: Note: C++ does not
support default-int".  So I did a search for that error.  There was a message on
this board that suggested commenting out the offending line (line 448 in
boundio.h).
> >   My aversion to this is that the library worked when I built it in the
project that was shipped with it.  I'd rather trust that the library is in good
working order and that it was a project configuration or something before I go
and edit code I didn't write.
> >   So is there any additional wisdom out there regarding what might be going
on or how to fix it?  Thanks.
> >
> > Kvorak
> >
>

#2479 From: "Kvorak" <kvorak@...>
Date: Mon Nov 9, 2009 3:37 pm
Subject: Re: Question regarding library configuration
kvorak
Offline Offline
Send Email Send Email
 
Okay, so I figured this out over the weekend... sort of.

It would appear that the

#define DTL_USE_MFC
#include "DTL.h"

lines need to be placed /before/ the call the #include "stdafx.h".  I've never
seen this before, but it works.  Any ideas why?

Kvorak

--- In DatabaseTemplateLibrary@yahoogroups.com, "Kvorak" <kvorak@...> wrote:
>
> Hey Corwin,
>
> Yeah, looks like that was problem... at least that one.  I am having some real
trouble using this library, though in other ways.  For instance, I have a
project, a Console Application project that I was using to test it out in.  It
seems to work fine.  However, when I try #include "DTL.h" into my MFC project
(where I really need it to work anyway) and try to build, I get 73 compiler
errors... most of them in dbconnection.h.  Why would it compile in one project
format and not another?  I read the readme file (something I rarely do) and
added the #define DTL_USE_MFC line but nothing changed.  I'd really like some
assistance with this if anyone is available.  I could even move the whole
project onto my svn server if it would help.  Thanks for the answer to previous
post... just had to match the #defines... doesn't look like this is the same
problem though....
>
> Kvorak
>
> --- In DatabaseTemplateLibrary@yahoogroups.com, "CorwinJ" <corwinjoy@> wrote:
> >
> > Hey Kvorak,
> > I'm not sure exactly how you are getting this error or how to reproduce it. 
I just did a debug build of the example project using VS 2008 and don't see this
error.  Make sure you are using the same defines in your project that you have
in the .lib you built e.g. for debug:
> >
> > WIN32;_DEBUG;DTL_UC
> >
> > So, I don't think you should need to comment anything out, you may just be
missing a define in your project that you set up.  See the readme that comes
with dtl for details.
> >
> > Thanks,
> >
> > Corwin
> >
> > --- In DatabaseTemplateLibrary@yahoogroups.com, "Kvorak" <kvorak@> wrote:
> > >
> > > Hey all,
> > >
> > >   So I'm trying to use the DTL and I've come across a strange thing.  When
I build the example project in release mode that was shipped with the libarary,
everything works.  The Examples run fine and the library looks like a great
idea.  But for the life of me I can't figure out how to include it in my own
projects.
> > >   The problem I am having is that when I build I get an error message
saying, "error C4430: missing type specifier - int assumed: Note: C++ does not
support default-int".  So I did a search for that error.  There was a message on
this board that suggested commenting out the offending line (line 448 in
boundio.h).
> > >   My aversion to this is that the library worked when I built it in the
project that was shipped with it.  I'd rather trust that the library is in good
working order and that it was a project configuration or something before I go
and edit code I didn't write.
> > >   So is there any additional wisdom out there regarding what might be
going on or how to fix it?  Thanks.
> > >
> > > Kvorak
> > >
> >
>

Messages 2449 - 2479 of 2479   Oldest  |  < Older  |  Newer >  |  Newest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help