Jump to content


Photo

New OLE-DB extension for connecting to MS SQL


  • Please log in to reply
30 replies to this topic

#21 argoSquirrel

argoSquirrel
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 12 September 2006 - 03:26 AM

@oops
Why don't you just use a Stored Procedure?  You seem to be about 1 step away already and you would then get to benefit from the inherent benefits of SPs (speed, reusability, lower bandwidth).  It also allows you to better extract the business case into the DB layer, which is (arguably) a better solution.

@Cherny
I seem to be hitting a limit of 255 chars on a varchar return.  I'm just doing a fetch_assoc.  This a problem?

Sorry, it's actually on the update.

#22 chernyshevsky

chernyshevsky
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 12 September 2006 - 04:10 AM

@oops
Why don't you just use a Stored Procedure?  You seem to be about 1 step away already and you would then get to benefit from the inherent benefits of SPs (speed, reusability, lower bandwidth).  It also allows you to better extract the business case into the DB layer, which is (arguably) a better solution.

@Cherny
I seem to be hitting a limit of 255 chars on a varchar return.  I'm just doing a fetch_assoc.  This a problem?

Sorry, it's actually on the update.


Hmmm, you mean when you call a stored-proc? By default, oledb_bind will chop off a string at 255 if maxlen is omitted. Here's the full definition of the function:

oledb_bind ( resource stmt, string param_name, mixed &var, int type [, int is_output [, int is_null [, int maxlen]]] )

Binding to OLEDB_TEXT does not have this limitation.

#23 argoSquirrel

argoSquirrel
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 12 September 2006 - 04:14 AM

@oops
Why don't you just use a Stored Procedure?  You seem to be about 1 step away already and you would then get to benefit from the inherent benefits of SPs (speed, reusability, lower bandwidth).  It also allows you to better extract the business case into the DB layer, which is (arguably) a better solution.

@Cherny
I seem to be hitting a limit of 255 chars on a varchar return.  I'm just doing a fetch_assoc.  This a problem?

Sorry, it's actually on the update.


Hmmm, you mean when you call a stored-proc? By default, oledb_bind will chop off a string at 255 if maxlen is omitted. Here's the full definition of the function:

oledb_bind ( resource stmt, string param_name, mixed &var, int type [, int is_output [, int is_null [, int maxlen]]] )

Binding to OLEDB_TEXT does not have this limitation.


I do have maxlen specified.  I have it set to 1000.  Does oledb_varchar support MAX instead of a integer value? 

Text seems to work fine.

#24 chernyshevsky

chernyshevsky
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 12 September 2006 - 05:01 AM

I do have maxlen specified.  I have it set to 1000.  Does oledb_varchar support MAX instead of a integer value? 

Text seems to work fine.


Oops, the maxlen value wasn't being used. Fixed. Incidently there was another regression involving blob retrieval. Hence three fixes in 0.62:

Fixed oledb_prepare() regression.
Fixed regression with blob retrieval.
Fixed incorrect application of maxlen in oledb_bind().



#25 meloks

meloks
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 October 2006 - 10:54 AM

Do you know if you can force OLE DB do endoding conversion from UCS-2 (MS SQL) to UTF-8 (on web page)?

Regards.

#26 a_sheldon

a_sheldon
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 16 October 2006 - 01:56 PM

Hi, this is great. The only problem i have is that i don't seem to be able to update AD. I can run SELECT queries fine. Is this right or should i be able to update records in AD?

Thanks

#27 chernyshevsky

chernyshevsky
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 17 October 2006 - 01:51 PM

Do you know if you can force OLE DB do endoding conversion from UCS-2 (MS SQL) to UTF-8 (on web page)?

Regards.


The extension does conversion to UTF-8. See the readme file.



#28 chernyshevsky

chernyshevsky
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 17 October 2006 - 01:52 PM

Hi, this is great. The only problem i have is that i don't seem to be able to update AD. I can run SELECT queries fine. Is this right or should i be able to update records in AD?

Thanks


The AD OLE-DB provider only provides read-only access, unfortunately.

