Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
eea248af
Commit
eea248af
authored
26 years ago
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Updated to support the new directory node module.
Rev: lib/modules/Sql.pmod/sql.pike:1.28
parent
22413a43
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Sql.pmod/sql.pike
+31
-23
31 additions, 23 deletions
lib/modules/Sql.pmod/sql.pike
with
31 additions
and
23 deletions
lib/modules/Sql.pmod/sql.pike
+
31
−
23
View file @
eea248af
/*
/*
* $Id: sql.pike,v 1.2
7
1998/
07/17 20:47:40 mast
Exp $
* $Id: sql.pike,v 1.2
8
1998/
11/04 12:35:15 grubba
Exp $
*
*
* Implements the generic parts of the SQL-interface
* Implements the generic parts of the SQL-interface
*
*
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
//.
//.
//. File: sql.pike
//. File: sql.pike
//. RCSID: $Id: sql.pike,v 1.2
7
1998/
07/17 20:47:40 mast
Exp $
//. RCSID: $Id: sql.pike,v 1.2
8
1998/
11/04 12:35:15 grubba
Exp $
//. Author: Henrik Grubbstrm (grubba@idonex.se)
//. Author: Henrik Grubbstrm (grubba@idonex.se)
//.
//.
//. Synopsis: Implements the generic parts of the SQL-interface.
//. Synopsis: Implements the generic parts of the SQL-interface.
...
@@ -122,6 +122,7 @@ void create(void|string|object host, void|string db,
...
@@ -122,6 +122,7 @@ void create(void|string|object host, void|string db,
}
}
array(string) program_names;
array(string) program_names;
int throw_errors = 1;
if (host && (host != replace(host, ({ ":", "/", "@" }), ({ "", "", "" })))) {
if (host && (host != replace(host, ({ ":", "/", "@" }), ({ "", "", "" })))) {
...
@@ -132,9 +133,9 @@ void create(void|string|object host, void|string db,
...
@@ -132,9 +133,9 @@ void create(void|string|object host, void|string db,
array(string) arr = host/"://";
array(string) arr = host/"://";
if ((sizeof(arr) > 1) && (arr[0] != "")) {
if ((sizeof(arr) > 1) && (arr[0] != "")) {
if (sizeof(arr[0]/".pike") > 1) {
if (sizeof(arr[0]/".pike") > 1) {
program_names = ({ arr[0] });
program_names = ({
(
arr[0]
/".pike")[0]
});
} else {
} else {
program_names = ({ arr[0]
+ ".pike"
});
program_names = ({ arr[0] });
}
}
host = arr[1..] * "://";
host = arr[1..] * "://";
}
}
...
@@ -166,33 +167,40 @@ void create(void|string|object host, void|string db,
...
@@ -166,33 +167,40 @@ void create(void|string|object host, void|string db,
host = 0;
host = 0;
}
}
foreach(program_names || get_dir(Sql->dirname), string program_name) {
if (!program_names) {
if ((sizeof(program_name / "_result") == 1) &&
(sizeof(program_name / ".pike") > 1) &&
(program_name[..7] != "sql.pike")) {
/* Don't call ourselves... */
array(mixed) err;
err = catch {
program p;
#ifdef PIKE_SQL_DEBUG
#ifdef PIKE_SQL_DEBUG
err = catch {p = Sql[program_name];}
;
program_names = indices(Sql)
;
#else /* !PIKE_SQL_DEBUG */
#else /* !PIKE_SQL_DEBUG */
// Ignore compiler errors for the various sql-modules,
// Ignore compiler errors for the various sql-modules,
// since we might not have some.
// since we might not have some.
// This is NOT a nice way to do it, but...
// This is NOT a nice way to do it, but...
mixed old_inhib = master()->inhibit_compile_errors;
mixed old_inhib = master()->inhibit_compile_errors;
master()->inhibit_compile_errors = lambda(){};
master()->inhibit_compile_errors = lambda(){};
err = catch {p = Sql[program_name];}
;
program_names = indices(Sql)
;
// Restore compiler errors mode to whatever it was before.
// Restore compiler errors mode to whatever it was before.
master()->inhibit_compile_errors = old_inhib;
master()->inhibit_compile_errors = old_inhib;
throw_errors = 0;
#endif /* PIKE_SQL_DEBUG */
#endif /* PIKE_SQL_DEBUG */
}
foreach(program_names, string program_name) {
if ((sizeof(program_name / "_result") == 1) &&
(program_name[..2] != "sql")) {
/* Don't call ourselves... */
array(mixed) err;
err = catch {
program p;
err = catch {p = Sql[program_name];};
if (err) {
if (err) {
#ifdef PIKE_SQL_DEBUG
#ifdef PIKE_SQL_DEBUG
Stdio.stderr->write(sprintf("Sql.sql(): Failed to compile module Sql.%s (%s)\n",
Stdio.stderr->write(sprintf("Sql.sql(): Failed to compile module Sql.%s (%s)\n",
program_name, err[0]));
program_name, err[0]));
#endif /* PIKE_SQL_DEBUG */
#endif /* PIKE_SQL_DEBUG */
if (
program_name
s) {
if (
throw_error
s) {
throw(err);
throw(err);
} else {
} else {
throw(0);
throw(0);
...
@@ -215,7 +223,7 @@ void create(void|string|object host, void|string db,
...
@@ -215,7 +223,7 @@ void create(void|string|object host, void|string db,
break;
break;
};
};
if (err) {
if (err) {
if (
program_name
s) {
if (
throw_error
s) {
throw(err);
throw(err);
}
}
#ifdef PIKE_SQL_DEBUG
#ifdef PIKE_SQL_DEBUG
...
@@ -224,7 +232,7 @@ void create(void|string|object host, void|string db,
...
@@ -224,7 +232,7 @@ void create(void|string|object host, void|string db,
#endif /* PIKE_SQL_DEBUG */
#endif /* PIKE_SQL_DEBUG */
}
}
} else {
} else {
if (
program_name
s) {
if (
throw_error
s) {
throw(({ sprintf("Sql.sql(): Failed to index module Sql.%s\n",
throw(({ sprintf("Sql.sql(): Failed to index module Sql.%s\n",
program_name), backtrace() }));
program_name), backtrace() }));
}
}
...
@@ -234,14 +242,14 @@ void create(void|string|object host, void|string db,
...
@@ -234,14 +242,14 @@ void create(void|string|object host, void|string db,
#endif /* PIKE_SQL_DEBUG */
#endif /* PIKE_SQL_DEBUG */
}
}
};
};
if (err &&
program_name
s) {
if (err &&
throw_error
s) {
throw(err);
throw(err);
}
}
}
}
}
}
if (!master_sql)
if (!master_sql)
if (!
program_name
s) {
if (!
throw_error
s) {
throw_error("Sql.sql(): Couldn't connect using any of the databases\n");
throw_error("Sql.sql(): Couldn't connect using any of the databases\n");
} else {
} else {
throw_error("Sql.sql(): Couldn't connect using the " +
throw_error("Sql.sql(): Couldn't connect using the " +
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment