473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Abstracting SQL Statements In An Object


I am looking for comments on something that lets me abstract database
updates in an object.

Lemme explain what I am thinking:

Lets say I have an object Person with...

SetFirstName()
SetLastName()

etc.

(Basically the goal is for the development team to use the objects and
not try to write to the database themselves.)

Well, what I am trying to avoid is when I call SetFirstName() and then
call SetLastName() the execution of two UPDATE statements. I would like
to combine it all into one single UPDATE or INSERT so I am not beating
up on the database.

I am thinking I would need to store the changes into variables local to
the class and then maybe calling a SendSQL() function or something like
that to generated SQL changes of the data to the database.

Something like:

$DB->query("BEGIN TRANSACTION");

// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();

// Another object fooling around with $DB
$AnotherOBj->SomeMethod ("Foo");
$AnotherOBj->SendSQL();

$DB->query ("COMMIT TRANSACTION");

Anyhow - opinions and experiences are welcome!
Jul 17 '05 #1
15 2141
Scott Auge wrote:
I am looking for comments on something that lets me abstract database
updates in an object.

Lemme explain what I am thinking:

Lets say I have an object Person with...

SetFirstName()
SetLastName()

etc.

(Basically the goal is for the development team to use the objects and
not try to write to the database themselves.)

Well, what I am trying to avoid is when I call SetFirstName() and then
call SetLastName() the execution of two UPDATE statements. I would like
to combine it all into one single UPDATE or INSERT so I am not beating
up on the database.

I am thinking I would need to store the changes into variables local to
the class and then maybe calling a SendSQL() function or something like
that to generated SQL changes of the data to the database.

Something like:

$DB->query("BEGIN TRANSACTION");

// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();

// Another object fooling around with $DB
$AnotherOBj->SomeMethod ("Foo");
$AnotherOBj->SendSQL();

$DB->query ("COMMIT TRANSACTION");

Anyhow - opinions and experiences are welcome!


Scott,

Generally, classes do not access the database unless specifically requested.
You might have four class members, for instance - fetch(), update(), insert()
and delete(). Each does its respective operations based on the data in the
current object (fetch() usually requires a key).

Another common class is the list class, which fetches an array of objects based
on select criteria.

But no, you do NOT want to update the database every time you issue a
GetFirstName() or SetFirstName(). The former needlessly requires access to the
database, and the latter may update the database when you don't want it updated
(i.e. change the name - but verify the change with the user before actually
updating the database).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 17 '05 #2
You're on the right track. What I like to do is have some 'isDirty'
flag in my class that is initially set to false. When someone calls
$p->setFirstName($ newName) see if the new value is in fact different
from the old. If it is, set isDirty to true.

A commit method of some sort can create and execute the update
statement. First thing he can do is check if isDirty is true. If not,
he doesn't need to do anything.

Additionally, you can call your commit() method in the class destructor
so that any pending changes are written automatically before the object
is destroyed.

Jul 17 '05 #3
take a look at http://www.tonymarston.co.uk/php-mys...seobjects.html
and http://www.tonymarston.co.uk/php-mys...eobjects2.html which
describe how to use objects to perform all your database accessing for you.
The complete code can be found in
http://www.tonymarston.net/php-mysql...plication.html which you can
download and examine at your heart's content.

--
Tony Marston

http://www.tonymarston.net

"Scott Auge" <sc********@yah oo.com> wrote in message
news:sc******** *************** *******@news1.w est.earthlink.n et...

I am looking for comments on something that lets me abstract database
updates in an object.

Lemme explain what I am thinking:

Lets say I have an object Person with...

SetFirstName()
SetLastName()

etc.

(Basically the goal is for the development team to use the objects and
not try to write to the database themselves.)

Well, what I am trying to avoid is when I call SetFirstName() and then
call SetLastName() the execution of two UPDATE statements. I would like
to combine it all into one single UPDATE or INSERT so I am not beating
up on the database.

I am thinking I would need to store the changes into variables local to
the class and then maybe calling a SendSQL() function or something like
that to generated SQL changes of the data to the database.

Something like:

$DB->query("BEGIN TRANSACTION");

// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();

// Another object fooling around with $DB
$AnotherOBj->SomeMethod ("Foo");
$AnotherOBj->SendSQL();

$DB->query ("COMMIT TRANSACTION");