#29 argoSquirrel

argoSquirrel
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 18 December 2006 - 08:25 AM

Hey, Cherny.  I took a while off on my project and I'm back working on it now.

I hit a strange error on one of my assoc fetches.  I really can't figure out what is going on with the code as it is basically a copy of code that works elsewhere.  Here is the error in hopes you can tell me what it means from an OLE point of view so I can fix my code.

Warning: oledb_fetch_assoc() [function.oledb-fetch-assoc]: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done in C:\wamp\www\artist.php on line 168

Thanks mate!

Edit: Code blocks made it hard to read.

#30 argoSquirrel

argoSquirrel
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 18 December 2006 - 08:40 AM

Ok, found some hinting of varchar length issues on google and sure enough, I had the varchar length set to MAX in the DB.  I changed it to a fixed length of 8000 and it started working like a champ again.

Just FYI and sorry to bother you all.

#31 argoSquirrel

argoSquirrel
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 31 December 2006 - 05:07 AM

Hey Cherny,

I'm getting some weird behaviour on one of my updates.  I'm binding a variable using OLEDB_TEXT and sending it to a large varchar (2000 or so) and it is having weird issues at 256 chars.  I remember reading somewhere about problems with varchars out to 256 characters and I think I was having this problem before you hinted moving to OLEDB_TEXT.  Well, I just noticed that didn't really solve the problem.  The text length saved is the same as the text I attempted to insert, but it starts to repeat from the beginning and goes on until it is as long as the entered text.

For example:

"Abra Moore (born June 8, 1969 in San Diego, California) is a folk-styled alternative rock singer-songwriter. She is an icon of the Austin, Texas music scene. Her 1997 album Strangest Places spun off the hit "Four Leaf Clover", which saw airplay in Midwest U.S. radio markets and VH1 and MTV2 rotation. Moore's parents named Abra after the heroine of John Steinbeck's East of Eden. She was raised in Puna, Hawaii in a bohemian household that had very strong jazz influences, including jam sessions by guest musicians. When she was 19 she founded Poi Dog Pondering with a group of friends, moving to Los Angeles in 1988 and to Austin in 1992. Moore left the band shortly afterward to pursue a solo career. Her first album was Sing (1995), followed by Strangest Places (1997), which had a companion CD "Live from the Strangest Places", featuring acoustic versions of several tracks from the album.

Abra continued to work on her next studio album "No Fear", while contributing songs to several soundtracks. Amidst rumors of creative differences and contractual conflicts, she changed management and recording companies and the album was eventually shelved, although her record label, J Records, did release promo copies. Most of the songs later appeared in slightly altered versions on her latest album, "Everything Changed" (2004) released on Koch Records."


When inserted using OLEDB_TEXT produces:

Abra Moore (born June 8, 1969 in San Diego, California) is a folk-styled alternative rock singer-songwriter. She is an icon of the Austin, Texas music scene. Her 1997 album Strangest Places spun off the hit "Four Leaf Clover", which saw airplay in Midwest U.S. radio markets and VH1 and MTV2 rotation. Moore's parents named Abra after the heroine of John Steinbeck's East of Eden. She was raised in Puna, Hawaii in a bohemian household that had very strong jazz influences, including jam sessions by guest musicians. When she was 19 she founded Poi Dog Pondering with a group of friends, moving to Los Angeles in 1988 and to Austin in 1992. Moore left the band shortly afterward to pursue a solo career. Her first album was Sing (1995), followed by Strangest Places (1997), which had a companion CD "Live from the Strangest Places", featuring acoustic versions of several tracks from the album.

Abra continued to work on her next studio album "No Fear", while contributing songs to several soundtracks. Amidst rumAbra Moore (born June 8, 1969 in San Diego, California) is a folk-styled alternative rock singer-songwriter. She is an icon of the Austin, Texas music scene. Her 1997 album Strangest Places spun off the hit "Four Leaf Clover", which saw airplay in Midwest U.S. radio markets and VH1 and MTV2 rotation. Moore's parents named Abra after the


Really weird...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users