Skip to content

Commit cfbf038

Browse files
committed
Refactor tests phase I
1 parent 77edcd0 commit cfbf038

File tree

3 files changed

+382
-56
lines changed

3 files changed

+382
-56
lines changed

test/dataTypeAssist.js

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,139 @@ assist.nullValueSupport = function(connection, tableName, done) {
291291
], done);
292292
}
293293

294+
assist.DATE_STRINGS =
295+
[
296+
"TO_DATE('2005-01-06','YYYY-DD-MM') ",
297+
"TO_DATE('2005-09-01', 'YYYY-MM-DD')",
298+
"TO_DATE('2005-08-05', 'YYYY-MM-DD')",
299+
"TO_DATE('07-05-1998', 'MM-DD-YYYY')",
300+
"TO_DATE('07-05-1998', 'DD-MM-YYYY')",
301+
"TO_TIMESTAMP('1999-12-01 11:10:01.00123', 'YYYY-MM-DD HH:MI:SS.FF')"
302+
];
303+
304+
// for TIMESTAMP WITHOUT TIME ZONE
305+
assist.TIMESTAMP_STRINGS =
306+
[
307+
"TO_TIMESTAMP('2005-01-06', 'YYYY-DD-MM') ",
308+
"TO_TIMESTAMP('2005-09-01', 'YYYY-MM-DD')",
309+
"TO_TIMESTAMP('2005-08-05', 'YYYY-MM-DD')",
310+
"TO_TIMESTAMP('07-05-1998', 'MM-DD-YYYY')",
311+
"TO_TIMESTAMP('07-05-1998', 'DD-MM-YYYY')",
312+
"TO_TIMESTAMP('2005-09-01 07:05:19', 'YYYY-MM-DD HH:MI:SS')",
313+
"TO_TIMESTAMP('1999-12-01 11:00:00.1', 'YYYY-MM-DD HH:MI:SS.FF')",
314+
"TO_TIMESTAMP('1999-12-01 11:00:00.12', 'YYYY-MM-DD HH:MI:SS.FF')",
315+
"TO_TIMESTAMP('1999-12-01 11:00:00.123', 'YYYY-MM-DD HH:MI:SS.FF')",
316+
"TO_TIMESTAMP('1999-12-01 11:01:10.0123', 'YYYY-MM-DD HH:MI:SS.FF')",
317+
"TO_TIMESTAMP('1999-12-01 11:00:00.1234', 'YYYY-MM-DD HH:MI:SS.FF')",
318+
"TO_TIMESTAMP('1999-12-01 11:00:00.00123', 'YYYY-MM-DD HH:MI:SS.FF')",
319+
"TO_TIMESTAMP('1999-12-01 11:00:00.12345', 'YYYY-MM-DD HH:MI:SS.FF')",
320+
"TO_TIMESTAMP('1999-12-01 11:00:00.123456', 'YYYY-MM-DD HH:MI:SS.FF')",
321+
"TO_TIMESTAMP('1999-12-01 11:00:00.1234567', 'YYYY-MM-DD HH:MI:SS.FF')",
322+
"TO_TIMESTAMP('1999-12-01 11:02:20.0000123', 'YYYY-MM-DD HH:MI:SS.FF')",
323+
"TO_TIMESTAMP('1999-12-01 11:00:00.12345678', 'YYYY-MM-DD HH:MI:SS.FF')",
324+
"TO_TIMESTAMP('1999-12-01 11:00:00.123456789', 'YYYY-MM-DD HH:MI:SS.FF')",
325+
"TO_TIMESTAMP('10-Sep-02 14:10:10.123000', 'DD-Mon-RR HH24:MI:SS.FF')"
326+
];
327+
328+
// content serves as reference logs
329+
assist.content =
330+
{
331+
dates:
332+
[
333+
'Wed, 01 Jun 2005 07:00:00 GMT',
334+
'Thu, 01 Sep 2005 07:00:00 GMT',
335+
'Fri, 05 Aug 2005 07:00:00 GMT',
336+
'Sun, 05 Jul 1998 07:00:00 GMT',
337+
'Thu, 07 May 1998 07:00:00 GMT',
338+
'Wed, 01 Dec 1999 18:10:01 GMT'
339+
],
340+
timestamps:
341+
[
342+
'Wed, 01 Jun 2005 07:00:00 GMT',
343+
'Thu, 01 Sep 2005 07:00:00 GMT',
344+
'Fri, 05 Aug 2005 07:00:00 GMT',
345+
'Sun, 05 Jul 1998 07:00:00 GMT',
346+
'Thu, 07 May 1998 07:00:00 GMT',
347+
'Thu, 01 Sep 2005 14:05:19 GMT',
348+
'Wed, 01 Dec 1999 18:00:00 GMT',
349+
'Wed, 01 Dec 1999 18:00:00 GMT',
350+
'Wed, 01 Dec 1999 18:00:00 GMT',
351+
'Wed, 01 Dec 1999 18:01:10 GMT',
352+
'Wed, 01 Dec 1999 18:00:00 GMT',
353+
'Wed, 01 Dec 1999 18:00:00 GMT',
354+
'Wed, 01 Dec 1999 18:00:00 GMT',
355+
'Wed, 01 Dec 1999 18:00:00 GMT',
356+
'Wed, 01 Dec 1999 18:00:00 GMT',
357+
'Wed, 01 Dec 1999 18:02:20 GMT',
358+
'Wed, 01 Dec 1999 18:00:00 GMT',
359+
'Wed, 01 Dec 1999 18:00:00 GMT',
360+
'Tue, 10 Sep 2002 21:10:10 GMT'
361+
]
362+
};
363+
364+
assist.allDataTypeNames =
365+
{
366+
"oracledb_timestamp1" : "TIMESTAMP",
367+
"oracledb_date" : "DATE"
368+
};
369+
370+
assist.sqlCreateTable = function(tableName)
371+
{
372+
var createTab =
373+
"BEGIN " +
374+
" DECLARE " +
375+
" e_table_exists EXCEPTION; " +
376+
" PRAGMA EXCEPTION_INIT(e_table_exists, -00942); " +
377+
" BEGIN " +
378+
" EXECUTE IMMEDIATE ('DROP TABLE " + tableName + " '); " +
379+
" EXCEPTION " +
380+
" WHEN e_table_exists " +
381+
" THEN NULL; " +
382+
" END; " +
383+
" EXECUTE IMMEDIATE (' " +
384+
" CREATE TABLE " + tableName +" ( " +
385+
" num NUMBER(10), " +
386+
" content " + assist.allDataTypeNames[tableName] + ", " +
387+
" CONSTRAINT " + tableName + "_pk PRIMARY KEY (num) " +
388+
" )" +
389+
" '); " +
390+
"END; ";
391+
392+
return createTab;
393+
}
394+
395+
assist.sqlCreateProcedure = function(tableName)
396+
{
397+
var createProc =
398+
"CREATE OR REPLACE PROCEDURE testproc (p_out OUT SYS_REFCURSOR) " +
399+
"AS " +
400+
"BEGIN " +
401+
" OPEN p_out FOR " +
402+
" SELECT * FROM " + tableName + "; " +
403+
"END; ";
404+
405+
return createProc;
406+
}
407+
408+
/*assist.sqlCreateSequence = function(seqName)
409+
{
410+
var createSeq =
411+
"BEGIN " +
412+
" DECLARE " +
413+
" e_seq_exists EXCEPTION; " +
414+
" PRAGMA EXCEPTION_INIT(e_seq_exists, -02289); " +
415+
" BEGIN " +
416+
" EXECUTE IMMEDIATE ('DROP SEQUENCE " + seqName + " '); " +
417+
" EXCEPTION " +
418+
" WHEN e_seq_exists " +
419+
" THEN NULL; " +
420+
" END; " +
421+
" EXECUTE IMMEDIATE (' " +
422+
" CREATE SEQUENCE " + seqName +
423+
" '); " +
424+
"END; ";
425+
426+
return createSeq;
427+
}*/
428+
294429
module.exports = assist;

0 commit comments

Comments
 (0)