Anyhow - opinions and experiences are welcome!

Jul 17 '05 #4
[FUP: comp.lang.php]

Scott Auge wrote:
<snip>
// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();


IIRC, I have seen similar DB wrappers somewhere, but couldn't
recollect the exact place. And I'm not for this version. FWIW, PHP 5
supports overloading of properties using __set() and __get(); so you
may easily use something like:
$Person->FirstName = 'Something'; instead
$Person->SetFirstName(' Something');

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com

Jul 17 '05 #5
On 2005-07-15, Scott Auge <sc********@yah oo.com> wrote:

I am looking for comments on something that lets me abstract database
updates in an object. Something like:

$DB->query("BEGIN TRANSACTION");

// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();

// Another object fooling around with $DB
$AnotherOBj->SomeMethod ("Foo");
$AnotherOBj->SendSQL();

$DB->query ("COMMIT TRANSACTION");

I work for a company called zedcore.com, and we code php for money. We
have solved this issue. I'll explain what we have done.

For sql we use arrays rather than objects which are then acted upon by
a database object.

I'ts probably easiest if I give you some examples.

$oRst=new Recordset('RstU sers',DATASOURC E);

$oRst->SetDefinitionF romDatasource(a rray('Users'=>' '));

//All fields from Users table added to a recordset.

Example 1 - Basic select
------------------------

$aSQL=array('Co mmand'=>'Select ');
$oRst->ExecuteSQLArr( $aSQL);

Example 2 - Add a where
-----------------------

$aSQL=array();
$aSQL['Command']='Select';
$aSQL['Where']="username='bob '";

$oRst->ExecuteSQLArr( $aSQL);
Example3 - More than one where
--------------------------------

$aSQL=array();
$aSQL['Where']=array();
$aSQL['Where'][]="username='bob '";
$aSQL['Where'][]="accountactive ='t'";
Example4 - ordering
--------------------

$aSQL=array();
$aSQL['Command']='Select';
$aSQL['OrderBy']='UserName';

Example5 - Offset and Limit
---------------------------
$aSQL=array();
$aSQL['Command']='Select';
$aSQL['Limit']=2;
$aSQL['Offset']=10;

Now when we have a recordset we can put tags into our html to refer to
the recordset. Guess what this does:-

<$TEST.RST.RstT est.ANYRECORDS>
<table>
<tr><td><$RST.R stTest.CAPTION. username></td></tr>
<$ITERATE.RST.R stTest>
<tr><td><$RST.R stTest.FIELD.us ername></td></tr>
<$/ITERATE>
</table>
<$TEST.ELSE>
<p> No records</p>
<$/TEST>
But we do more as well. Guess what this does.

<RST.RstTest.PA GER>

<$TEST.RST.RstT est.ANYRECORDS>
<table>
<$RST.RstTest.A LLCAPTIONSORTER >
<$ITERATE.RST.R stTest>
<tr><$RST.RstTe st.ALLFIELDS></tr>
<$/ITERATE>
</table>
<$TEST.ELSE>
<p> No records</p>
<$/TEST>

It does the same as the first template example unless you populate the
recordset with

$oRst->SetSQLArr(arra y('Command'=>'S elect','Limit'= >2));
$oRst->SetSorterPager FromURL();
$oRst->Execute();

To be clear, it allows us to add table headers which will sort the
data and then move to the correct 'page'.

Neat huh?

We are going to gpl our code in the future, but we are busy with paying
work, so it may take some time. I have had a look at all the other
application frameworks for PHP, and excepting ezPublish which I was
half asleep when I was checking I can say our code is superior. Although
in places, less polished. Which is another reason why it has not been
opensourced yet.

zedcore.com will have the news when it comes...

Hope some of this helps! Integration of template engines to a source of
data directly is so convienient..

Jul 30 '05 #6
richard wrote:
On 2005-07-15, Scott Auge <sc********@yah oo.com> wrote:
I am looking for comments on something that lets me abstract database
updates in an object.


Something like:

$DB->query("BEGIN TRANSACTION");

// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();

// Another object fooling around with $DB
$AnotherOBj->SomeMethod ("Foo");
$AnotherOBj->SendSQL();

$DB->query ("COMMIT TRANSACTION");


I work for a company called zedcore.com, and we code php for money. We
have solved this issue. I'll explain what we have done.

