[PATCH] (sqlbox) gw/sqlbox_pgsql.c

2006-06-20 Thread Humberto Figuera

Hi,
I hope the list can appreciate it and it to be committed to CVS ;p

--
Humberto Figuera - Using Linux 2.6.16
Usuario GNU/Linux 369709
Caracas - Venezuela
GPG Key Fingerprint = 5AAC DF0C 00F4 2834 28BA  37AD 3364 01D1 74CA 0603
--- ../sqlbox/gw/sqlbox_pgsql.c	2006-06-20 12:05:47.0 -0400
+++ gw/sqlbox_pgsql.c	2006-06-20 13:35:38.0 -0400
@@ -155,10 +155,10 @@
 	}
 
 	/* create send_sms  sent_sms tables if they do not exist */
-	sql = octstr_format(CREATE TABLE IF NOT EXISTS %S (sql_id bigint(20) not null auto_increment primary key, momt enum('MO', 'MT', 'DLR') null, sender varchar(20) null, receiver varchar(20) null, udhdata varchar(255) null, msgdata varchar(255) null, time bigint(20) null, smsc_id varchar(255) null, service varchar(255) null, account varchar(255) null, id bigint(20) null, sms_type bigint(20) null, mclass bigint(20) null, mwi bigint(20) null, coding bigint(20) null, compress bigint(20) null, validity bigint(20) null, deferred bigint(20) null, dlr_mask bigint(20) null, dlr_url varchar(255) null, pid bigint(20) null, alt_dcs bigint(20) null, rpi bigint(20) null, charset varchar(255) null, boxc_id varchar(255) null, binfo varchar(255) null), sqlbox_logtable);
+	sql = octstr_format(CREATE TABLE %S (sql_id SERIAL PRIMARY KEY, momt VARCHAR(3) CHECK(momt IN ('MO', 'MT', 'DLR', NULL)) DEFAULT NULL, sender VARCHAR(20) NULL, receiver VARCHAR(20) NULL, udhdata VARCHAR(255) NULL, msgdata VARCHAR(255) NULL, time BIGINT NULL, smsc_id VARCHAR(255) NULL, service VARCHAR(255) NULL, account VARCHAR(255) NULL, id BIGINT NULL, sms_type BIGINT NULL, mclass BIGINT NULL, mwi BIGINT NULL, coding BIGINT NULL, compress BIGINT NULL, validity BIGINT NULL, deferred BIGINT NULL, dlr_mask BIGINT NULL, dlr_url VARCHAR(255) NULL, pid BIGINT NULL, alt_dcs BIGINT NULL, rpi BIGINT NULL, charset VARCHAR(255) NULL, boxc_id VARCHAR(255) NULL, binfo VARCHAR(255) NULL), sqlbox_logtable);
 	sql_update(sql);
 	octstr_destroy(sql);
-	sql = octstr_format(CREATE TABLE IF NOT EXISTS %S (sql_id bigint(20) not null auto_increment primary key, momt enum('MO', 'MT') null, sender varchar(20) null, receiver varchar(20) null, udhdata varchar(255) null, msgdata varchar(255) null, time bigint(20) null, smsc_id varchar(255) null, service varchar(255) null, account varchar(255) null, id bigint(20) null, sms_type bigint(20) null, mclass bigint(20) null, mwi bigint(20) null, coding bigint(20) null, compress bigint(20) null, validity bigint(20) null, deferred bigint(20) null, dlr_mask bigint(20) null, dlr_url varchar(255) null, pid bigint(20) null, alt_dcs bigint(20) null, rpi bigint(20) null, charset varchar(255) null, boxc_id varchar(255) null, binfo varchar(255) null), sqlbox_insert_table);
+	sql = octstr_format(CREATE TABLE %S (sql_id SERIAL PRIMARY KEY, momt VARCHAR(3) CHECK(momt IN ('MO', 'MT', NULL)) DEFAULT NULL, sender VARCHAR(20) NULL, receiver VARCHAR(20) NULL, udhdata VARCHAR(255) NULL, msgdata VARCHAR(255) NULL, time BIGINT NULL, smsc_id VARCHAR(255) NULL, service VARCHAR(255) NULL, account VARCHAR(255) NULL, id BIGINT NULL, sms_type BIGINT NULL, mclass BIGINT NULL, mwi BIGINT NULL, coding BIGINT NULL, compress BIGINT NULL, validity BIGINT NULL, deferred BIGINT NULL, dlr_mask BIGINT NULL, dlr_url VARCHAR(255) NULL, pid BIGINT NULL, alt_dcs BIGINT NULL, rpi BIGINT NULL, charset VARCHAR(255) NULL, boxc_id VARCHAR(255) NULL, binfo VARCHAR(255) NULL), sqlbox_insert_table);
 	sql_update(sql);
 	octstr_destroy(sql);
 	/* end table creation */
