|
thedarkness
|
 |
« on: June 15, 2007, 01:23:32 AM » |
|
As per a discussion perk and I had today I have begum work on a mysql UDF (user defined function, more on this later). i'm using a relatively new system that I am using as a testing/attack platform ;-) I have done quite a bit on this machine already. Anyway, got this when I tried to install my first function into mysql; mysql> CREATE FUNCTION phpserialize RETURNS STRING SONAME 'libmyphpserialize.so'; ERROR 1126 (HY000): Can't open shared library 'libmyphpserialize.so' (errno: 22 /usr/lib/mysql/libmyphpserialize.so: cannot restore segment prot after reloc: Permission denied) Quick search on google revealed that selinux was the culprit and, sure enough, i had forgotten to set disables in /etc/sysconfig/selinux....... fucking selinux  Cheers, td
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
perkiset
|
 |
« Reply #1 on: June 15, 2007, 07:04:30 AM » |
|
Cripes what a PIA. Looking forward to that project though...
|
|
|
|
|
Logged
|
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
|
|
|
|
thedarkness
|
 |
« Reply #2 on: June 15, 2007, 06:51:43 PM » |
|
LOL, don't get all impatient on me perk, I's working on it massa  BTW, does anyone know if any entitities need to be escaped for php serialized arrays (I imagine " at the very least needs to be escaped)? Is this documented anywhere? I couldn't find anything on php.net Cheers, td
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
perkiset
|
 |
« Reply #3 on: June 15, 2007, 09:33:34 PM » |
|
LOL, don't get all impatient on me perk, I's working on it massa  No pressure at all td.  OK, is it done yet?  jk dude
|
|
|
|
|
Logged
|
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
|
|
|
|
thedarkness
|
 |
« Reply #4 on: June 16, 2007, 01:06:08 AM » |
|
OK, is it done yet?  No, it isn't. Made major progress today (Saturday) though, actually got it to print some output to the screen without barfing garbage, segfaulting, or just doing "nothing"  talk about your steep learning curves, let's just say that putting one of these together is not intuitive. As usual, one must absorb some pain, think I'm over the hump now though, should make mucho progresso tonight. Will keep u posted, patience is a virtue  Cheers, td [edit] BTW, I burned a hell of a lot of time on this today because, as I posted earlier I was using; CREATE FUNCTION phpserialize RETURNS STRING SONAME 'libmyphpserialize.so'; This is for a normal function, I wanted an aggregate function so the command I needed was; CREATE AGGREGATE FUNCTION phpserialize RETURNS STRING SONAME 'libmyphpserialize.so'; It makes a hell of a difference and confused the hell out of me! Oh, and sorry for the thread hijacking. [/edit]
|
|
|
|
« Last Edit: June 16, 2007, 01:12:08 AM by thedarkness »
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
perkiset
|
 |
« Reply #5 on: June 16, 2007, 09:59:00 AM » |
|
Just wanted to post here so that you'd know where your thread moved to TD... split it off the PHP FileGetContents thread...
Also, sounds like it's a headache - seriously, no worries or pressure dude - it'll be great if your get time for it, but don't do that in front of real work... I'ma just playing with you
|
|
|
|
|
Logged
|
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
|
|
|
|
thedarkness
|
 |
« Reply #6 on: June 16, 2007, 05:59:55 PM » |
|
It's cool perk, making progress, kinda fun.
Cheers, td
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
thedarkness
|
 |
« Reply #7 on: June 16, 2007, 09:11:55 PM » |
|
Update: Sunday morning OK, i currently have a working MySQL User Defined Function (UDF) that creates a php serialized array from a single argument query such as; select phpserialize(kw) from keywords; phpserialize being my function. I'm going to continue work on it until I get it doing multiple argument queries (array of arrays) and then I'll turn it loose for testing if anyone is interested. I'll also be doing some tutorials on how this stuff is done so other's don't have to go through as steep a learning curve as I have  Cheers, td
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
perkiset
|
 |
« Reply #8 on: June 17, 2007, 11:47:06 AM » |
|
:rubs hands together in anticipation and wipes drool from edge of mouth:
|
|
|
|
|
Logged
|
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
|
|
|
|
perkiset
|
 |
« Reply #9 on: June 02, 2008, 11:32:31 PM » |
|
Kaboing! Old thread alert... Hey TD - did you ever complete this thingy? I am looking at some rather complicated stored procedures and I'd like to return results as a multidimensional serialized array to PHP. Just as an example, I have transactions that have invoices attached to them, items attached to the invoices, charges attached to the items, payments attached to the invoices... you get the idea. It's a tree of data that does not map at all well to a single View. In my old framework, a rendering box through a web-request against the DB server, PHP on that box did all the queries, converted to XML and shot the whole mess back - XML makes a perfect structure for this sort of asymmetrical data - but PHP multidimensional arrays would do perfectly as well - in fact WAY faster since there's no construction and parsing. My thought is that I could open cursors, walk tables and construct an array that would be returned as one complex lump of text, deserializeable at the calling end. I found a site that has a JSON encoder and it looks pretty good: http://www.mysqludf.org/lib_mysqludf_json/index.php - but I was unable to recompile their source tonight. Perhaps if you took a look at that it could be a simple thing that I'm just unfamiliar with. Anyhoo, if you get a moment could you let me know whatever happened with this? Thanks a lot man, /perk <edit>Added tarball of the source for the JSON encoder</edit>
|
|
|
« Last Edit: June 02, 2008, 11:39:20 PM by perkiset »
|
Logged
|
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
|
|
|
|
perkiset
|
 |
« Reply #10 on: June 03, 2008, 01:35:57 AM » |
|
Update for those reading: TD and I hooked up tonight and got his lib working and have started looking at an extension to this project.
Weigh in if you're interested. Once you get past a couple issues, installing UDFs into MySQL is not bad at all and the speed looks to be REALLY good. TD did a bunch of work figuring out how the UDF framework works and although not entirely pretty, it's workable as well.
G'night all, /p
|
|
|
|
|
Logged
|
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
|
|
|
|
nop_90
|
 |
« Reply #11 on: June 03, 2008, 02:06:03 AM » |
|
@perks & TD http://dev.mysql.com/doc/refman/5.0/en/adding-native-function.htmljust had a look at above for shits and giggles It appears u have to add function to source and recompile, which is very silly. But ........ Function can take var args. So make a function like call_lua("lua-source","function_name",var-args) calling scripted languages from C is a bitch. But link it against lua or python shared library (since they are much easier to embedd) now u could theoretically create native functions in lua or python.
|
|
|
|
|
Logged
|
|
|
|
|