For sql we use arrays rather than objects which are then acted upon by
a database object.

I'ts probably easiest if I give you some examples.

$oRst=new Recordset('RstU sers',DATASOURC E);

$oRst->SetDefinitionF romDatasource(a rray('Users'=>' '));

//All fields from Users table added to a recordset.

Example 1 - Basic select
------------------------

$aSQL=array('Co mmand'=>'Select ');
$oRst->ExecuteSQLArr( $aSQL);

Example 2 - Add a where
-----------------------

$aSQL=array();
$aSQL['Command']='Select';
$aSQL['Where']="username='bob '";

$oRst->ExecuteSQLArr( $aSQL);
Example3 - More than one where
--------------------------------

$aSQL=array();
$aSQL['Where']=array();
$aSQL['Where'][]="username='bob '";
$aSQL['Where'][]="accountactive ='t'";
Example4 - ordering
--------------------

$aSQL=array();
$aSQL['Command']='Select';
$aSQL['OrderBy']='UserName';

Example5 - Offset and Limit
---------------------------
$aSQL=array();
$aSQL['Command']='Select';
$aSQL['Limit']=2;
$aSQL['Offset']=10;

Now when we have a recordset we can put tags into our html to refer to
the recordset. Guess what this does:-

<$TEST.RST.RstT est.ANYRECORDS>
<table>
<tr><td><$RST.R stTest.CAPTION. username></td></tr>
<$ITERATE.RST.R stTest>
<tr><td><$RST.R stTest.FIELD.us ername></td></tr>
<$/ITERATE>
</table>
<$TEST.ELSE>
<p> No records</p>
<$/TEST>
But we do more as well. Guess what this does.

<RST.RstTest.PA GER>

<$TEST.RST.RstT est.ANYRECORDS>
<table>
<$RST.RstTest.A LLCAPTIONSORTER >
<$ITERATE.RST.R stTest>
<tr><$RST.RstTe st.ALLFIELDS></tr>
<$/ITERATE>
</table>
<$TEST.ELSE>
<p> No records</p>
<$/TEST>

It does the same as the first template example unless you populate the
recordset with

$oRst->SetSQLArr(arra y('Command'=>'S elect','Limit'= >2));
$oRst->SetSorterPager FromURL();
$oRst->Execute();

To be clear, it allows us to add table headers which will sort the
data and then move to the correct 'page'.

Neat huh?

We are going to gpl our code in the future, but we are busy with paying
work, so it may take some time. I have had a look at all the other
application frameworks for PHP, and excepting ezPublish which I was
half asleep when I was checking I can say our code is superior. Although
in places, less polished. Which is another reason why it has not been
opensourced yet.

zedcore.com will have the news when it comes...

Hope some of this helps! Integration of template engines to a source of
data directly is so convienient..


Gee, that looks a lot like ASP <g>

Seriously - it looks flexible, but overly complicated. I've found in general
the simpler the interface the better. Also, you're interface does not abstract
the sql at all. What happens if the column "username" changes, for instance? A
proper abstraction layer removes all dependencies from the database.

For instance - I've got a problem on one of my customer's sites. Their MySQL
isn't working properly. Their "IT person" is working to identify the problem,
but in the meantime I need to get some stuff up.

So I wrote a couple of classes (i.e. Object and ObjectList) which used a flat
file. Took me an hour or so and I have something which works. When they get
the database problem resolved, it will be a simple matter to drop MySQL based
classes in place of the flat file. Nothing else changes. And since the classes
are in an include file, the source need not change.

Such is the value of real abstraction - which is what I practice.

Oh, and BTW - my company makes money writing PHP, also. I suspect most of us
here work are in the same boat.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 30 '05 #7
Jerry Stuckle wrote:
richard wrote:
On 2005-07-15, Scott Auge <sc********@yah oo.com> wrote:
I am looking for comments on something that lets me abstract database
updates in an object.
Something like:

$DB->query("BEGIN TRANSACTION");

// Person fools around with $DB
$Person->SetFirstName(" Something");
$Person->SetLastName ("Something" );
$Person->SendSQL();

// Another object fooling around with $DB
$AnotherOB j->SomeMethod ("Foo");
$AnotherOB j->SendSQL();

$DB->query ("COMMIT TRANSACTION");