@@ -194,8 +194,8 @@
 	Octstr *stuffer[30];
 	int stuffcount = 0;
 
-	values = octstr_format(NULL, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, st_str(momt), st_str(msg-sms.sender), st_str(msg-sms.receiver), st_str(msg-sms.udhdata), st_str(msg-sms.msgdata), st_num(msg-sms.time), st_str(msg-sms.smsc_id), st_str(msg-sms.service), st_str(msg-sms.account), st_num(msg-sms.sms_type), st_num(msg-sms.mclass), st_num(msg-sms.mwi), st_num(msg-sms.coding), st_num(msg-sms.compress), st_num(msg-sms.validity), st_num(msg-sms.deferred), st_num(msg-sms.dlr_mask), st_str(msg-sms.dlr_url), st_num(msg-sms.pid), st_num(msg-sms.alt_dcs), st_num(msg-sms.rpi), st_str(msg-sms.charset), st_str(msg-sms.boxc_id), st_str(msg-sms.binfo));
-	sql = octstr_format(INSERT INTO %S (sql_id, momt, sender, receiver, udhdata, msgdata, time, smsc_id, service, account, sms_type, mclass, mwi, coding, compress, validity, deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo) VALUES (%S), sqlbox_logtable, values);
+	values = octstr_format(%S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, st_str(momt), st_str(msg-sms.sender), st_str(msg-sms.receiver), st_str(msg-sms.udhdata), st_str(msg-sms.msgdata), st_num(msg-sms.time), st_str(msg-sms.smsc_id), st_str(msg-sms.service), st_str(msg-sms.account), st_num(msg-sms.sms_type), st_num(msg-sms.mclass), st_num(msg-sms.mwi), st_num(msg-sms.coding), st_num(msg-sms.compress), 

RE: [PATCH] (sqlbox) gw/sqlbox_pgsql.c

2006-06-20 Thread Rene Kluwen
Patch is VERY MUCH appreciated and committed to the sqlbox CVS.

I will be honest now and admit that you saved my face due to the Postgres
driver being broken all this time.

Also it seems that Latin America hides some very talentfull and helpfull
Kannel programmers :)

Rene Kluwen
Chimit


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Humberto Figuera
Sent: dinsdag 20 juni 2006 20:11
To: devel@kannel.org
Subject: [PATCH] (sqlbox) gw/sqlbox_pgsql.c


Hi,
I hope the list can appreciate it and it to be committed to CVS ;p

--
Humberto Figuera - Using Linux 2.6.16
Usuario GNU/Linux 369709
Caracas - Venezuela
GPG Key Fingerprint = 5AAC DF0C 00F4 2834 28BA  37AD 3364 01D1 74CA 0603




Re: [PATCH] (sqlbox) gw/sqlbox_pgsql.c

2006-06-20 Thread Mi Reflejo

++1 good catch.

M

On 6/20/06, Rene Kluwen [EMAIL PROTECTED] wrote:

Patch is VERY MUCH appreciated and committed to the sqlbox CVS.

I will be honest now and admit that you saved my face due to the Postgres
driver being broken all this time.

Also it seems that Latin America hides some very talentfull and helpfull
Kannel programmers :)

Rene Kluwen
Chimit


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Humberto Figuera
Sent: dinsdag 20 juni 2006 20:11
To: devel@kannel.org
Subject: [PATCH] (sqlbox) gw/sqlbox_pgsql.c


Hi,
I hope the list can appreciate it and it to be committed to CVS ;p

--
Humberto Figuera - Using Linux 2.6.16
Usuario GNU/Linux 369709
Caracas - Venezuela
GPG Key Fingerprint = 5AAC DF0C 00F4 2834 28BA  37AD 3364 01D1 74CA 0603