I work for a company called zedcore.com, and we code php for money. We
have solved this issue. I'll explain what we have done.

For sql we use arrays rather than objects which are then acted upon by
a database object.

I'ts probably easiest if I give you some examples.

$oRst=new Recordset('RstU sers',DATASOURC E);

$oRst->SetDefinitionF romDatasource(a rray('Users'=>' '));

//All fields from Users table added to a recordset.

Example 1 - Basic select
------------------------

$aSQL=array('Co mmand'=>'Select ');
$oRst->ExecuteSQLArr( $aSQL);

Example 2 - Add a where
-----------------------

$aSQL=array();
$aSQL['Command']='Select';
$aSQL['Where']="username='bob '";

$oRst->ExecuteSQLArr( $aSQL);
Example3 - More than one where
--------------------------------

$aSQL=array();
$aSQL['Where']=array();
$aSQL['Where'][]="username='bob '";
$aSQL['Where'][]="accountactive ='t'";
Example4 - ordering
--------------------

$aSQL=array();
$aSQL['Command']='Select';
$aSQL['OrderBy']='UserName';

Example5 - Offset and Limit
---------------------------
$aSQL=array();
$aSQL['Command']='Select';
$aSQL['Limit']=2;
$aSQL['Offset']=10;

Now when we have a recordset we can put tags into our html to refer to
the recordset. Guess what this does:-

<$TEST.RST.RstT est.ANYRECORDS>
<table>
<tr><td><$RST.R stTest.CAPTION. username></td></tr>
<$ITERATE.RST.R stTest>
<tr><td><$RST.R stTest.FIELD.us ername></td></tr>
<$/ITERATE>
</table>
<$TEST.ELSE>
<p> No records</p>
<$/TEST>
But we do more as well. Guess what this does.

<RST.RstTest.PA GER>

<$TEST.RST.RstT est.ANYRECORDS>
<table>
<$RST.RstTest.A LLCAPTIONSORTER >
<$ITERATE.RST.R stTest>
<tr><$RST.RstTe st.ALLFIELDS></tr>
<$/ITERATE>
</table>
<$TEST.ELSE>
<p> No records</p>
<$/TEST>

It does the same as the first template example unless you populate the
recordset with

$oRst->SetSQLArr(arra y('Command'=>'S elect','Limit'= >2));
$oRst->SetSorterPager FromURL();
$oRst->Execute();

To be clear, it allows us to add table headers which will sort the
data and then move to the correct 'page'.

Neat huh?

We are going to gpl our code in the future, but we are busy with paying
work, so it may take some time. I have had a look at all the other
application frameworks for PHP, and excepting ezPublish which I was
half asleep when I was checking I can say our code is superior. Although
in places, less polished. Which is another reason why it has not been
opensourced yet.

zedcore.com will have the news when it comes...

Hope some of this helps! Integration of template engines to a source of
data directly is so convienient..


Gee, that looks a lot like ASP <g>


We have never used it. Really?
Seriously - it looks flexible, but overly complicated. I've found in
general the simpler the interface the better. Also, you're interface does
not abstract the sql at all.
As far as database abstraction. You have to have a select or equeivelent,
there has to be a where or equivelent, and there should be somekind of
offset and of limit, and even or orderby. The only place I can see SQL
snaek in is in the 'where's. But that would surely be easy to extend. You
could even parse the sql out it only contains "field operation value" type
stuff.

Then the array is passed via the recordset to some database class that
figures out what it needs to do, and provides that back to the recordset.

The recordset can contain fields from >1 tables, and the sql is abstracted
such that we cover field level securty, automated joins and outer joins.
ther recordset can also contain other recordsets to cover the one to many
relationship and even related recordsets covering the many to many
relationship.

$oRst= new Recordset('Rst' ,DATASOURCE);
$oRst->SetDefinitionF romDatasource(a rray('Users'=>' ','RoleMembers' =>''));

where the following is approximately true:
$gaDatasources[DATASOURCE]['Tables']['Users']=array(
'username'=>arr ay('Type'=>'Tex t','Size'=>'30' ,'Caption'=>'Us er
Name','Validata tion'=>array('N otBlank'),'PriK ey'=>1,'StrToUp per'=>1),
'email'=>array( 'Type'=>'Text', 'Size'=>'200',' Caption'=>'Emai l Address',
'Validation'=>a rray('NotBlank' ,'EmailAddress' ,'Unique'))
);

$gaDatasources[DATASOURCE]['Tables']['Role']=array(
'roleid' =>array('Type'= >'Text','Size'= >10,'Caption'=> 'RoleID'),
'roledesc'=>arr ay('Type'=>'Tex t','Size'=>200, 'Caption'=>'Rol eDesc'),
);

$gaDatasources[DATASOURCE]['Tables']['RoleMembers']=array(
'roleid' =>array('Type'= >'Reference','R efTable'=>'Role ',
'RefField'=>'ro leid', 'RefDisplayFiel d'=>'roledesc') ,
'username'=>arr ay('Type'=>'Ref erence','RefTab le'=>'Users',
'RefField'=>'us ername','RefDis playField'=>'Us erName'),
);

$oRst->ExecuteSQLArr( array('Command' =>'Select'));
So I wrote a couple of classes (i.e. Object and ObjectList) which used a
flat file.Â*Â*TookÂ* meÂ*anÂ*hourÂ*o rÂ*soÂ*andÂ*IÂ* haveÂ*something Â*whichÂ*works
OK, flat file stuff, that's easier.
What happens if the column "username" changes, for
instance? A proper abstraction layer removes all dependencies from the
database.
Well, you need to have some unique thing that represents the column
username, why not use it's name?
Oh, and BTW - my company makes money writing PHP, also. I suspect most of
us here work are in the same boat.


I thought most here have never programmed at all before and would quite like
to make a cms.

Jul 30 '05 #8
On 2005-07-30, richard <ri*****@localh ost.localdomain > wrote:
I work for a company called zedcore.com, and we code php for money. We
have solved this issue. I'll explain what we have done.


[snip code]

These are a couple of questions i have with a lot of classes/functions
that proclaim the query generation:

- Does it allow you add a column LIKE 'value%' instead of
column='value'?

- Does it allow you to have a "complex" condition like
column=MAX(colu mn) or is that translated to column='MAX(col umn)'?

- How does it handle with values like O'Reilly? (It would be silly if
you have to escape the value yourself.)

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be >
Jul 30 '05 #9
richard wrote:
Seriously - it looks flexible, but overly complicated. I've found in
general the simpler the interface the better. Also, you're interface does
not abstract the sql at all.

As far as database abstraction. You have to have a select or equeivelent,
there has to be a where or equivelent, and there should be somekind of
offset and of limit, and even or orderby. The only place I can see SQL
snaek in is in the 'where's. But that would surely be easy to extend. You
could even parse the sql out it only contains "field operation value" type
stuff.


Yes, you need functions to retrieve data, add new data, change the data that is
there and remove old data. There should be some mechanism to sort the data and
possibly even limit the amount of data returned.
Then the array is passed via the recordset to some database class that
figures out what it needs to do, and provides that back to the recordset.

The recordset can contain fields from >1 tables, and the sql is abstracted
such that we cover field level securty, automated joins and outer joins.
ther recordset can also contain other recordsets to cover the one to many
relationship and even related recordsets covering the many to many
relationship.

$oRst= new Recordset('Rst' ,DATASOURCE);
$oRst->SetDefinitionF romDatasource(a rray('Users'=>' ','RoleMembers' =>''));

where the following is approximately true:
$gaDatasources[DATASOURCE]['Tables']['Users']=array(
'username'=>arr ay('Type'=>'Tex t','Size'=>'30' ,'Caption'=>'Us er
Name','Validata tion'=>array('N otBlank'),'PriK ey'=>1,'StrToUp per'=>1),
'email'=>array( 'Type'=>'Text', 'Size'=>'200',' Caption'=>'Emai l Address',
'Validation'=>a rray('NotBlank' ,'EmailAddress' ,'Unique'))
);

$gaDatasources[DATASOURCE]['Tables']['Role']=array(
'roleid' =>array('Type'= >'Text','Size'= >10,'Caption'=> 'RoleID'),
'roledesc'=>arr ay('Type'=>'Tex t','Size'=>200, 'Caption'=>'Rol eDesc'),
);

$gaDatasources[DATASOURCE]['Tables']['RoleMembers']=array(
'roleid' =>array('Type'= >'Reference','R efTable'=>'Role ',
'RefField'=>'ro leid', 'RefDisplayFiel d'=>'roledesc') ,
'username'=>arr ay('Type'=>'Ref erence','RefTab le'=>'Users',
'RefField'=>'us ername','RefDis playField'=>'Us erName'),
);

$oRst->ExecuteSQLArr( array('Command' =>'Select'));


Damn that looks needlessly complicated!
So I wrote a couple of classes (i.e. Object and ObjectList) which used a
flat file. Took me an hour or so and I have something which works

OK, flat file stuff, that's easier.

I find it much harder than database stuff. You need to parse the file, ensuring
that the data is "clean". Searching and sorting must be done manually.
Inserting can be even more difficult. BTW - the same MySQL code took me about
20 minutes to write (it's not a huge table).

Give me a good database any day.
What happens if the column "username" changes, for
instance? A proper abstraction layer removes all dependencies from the
database.

Well, you need to have some unique thing that represents the column
username, why not use it's name?


Again - what if the database changes? For instance - what if someone decides it
should be "user"? Or what happens if they want it as "FirstName" and "LastName"?

Oh, and BTW - my company makes money writing PHP, also. I suspect most of
us here work are in the same boat.

I thought most here have never programmed at all before and would quite like
to make a cms.


I think most here HAVE programmed. There are more questions from the newbies -
but that's because they HAVE more questions.

Personally, I've been programming for almost 40 years. Started doing SQL
programming around 1983 and OO programming somewhere near 1988. Only been doing
PHP for five years or so.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 30 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
97188
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I have written a theme in python for the superkaramba theme engine on kde (see http://netdragon.sourceforge.net - if you are a kde/linux user, it is a great visual applet engine). I have uploaded it to www.kdelook.org for others to download and...
1
1558
by: Scott Auge | last post by:
I am looking for comments on something that lets me abstract database updates in an object. Lemme explain what I am thinking: Lets say I have an object Person with... SetFirstName() SetLastName()
1
3807
by: Tom D | last post by:
I'm rewriting a database interface that our company currently has. Currently it's using the Pear::DB interface, but we found that that was introducing a bit too much overhead. I'm rewriting the interface to use mysqli. Most of what the interface does is to simplify getting results in the form of arrays (ordered and associative). Most of the code using the interface used sql queries with placeholders and parameters. For that reason I'd...
1
1983
by: Frank Rizzo | last post by:
I have an app that has to connect to various data sources (ms sql server, sybase, etc...). For this reason I have OdbcConnection, OleDb Connection and SqlClient objects. When an error happens, I want a single procedure to handle the error from all the connection types by passing the either the SqlException, OdbcException or OleDbException. Unfortunately the object SystemException, that these exceptions have been derived from, does not...
2
1337
by: nevin | last post by:
Hi all, I'm looking at the Amazon web services and get them to work fine. But on any given call I want to be able to use either the US or the EU schemas which are in the project as two different web references. so basically I would like to be able to abstract the objects in each web service so that I can instantiate either one and pass it to a handler which can work with either. Basically the same as you do for two objects inherited...
0
1114
by: Tim Barnes | last post by:
I am going through a revision of my product where I am trying to abstract out the data access layer, where I have traditionally just dragged/dropped data adapters and generated datasets using Visual Studio on my web forms. I am using the following document as a guide: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/BOAGag.asp The problems that I am seeing are that I am getting empty result sets, even tho db...
11
1589
by: Full Decent | last post by:
Hey all! I've been using PHP for a while and I'm hearing that I should look into using it OO. I'm looking into making changes to the program Camera Life (http://fdcl.sf.net). I want to abstract the connection to the database which is currently MYSQL and maybe implement another database, or just leave it open for addition. If I get lucky and get the hang of this, I'd also like to abstract calls to GD. So firstly, is there a good...
1
1281
by: | last post by:
Hi. This is a a semi-newbie question about how to store arbitrary information about my apps such that I can code quickly, mimizing complexity and the number of things I have to hold in my brain. I am going to describe the scheme I'm using, and then I'm going to describe another scheme that may be more OO but that I have not tried. I'm hoping someone vastly smarter and more experienced than me will critique this and/or tell me a yet...
7
20317
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables, if they do not already exist. In terms of ASP/ADO, that would be fine in a SQL Server Sense by a simply ASP/Server-Side JavaScript as such: var cnTemp = Server.CreateObject("ADODB.Connection");
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.